diff options
author | Michael Stahl <mst@openoffice.org> | 2011-03-11 12:11:04 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-03-11 12:11:04 +0100 |
commit | 927fc014b3c52ff77ba7f2c0f8bba8046e7207db (patch) | |
tree | b3563e7fff99139c4eaafa8ff381fb8bbd683f75 /sc | |
parent | 4f9f8804148dc6c52378004e2d3bdb2b400d9fa4 (diff) | |
parent | 61b8bd9f42f48609a14cab31f58d5122285e67f6 (diff) |
sw34bf04: merge DEV300_m102
Diffstat (limited to 'sc')
85 files changed, 2471 insertions, 3147 deletions
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx index b1c00d0636c6..ed66751364a5 100644 --- a/sc/inc/dpglobal.hxx +++ b/sc/inc/dpglobal.hxx @@ -62,8 +62,6 @@ // moved from fieldwnd.hxx, see also SC_DAPI_MAXFIELDS #define MAX_LABELS 256 -#define MAX_PAGEFIELDS 10 // maximum count of fields for page area - #define PIVOT_MAXFUNC 11 #define PIVOT_FUNC_NONE 0x0000 #define PIVOT_FUNC_SUM 0x0001 diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 8e15bd55068d..e69f8e8c3a3f 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -208,7 +208,7 @@ public: void ToggleDetails(const ::com::sun::star::sheet::DataPilotTableHeaderData& rElemDesc, ScDPObject* pDestObj); - sal_Bool FillOldParam(ScPivotParam& rParam, sal_Bool bForFile) const; + sal_Bool FillOldParam(ScPivotParam& rParam) const; sal_Bool FillLabelData(ScPivotParam& rParam); void InitFromOldPivot(const ScPivot& rOld, ScDocument* pDoc, sal_Bool bSetSource); @@ -251,14 +251,14 @@ public: CreateSource( const ScDPServiceDesc& rDesc ); static void ConvertOrientation( ScDPSaveData& rSaveData, - PivotField* pFields, SCSIZE nCount, sal_uInt16 nOrient, + const ScPivotFieldVector& rFields, sal_uInt16 nOrient, ScDocument* pDoc, SCROW nRow, SCTAB nTab, const com::sun::star::uno::Reference< com::sun::star::sheet::XDimensionsSupplier>& xSource, - sal_Bool bOldDefaults, - PivotField* pRefColFields = NULL, SCSIZE nRefColCount = 0, - PivotField* pRefRowFields = NULL, SCSIZE nRefRowCount = 0, - PivotField* pRefPageFields = NULL, SCSIZE nRefPageCount = 0 ); + bool bOldDefaults, + const ScPivotFieldVector* pRefColFields = 0, + const ScPivotFieldVector* pRefRowFields = 0, + const ScPivotFieldVector* pRefPageFields = 0 ); static bool IsOrientationAllowed( sal_uInt16 nOrient, sal_Int32 nDimFlags ); }; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index d0df5e3e2426..766c8c551d5d 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -118,13 +118,9 @@ const sal_Unicode CHAR_ZWNBSP = 0x2060; #ifdef SC_ROWLIMIT_TYPECONVERSION_NOCONVPASS const size_t MAXSUBTOTAL = 3; const size_t MAXQUERY = 8; -const size_t PIVOT_MAXFIELD = 8; -const size_t PIVOT_MAXPAGEFIELD = 10; #else const SCSIZE MAXSUBTOTAL = 3; const SCSIZE MAXQUERY = 8; -const SCSIZE PIVOT_MAXFIELD = 8; -const SCSIZE PIVOT_MAXPAGEFIELD = 10; #endif #define SC_START_INDEX_DB_COLL 50000 diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx index dbf54fb6ed82..b2fca0460b8a 100644 --- a/sc/inc/pivot.hxx +++ b/sc/inc/pivot.hxx @@ -68,78 +68,15 @@ class SvStream; class ScDocument; class ScUserListData; class ScProgress; -struct ScDPLabelData; -typedef ::boost::shared_ptr<ScDPLabelData> ScDPLabelDataRef; - -// ----------------------------------------------------------------------- - -struct PivotField -{ - SCsCOL nCol; - sal_uInt16 nFuncMask; - sal_uInt16 nFuncCount; - ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; - - explicit PivotField( SCsCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE ); - - bool operator==( const PivotField& r ) const; -}; - -// ----------------------------------------------------------------------- - -// implementation still in global2.cxx -struct ScPivotParam -{ - SCCOL nCol; // Cursor Position / - SCROW nRow; // bzw. Anfang des Zielbereiches - SCTAB nTab; - ::std::vector<ScDPLabelDataRef> maLabelArray; - PivotField aPageArr[PIVOT_MAXPAGEFIELD]; - PivotField aColArr[PIVOT_MAXFIELD]; - PivotField aRowArr[PIVOT_MAXFIELD]; - PivotField aDataArr[PIVOT_MAXFIELD]; - SCSIZE nPageCount; - SCSIZE nColCount; - SCSIZE nRowCount; - SCSIZE nDataCount; - sal_Bool bIgnoreEmptyRows; - sal_Bool bDetectCategories; - sal_Bool bMakeTotalCol; - sal_Bool bMakeTotalRow; - - ScPivotParam(); - ScPivotParam( const ScPivotParam& r ); - ~ScPivotParam(); - - ScPivotParam& operator= ( const ScPivotParam& r ); - sal_Bool operator== ( const ScPivotParam& r ) const; -//UNUSED2009-05 void Clear (); - void ClearPivotArrays(); - void SetLabelData (const ::std::vector<ScDPLabelDataRef>& r); - void SetPivotArrays ( const PivotField* pPageArr, - const PivotField* pColArr, - const PivotField* pRowArr, - const PivotField* pDataArr, - SCSIZE nPageCnt, - SCSIZE nColCnt, - SCSIZE nRowCnt, - SCSIZE nDataCnt ); -}; - -// ----------------------------------------------------------------------- - -typedef PivotField PivotFieldArr[PIVOT_MAXFIELD]; -typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD]; - -//------------------------------------------------------------------------ +// ============================================================================ struct ScDPLabelData { ::rtl::OUString maName; /// Original name of the dimension. ::rtl::OUString maLayoutName; /// Layout name (display name) - SCsCOL mnCol; - sal_uInt16 mnFuncMask; /// Page/Column/Row subtotal function. + SCCOL mnCol; + sal_uInt16 mnFuncMask; /// Page/Column/Row subtotal function. sal_Int32 mnUsedHier; /// Used hierarchy. sal_Int32 mnFlags; /// Flags from the DataPilotSource dimension bool mbShowAll; /// true = Show all (also empty) results. @@ -167,7 +104,7 @@ struct ScDPLabelData ::com::sun::star::sheet::DataPilotFieldLayoutInfo maLayoutInfo; /// Layout info. ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo; /// AutoShow info. - explicit ScDPLabelData( const String& rName, short nCol, bool bIsValue ); + explicit ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue ); /** * return the name that should be displayed in the dp dialogs i.e. when @@ -176,22 +113,63 @@ struct ScDPLabelData ::rtl::OUString SC_DLLPUBLIC getDisplayName() const; }; +typedef std::vector< ScDPLabelData > ScDPLabelDataVector; + +// ============================================================================ + +struct ScPivotField +{ + SCCOL nCol; + sal_uInt16 nFuncMask; + sal_uInt16 nFuncCount; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE ); + + bool operator==( const ScPivotField& r ) const; +}; + +typedef ::std::vector< ScPivotField > ScPivotFieldVector; + +// ============================================================================ + +struct ScPivotParam +{ + SCCOL nCol; // Cursor Position / + SCROW nRow; // bzw. Anfang des Zielbereiches + SCTAB nTab; + ScDPLabelDataVector maLabelArray; + ScPivotFieldVector maPageArr; + ScPivotFieldVector maColArr; + ScPivotFieldVector maRowArr; + ScPivotFieldVector maDataArr; + bool bIgnoreEmptyRows; + bool bDetectCategories; + bool bMakeTotalCol; + bool bMakeTotalRow; + + ScPivotParam(); + + bool operator==( const ScPivotParam& r ) const; +}; + // ============================================================================ -struct ScDPFuncData +struct ScPivotFuncData { - short mnCol; - sal_uInt16 mnFuncMask; + SCCOL mnCol; + sal_uInt16 mnFuncMask; ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; - explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask ); - explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask, + explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ); + explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask, const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef ); }; +typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector; + // ============================================================================ -typedef std::vector< ScDPLabelData > ScDPLabelDataVec; typedef std::vector< String > ScDPNameVec; // ============================================================================ diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index b38bec784b54..9e5d40cd7108 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -993,6 +993,14 @@ #define STR_ACC_DATAPILOT_DATA_DESCR (STR_START + 180) #define STR_ACC_DATAPILOT_SEL_DESCR (STR_START + 181) +//IAccessibility2 Implementation 2009----- +#define STR_ACC_TOOLBAR_FORMULA (STR_START + 182) +#define STR_ACC_DOC_SPREADSHEET (STR_START + 185) +#define STR_ACC_DOC_PREVIEW_SUFFIX (STR_START + 186) +#define STR_ACC_DOC_SPREADSHEET_READONLY (STR_START + 187) + +//-----IAccessibility2 Implementation 2009 + // -------------------------------------------------- #define SCSTR_HUMAN_SCDOC_NAME (STR_START + 210) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 247ee21fe76b..36bf1ff7e76a 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -51,7 +51,7 @@ class ScQueryItem; class ScImportOptions; class SfxStyleSheetBase; class ScDPObject; -struct ScDPFuncData; +struct ScPivotFuncData; struct ScDPNumGroupInfo; //<!--Added by PengYunQuan for Validity Cell Range Picker class ScTabViewShell; @@ -405,14 +405,14 @@ public: const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ) = 0; virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, - const ScDPLabelDataVec& rLabelVec, + const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData ) = 0; + const ScPivotFuncData& rFuncData ) = 0; virtual AbstractScDPSubtotalDlg * CreateScDPSubtotalDlg( Window* pParent, int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData, + const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) = 0; diff --git a/sc/prj/build.lst b/sc/prj/build.lst index f5ab2a5f73fe..f124dafb90a2 100644 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -1,4 +1,4 @@ -sc sc : filter l10n vbahelper oovbaapi svx uui stoc BOOST:boost formula MDDS:mdds oox LIBXSLT:libxslt NULL +sc sc : filter L10N:l10n vbahelper oovbaapi svx uui stoc BOOST:boost formula MDDS:mdds oox LIBXSLT:libxslt NULL sc sc usr1 - all sc_mkout NULL sc sc\inc nmake - all sc_inc NULL sc sc\prj get - all sc_prj NULL diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 534c2333bd9b..084ccb7ba977 100644..100755 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -704,7 +704,7 @@ void ScDocument::UpdateFontCharSet() pItem = (SvxFontItem*)pPool->GetItem2(ATTR_FONT, i); if ( pItem && ( pItem->GetCharSet() == eSrcSet || ( bUpdateOld && pItem->GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) ) - pItem->GetCharSet() = eSysSet; + pItem->SetCharSet(eSysSet); } if ( pDrawLayer ) @@ -716,7 +716,7 @@ void ScDocument::UpdateFontCharSet() pItem = (SvxFontItem*)rDrawPool.GetItem2(EE_CHAR_FONTINFO, i); if ( pItem && ( pItem->GetCharSet() == eSrcSet || ( bUpdateOld && pItem->GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) ) - pItem->GetCharSet() = eSysSet; + pItem->SetCharSet( eSysSet ); } } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 80e9038cc539..714467d8e5eb 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1986,7 +1986,7 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SetInsertingFromOtherDoc( sal_True); UpdateReference( URM_MOVE, nCol1, nRow1, i, nCol2, nRow2, i+nFollow, - nDx, nDy, nDz, pCBFCP->pRefUndoDoc ); + nDx, nDy, nDz, pCBFCP->pRefUndoDoc, sal_False ); SetInsertingFromOtherDoc( bOldInserting); } else diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 149c712fbdcf..ad1932303da0 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1711,24 +1711,22 @@ sal_uInt16 lcl_CountBits( sal_uInt16 nBits ) return nCount; } -SCSIZE lcl_FillOldFields( PivotField* pFields, +void lcl_FillOldFields( ScPivotFieldVector& rFields, const uno::Reference<sheet::XDimensionsSupplier>& xSource, - sal_uInt16 nOrient, SCCOL nColAdd, sal_Bool bAddData ) + sal_uInt16 nOrient, SCCOL nColAdd, bool bAddData ) { - SCSIZE nOutCount = 0; - sal_Bool bDataFound = sal_False; - - SCSIZE nCount = (nOrient == sheet::DataPilotFieldOrientation_PAGE) ? PIVOT_MAXPAGEFIELD : PIVOT_MAXFIELD; + bool bDataFound = false; + rFields.clear(); //! merge multiple occurences (data field with different functions) //! force data field in one dimension - std::vector< long > aPos( nCount, 0 ); + std::vector< long > aPos; uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions(); uno::Reference<container::XIndexAccess> xDims = new ScNameToIndexAccess( xDimsName ); long nDimCount = xDims->getCount(); - for (long nDim=0; nDim < nDimCount && nOutCount < nCount; nDim++) + for (long nDim=0; nDim < nDimCount; nDim++) { uno::Reference<uno::XInterface> xIntDim = ScUnoHelpFunctions::AnyToInterface( xDims->getByIndex(nDim) ); @@ -1775,7 +1773,7 @@ SCSIZE lcl_FillOldFields( PivotField* pFields, nDupSource = lcl_FindName( xNameOrig->getName(), xDimsName ); } - sal_Bool bDupUsed = sal_False; + bool bDupUsed = false; if ( nDupSource >= 0 ) { // add function bit to previous entry @@ -1786,77 +1784,76 @@ SCSIZE lcl_FillOldFields( PivotField* pFields, else nCompCol = static_cast<SCsCOL>(nDupSource)+nColAdd; //! seek source column from name - for (SCSIZE nOld=0; nOld<nOutCount && !bDupUsed; nOld++) - if ( pFields[nOld].nCol == nCompCol ) + for (ScPivotFieldVector::iterator aIt = rFields.begin(), aEnd = rFields.end(); (aIt != aEnd) && !bDupUsed; ++aIt) + if ( aIt->nCol == nCompCol ) { // add to previous column only if new bits aren't already set there - if ( ( pFields[nOld].nFuncMask & nMask ) == 0 ) + if ( ( aIt->nFuncMask & nMask ) == 0 ) { - pFields[nOld].nFuncMask |= nMask; - pFields[nOld].nFuncCount = lcl_CountBits( pFields[nOld].nFuncMask ); - bDupUsed = sal_True; + aIt->nFuncMask |= nMask; + aIt->nFuncCount = lcl_CountBits( aIt->nFuncMask ); + bDupUsed = true; } } } if ( !bDupUsed ) // also for duplicated dim if original has different orientation { + rFields.resize( rFields.size() + 1 ); + ScPivotField& rField = rFields.back(); + if ( bDataLayout ) { - pFields[nOutCount].nCol = PIVOT_DATA_FIELD; - bDataFound = sal_True; + rField.nCol = PIVOT_DATA_FIELD; + bDataFound = true; } else if ( nDupSource >= 0 ) // if source was not found (different orientation) - pFields[nOutCount].nCol = static_cast<SCsCOL>(nDupSource)+nColAdd; //! seek from name + rField.nCol = static_cast<SCsCOL>(nDupSource)+nColAdd; //! seek from name else - pFields[nOutCount].nCol = static_cast<SCsCOL>(nDim)+nColAdd; //! seek source column from name + rField.nCol = static_cast<SCsCOL>(nDim)+nColAdd; //! seek source column from name - pFields[nOutCount].nFuncMask = nMask; - pFields[nOutCount].nFuncCount = lcl_CountBits( nMask ); - aPos[nOutCount] = ScUnoHelpFunctions::GetLongProperty( xDimProp, - rtl::OUString::createFromAscii(DP_PROP_POSITION) ); + rField.nFuncMask = nMask; + rField.nFuncCount = lcl_CountBits( nMask ); + + aPos.push_back( ScUnoHelpFunctions::GetLongProperty( xDimProp, + rtl::OUString::createFromAscii(DP_PROP_POSITION) ) ); try { if( nOrient == sheet::DataPilotFieldOrientation_DATA ) xDimProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_REFVALUE ) ) ) - >>= pFields[nOutCount].maFieldRef; + >>= rFields.back().maFieldRef; } catch( uno::Exception& ) { } - - ++nOutCount; } } } // sort by getPosition() value - - for (SCSIZE i=0; i+1<nOutCount; i++) + size_t nSize = aPos.size(); + for (size_t i=0; i+1<nSize; i++) { - for (SCSIZE j=0; j+i+1<nOutCount; j++) + for (size_t j=0; j+i+1<nSize; j++) if ( aPos[j+1] < aPos[j] ) { std::swap( aPos[j], aPos[j+1] ); - std::swap( pFields[j], pFields[j+1] ); + std::swap( rFields[j], rFields[j+1] ); } } if ( bAddData && !bDataFound ) { - if ( nOutCount >= nCount ) // space for data field? - --nOutCount; //! error? - pFields[nOutCount].nCol = PIVOT_DATA_FIELD; - pFields[nOutCount].nFuncMask = 0; - pFields[nOutCount].nFuncCount = 0; - ++nOutCount; + rFields.resize( rFields.size() + 1 ); + ScPivotField& rField = rFields.back(); + rField.nCol = PIVOT_DATA_FIELD; + rField.nFuncMask = 0; + rField.nFuncCount = 0; } - - return nOutCount; } -sal_Bool ScDPObject::FillOldParam(ScPivotParam& rParam, sal_Bool bForFile) const +sal_Bool ScDPObject::FillOldParam(ScPivotParam& rParam) const { ((ScDPObject*)this)->CreateObjects(); // xSource is needed for field numbers @@ -1866,23 +1863,11 @@ sal_Bool ScDPObject::FillOldParam(ScPivotParam& rParam, sal_Bool bForFile) const // ppLabelArr / nLabels is not changed SCCOL nColAdd = 0; - if ( bForFile ) - { - // in old file format, columns are within document, not within source range - - DBG_ASSERT( pSheetDesc, "FillOldParam: bForFile, !pSheetDesc" ); - nColAdd = pSheetDesc->aSourceRange.aStart.Col(); - } - - sal_Bool bAddData = ( lcl_GetDataGetOrientation( xSource ) == sheet::DataPilotFieldOrientation_HIDDEN ); - rParam.nPageCount = lcl_FillOldFields( rParam.aPageArr, - xSource, sheet::DataPilotFieldOrientation_PAGE, nColAdd, sal_False ); - rParam.nColCount = lcl_FillOldFields( rParam.aColArr, - xSource, sheet::DataPilotFieldOrientation_COLUMN, nColAdd, bAddData ); - rParam.nRowCount = lcl_FillOldFields( rParam.aRowArr, - xSource, sheet::DataPilotFieldOrientation_ROW, nColAdd, sal_False ); - rParam.nDataCount = lcl_FillOldFields( rParam.aDataArr, - xSource, sheet::DataPilotFieldOrientation_DATA, nColAdd, sal_False ); + bool bAddData = ( lcl_GetDataGetOrientation( xSource ) == sheet::DataPilotFieldOrientation_HIDDEN ); + lcl_FillOldFields( rParam.maPageArr, xSource, sheet::DataPilotFieldOrientation_PAGE, nColAdd, false ); + lcl_FillOldFields( rParam.maColArr, xSource, sheet::DataPilotFieldOrientation_COLUMN, nColAdd, bAddData ); + lcl_FillOldFields( rParam.maRowArr, xSource, sheet::DataPilotFieldOrientation_ROW, nColAdd, false ); + lcl_FillOldFields( rParam.maDataArr, xSource, sheet::DataPilotFieldOrientation_DATA, nColAdd, false ); uno::Reference<beans::XPropertySet> xProp( xSource, uno::UNO_QUERY ); if (xProp.is()) @@ -2003,14 +1988,14 @@ sal_Bool ScDPObject::FillLabelData(ScPivotParam& rParam) SCsCOL nCol = static_cast< SCsCOL >( nDim ); //! ??? bool bIsValue = true; //! check - ScDPLabelDataRef pNewLabel(new ScDPLabelData(aFieldName, nCol, bIsValue)); - pNewLabel->maLayoutName = aLayoutName; - GetHierarchies(nDim, pNewLabel->maHiers); - GetMembers(nDim, GetUsedHierarchy(nDim), pNewLabel->maMembers); - lcl_FillLabelData(*pNewLabel, xDimProp); - pNewLabel->mnFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp, + ScDPLabelData aNewLabel(aFieldName, nCol, bIsValue); + aNewLabel.maLayoutName = aLayoutName; + GetHierarchies(nDim, aNewLabel.maHiers); + GetMembers(nDim, GetUsedHierarchy(nDim), aNewLabel.maMembers); + lcl_FillLabelData(aNewLabel, xDimProp); + aNewLabel.mnFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp, rtl::OUString::createFromAscii(SC_UNO_FLAGS), 0 ); - rParam.maLabelArray.push_back(pNewLabel); + rParam.maLabelArray.push_back(aNewLabel); } } } @@ -2131,13 +2116,13 @@ String lcl_GetDimName( const uno::Reference<sheet::XDimensionsSupplier>& xSource // static void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData, - PivotField* pFields, SCSIZE nCount, sal_uInt16 nOrient, + const ScPivotFieldVector& rFields, sal_uInt16 nOrient, ScDocument* pDoc, SCROW nRow, SCTAB nTab, const uno::Reference<sheet::XDimensionsSupplier>& xSource, - sal_Bool bOldDefaults, - PivotField* pRefColFields, SCSIZE nRefColCount, - PivotField* pRefRowFields, SCSIZE nRefRowCount, - PivotField* pRefPageFields, SCSIZE nRefPageCount ) + bool bOldDefaults, + const ScPivotFieldVector* pRefColFields, + const ScPivotFieldVector* pRefRowFields, + const ScPivotFieldVector* pRefPageFields ) { // pDoc or xSource must be set DBG_ASSERT( pDoc || xSource.is(), "missing string source" ); @@ -2145,11 +2130,11 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData, String aDocStr; ScDPSaveDimension* pDim; - for (SCSIZE i=0; i<nCount; i++) + for (ScPivotFieldVector::const_iterator aIt = rFields.begin(), aEnd = rFields.end(); aIt != aEnd; ++aIt) { - SCCOL nCol = pFields[i].nCol; - sal_uInt16 nFuncs = pFields[i].nFuncMask; - const sheet::DataPilotFieldReference& rFieldRef = pFields[i].maFieldRef; + SCCOL nCol = aIt->nCol; + sal_uInt16 nFuncs = aIt->nFuncMask; + const sheet::DataPilotFieldReference& rFieldRef = aIt->maFieldRef; if ( nCol == PIVOT_DATA_FIELD ) pDim = rSaveData.GetDataLayoutDimension(); @@ -2171,28 +2156,28 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData, if ( nOrient == sheet::DataPilotFieldOrientation_DATA ) // set summary function { // generate an individual entry for each function - sal_Bool bFirst = sal_True; + bool bFirst = true; // if a dimension is used for column/row/page and data, // use duplicated dimensions for all data occurrences if (pRefColFields) - for (SCSIZE nRefCol=0; nRefCol<nRefColCount; nRefCol++) - if (pRefColFields[nRefCol].nCol == nCol) - bFirst = sal_False; + for (ScPivotFieldVector::const_iterator aRefIt = pRefColFields->begin(), aRefEnd = pRefColFields->end(); bFirst && (aRefIt != aRefEnd); ++aRefIt) + if (aRefIt->nCol == nCol) + bFirst = false; if (pRefRowFields) - for (SCSIZE nRefRow=0; nRefRow<nRefRowCount; nRefRow++) - if (pRefRowFields[nRefRow].nCol == nCol) - bFirst = sal_False; + for (ScPivotFieldVector::const_iterator aRefIt = pRefRowFields->begin(), aRefEnd = pRefRowFields->end(); bFirst && (aRefIt != aRefEnd); ++aRefIt) + if (aRefIt->nCol == nCol) + bFirst = false; if (pRefPageFields) - for (sal_uInt16 nRefPage=0; nRefPage<nRefPageCount; ++nRefPage) - if (pRefPageFields[nRefPage].nCol == nCol) - bFirst = sal_False; + for (ScPivotFieldVector::const_iterator aRefIt = pRefPageFields->begin(), aRefEnd = pRefPageFields->end(); bFirst && (aRefIt != aRefEnd); ++aRefIt) + if (aRefIt->nCol == nCol) + bFirst = false; // if set via api, a data column may occur several times // (if the function hasn't been changed yet) -> also look for duplicate data column - for (SCSIZE nPrevData=0; nPrevData<i; nPrevData++) - if (pFields[nPrevData].nCol == nCol) - bFirst = sal_False; + for (ScPivotFieldVector::const_iterator aRefIt = rFields.begin(); bFirst && (aRefIt != aIt); ++aRefIt) + if (aRefIt->nCol == nCol) + bFirst = false; sal_uInt16 nMask = 1; for (sal_uInt16 nBit=0; nBit<16; nBit++) @@ -2209,7 +2194,7 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData, else pCurrDim->SetReferenceValue( &rFieldRef ); - bFirst = sal_False; + bFirst = false; } nMask *= 2; } @@ -2511,7 +2496,7 @@ ScDPObject* ScDPCollection::GetByName(const String& rName) const String ScDPCollection::CreateNewName( sal_uInt16 nMin ) const { - String aBase = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("DataPilot")); + String aBase( RTL_CONSTASCII_USTRINGPARAM( "Pivot" ) ); //! from Resource? for (sal_uInt16 nAdd=0; nAdd<=nCount; nAdd++) // nCount+1 tries diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index f79d403683f6..3b64328f8b3b 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -45,14 +45,9 @@ #include "global.hxx" #include "rangeutl.hxx" -#include "pivot.hxx" #include "rechead.hxx" #include "compiler.hxx" #include "paramisc.hxx" -// Wang Xu Ming -- 2009-5-18 -// DataPilot Migration -#include "dpglobal.hxx" -// End Comments #include "sc.hrc" #include "globstr.hrc" @@ -566,179 +561,6 @@ void __EXPORT ScConsolidateParam::SetAreas( ScArea* const* ppAreas, sal_uInt16 n } } -// ----------------------------------------------------------------------- - -PivotField::PivotField( SCsCOL nNewCol, sal_uInt16 nNewFuncMask ) : - nCol( nNewCol ), - nFuncMask( nNewFuncMask ), - nFuncCount( 0 ) -{ -} - -bool PivotField::operator==( const PivotField& r ) const -{ - return (nCol == r.nCol) - && (nFuncMask == r.nFuncMask) - && (nFuncCount == r.nFuncCount) - && (maFieldRef.ReferenceType == r.maFieldRef.ReferenceType) - && (maFieldRef.ReferenceField == r.maFieldRef.ReferenceField) - && (maFieldRef.ReferenceItemType == r.maFieldRef.ReferenceItemType) - && (maFieldRef.ReferenceItemName == r.maFieldRef.ReferenceItemName); -} - -//------------------------------------------------------------------------ -// struct ScPivotParam: - -ScPivotParam::ScPivotParam() - : nCol(0), nRow(0), nTab(0), - nPageCount(0), nColCount(0), nRowCount(0), nDataCount(0), - bIgnoreEmptyRows(sal_False), bDetectCategories(sal_False), - bMakeTotalCol(sal_True), bMakeTotalRow(sal_True) -{ -} - -//------------------------------------------------------------------------ - -ScPivotParam::ScPivotParam( const ScPivotParam& r ) - : nCol( r.nCol ), nRow( r.nRow ), nTab( r.nTab ), - nPageCount(0), nColCount(0), nRowCount(0), nDataCount(0), - bIgnoreEmptyRows(r.bIgnoreEmptyRows), - bDetectCategories(r.bDetectCategories), - bMakeTotalCol(r.bMakeTotalCol), - bMakeTotalRow(r.bMakeTotalRow) -{ - SetPivotArrays ( r.aPageArr, r.aColArr, r.aRowArr, r.aDataArr, - r.nPageCount, r.nColCount, r.nRowCount, r.nDataCount ); - - SetLabelData(r.maLabelArray); -} - -//------------------------------------------------------------------------ - -__EXPORT ScPivotParam::~ScPivotParam() -{ -} - -//------------------------------------------------------------------------ - -//UNUSED2009-05 void __EXPORT ScPivotParam::Clear() -//UNUSED2009-05 { -//UNUSED2009-05 nCol = 0; -//UNUSED2009-05 nRow = 0; -//UNUSED2009-05 nTab = 0; -//UNUSED2009-05 bIgnoreEmptyRows = bDetectCategories = sal_False; -//UNUSED2009-05 bMakeTotalCol = bMakeTotalRow = sal_True; -//UNUSED2009-05 ClearLabelData(); -//UNUSED2009-05 ClearPivotArrays(); -//UNUSED2009-05 } - -void __EXPORT ScPivotParam::ClearPivotArrays() -{ - memset( aPageArr, 0, PIVOT_MAXPAGEFIELD * sizeof(PivotField) ); - memset( aColArr, 0, PIVOT_MAXFIELD * sizeof(PivotField) ); - memset( aRowArr, 0, PIVOT_MAXFIELD * sizeof(PivotField) ); - memset( aDataArr, 0, PIVOT_MAXFIELD * sizeof(PivotField) ); - nPageCount = 0; - nColCount = 0; - nRowCount = 0; - nDataCount = 0; -} - -void ScPivotParam::SetLabelData(const vector<ScDPLabelDataRef>& r) -{ - vector<ScDPLabelDataRef> aNewArray; - aNewArray.reserve(r.size()); - for (vector<ScDPLabelDataRef>::const_iterator itr = r.begin(), itrEnd = r.end(); - itr != itrEnd; ++itr) - { - ScDPLabelDataRef p(new ScDPLabelData(**itr)); - aNewArray.push_back(p); - } - maLabelArray.swap(aNewArray); -} - -//------------------------------------------------------------------------ - -void __EXPORT ScPivotParam::SetPivotArrays ( const PivotField* pPageArr, - const PivotField* pColArr, - const PivotField* pRowArr, - const PivotField* pDataArr, - SCSIZE nPageCnt, - SCSIZE nColCnt, - SCSIZE nRowCnt, - SCSIZE nDataCnt ) -{ - ClearPivotArrays(); - - if ( pPageArr && pColArr && pRowArr && pDataArr ) - { - nPageCount = (nPageCnt>PIVOT_MAXPAGEFIELD) ? PIVOT_MAXPAGEFIELD : nPageCnt; - nColCount = (nColCnt>PIVOT_MAXFIELD) ? PIVOT_MAXFIELD : nColCnt; - nRowCount = (nRowCnt>PIVOT_MAXFIELD) ? PIVOT_MAXFIELD : nRowCnt; - nDataCount = (nDataCnt>PIVOT_MAXFIELD) ? PIVOT_MAXFIELD : nDataCnt; - - memcpy( aPageArr, pPageArr, nPageCount * sizeof(PivotField) ); - memcpy( aColArr, pColArr, nColCount * sizeof(PivotField) ); - memcpy( aRowArr, pRowArr, nRowCount * sizeof(PivotField) ); - memcpy( aDataArr, pDataArr, nDataCount * sizeof(PivotField) ); - } -} - -//------------------------------------------------------------------------ - -ScPivotParam& __EXPORT ScPivotParam::operator=( const ScPivotParam& r ) -{ - nCol = r.nCol; - nRow = r.nRow; - nTab = r.nTab; - bIgnoreEmptyRows = r.bIgnoreEmptyRows; - bDetectCategories = r.bDetectCategories; - bMakeTotalCol = r.bMakeTotalCol; - bMakeTotalRow = r.bMakeTotalRow; - - SetPivotArrays ( r.aPageArr, r.aColArr, r.aRowArr, r.aDataArr, - r.nPageCount, r.nColCount, r.nRowCount, r.nDataCount ); - SetLabelData(r.maLabelArray); - return *this; -} - -//------------------------------------------------------------------------ - -sal_Bool __EXPORT ScPivotParam::operator==( const ScPivotParam& r ) const -{ - sal_Bool bEqual = (nCol == r.nCol) - && (nRow == r.nRow) - && (nTab == r.nTab) - && (bIgnoreEmptyRows == r.bIgnoreEmptyRows) - && (bDetectCategories == r.bDetectCategories) - && (bMakeTotalCol == r.bMakeTotalCol) - && (bMakeTotalRow == r.bMakeTotalRow) - && (maLabelArray.size() == r.maLabelArray.size()) - && (nPageCount == r.nPageCount) - && (nColCount == r.nColCount) - && (nRowCount == r.nRowCount) - && (nDataCount == r.nDataCount); - - if ( bEqual ) - { - SCSIZE i; - - for ( i=0; i<nPageCount && bEqual; i++ ) - bEqual = ( aPageArr[i] == r.aPageArr[i] ); - - for ( i=0; i<nColCount && bEqual; i++ ) - bEqual = ( aColArr[i] == r.aColArr[i] ); - - for ( i=0; i<nRowCount && bEqual; i++ ) - bEqual = ( aRowArr[i] == r.aRowArr[i] ); - - for ( i=0; i<nDataCount && bEqual; i++ ) - bEqual = ( aDataArr[i] == r.aDataArr[i] ); - } - - return bEqual; -} - //------------------------------------------------------------------------ // struct ScSolveParam diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 51c01febcd36..b164721744b7 100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -131,6 +131,7 @@ EXCEPTIONSFILES= \ $(SLO)$/dptabres.obj \ $(SLO)$/dptabdat.obj \ $(SLO)$/global2.obj \ + $(SLO)$/pivot2.obj \ $(SLO)$/tabbgcolor.obj \ $(SLO)$/table1.obj \ $(SLO)$/table2.obj \ diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx index dc1ac56438f7..6b540781b66d 100644 --- a/sc/source/core/data/pivot2.cxx +++ b/sc/source/core/data/pivot2.cxx @@ -28,8 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - #ifdef _MSC_VER #pragma optimize("",off) #endif @@ -60,7 +58,6 @@ using ::com::sun::star::sheet::DataPilotFieldReference; using ::rtl::OUString; -// STATIC DATA ----------------------------------------------------------- // ============================================================================ ScDPLabelData::Member::Member() : @@ -77,7 +74,7 @@ OUString ScDPLabelData::Member::getDisplayName() const return maName; } -ScDPLabelData::ScDPLabelData( const String& rName, short nCol, bool bIsValue ) : +ScDPLabelData::ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue ) : maName( rName ), mnCol( nCol ), mnFuncMask( PIVOT_FUNC_NONE ), @@ -98,13 +95,59 @@ OUString ScDPLabelData::getDisplayName() const // ============================================================================ -ScDPFuncData::ScDPFuncData( short nCol, sal_uInt16 nFuncMask ) : +ScPivotField::ScPivotField( SCCOL nNewCol, sal_uInt16 nNewFuncMask ) : + nCol( nNewCol ), + nFuncMask( nNewFuncMask ), + nFuncCount( 0 ) +{ +} + +bool ScPivotField::operator==( const ScPivotField& r ) const +{ + return (nCol == r.nCol) + && (nFuncMask == r.nFuncMask) + && (nFuncCount == r.nFuncCount) + && (maFieldRef.ReferenceType == r.maFieldRef.ReferenceType) + && (maFieldRef.ReferenceField == r.maFieldRef.ReferenceField) + && (maFieldRef.ReferenceItemType == r.maFieldRef.ReferenceItemType) + && (maFieldRef.ReferenceItemName == r.maFieldRef.ReferenceItemName); +} + +// ============================================================================ + +ScPivotParam::ScPivotParam() + : nCol( 0 ), nRow( 0 ), nTab( 0 ), + bIgnoreEmptyRows( false ), bDetectCategories( false ), + bMakeTotalCol( true ), bMakeTotalRow( true ) +{ +} + +bool ScPivotParam::operator==( const ScPivotParam& r ) const +{ + return + (nCol == r.nCol) + && (nRow == r.nRow) + && (nTab == r.nTab) + && (bIgnoreEmptyRows == r.bIgnoreEmptyRows) + && (bDetectCategories == r.bDetectCategories) + && (bMakeTotalCol == r.bMakeTotalCol) + && (bMakeTotalRow == r.bMakeTotalRow) + && (maLabelArray.size() == r.maLabelArray.size()) // ! only size?? + && (maPageArr == r.maPageArr) + && (maColArr == r.maColArr) + && (maRowArr == r.maRowArr) + && (maDataArr == r.maDataArr); +} + +// ============================================================================ + +ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) : mnCol( nCol ), mnFuncMask( nFuncMask ) { } -ScDPFuncData::ScDPFuncData( short nCol, sal_uInt16 nFuncMask, const DataPilotFieldReference& rFieldRef ) : +ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask, const DataPilotFieldReference& rFieldRef ) : mnCol( nCol ), mnFuncMask( nFuncMask ), maFieldRef( rFieldRef ) diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 85447b6a8730..c1e261e3ba0a 100644..100755 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -387,7 +387,7 @@ sal_Bool ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVe CharSet eSysSet = gsl_getSystemTextEncoding(); CharSet eSrcSet = rStream.GetStreamCharSet(); if( eSrcSet != eSysSet && aFont.GetCharSet() == eSrcSet ) - aFont.GetCharSet() = eSysSet; + aFont.SetCharSet(eSysSet); aStacked.SetValue( aOrientation.IsStacked() ); aRotateAngle.SetValue( aOrientation.GetRotation( aRotateAngle.GetValue() ) ); diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx index 8edc85ad6f49..fc17f1b6dda5 100644 --- a/sc/source/filter/dif/difimp.cxx +++ b/sc/source/filter/dif/difimp.cxx @@ -263,8 +263,7 @@ DifParser::DifParser( SvStream& rNewIn, const sal_uInt32 nOption, ScDocument& rD DBG_ERRORFILE( "CharSet passed overrides and modifies StreamCharSet" ); rIn.SetStreamCharSet( eCharSet ); } - if ( eCharSet == RTL_TEXTENCODING_UNICODE ) - rIn.StartReadingUnicodeText(); + rIn.StartReadingUnicodeText( eCharSet ); bPlain = ( nOption == SC_DIFOPT_PLAIN ); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 0d04255f0141..07b4a76a9c82 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -57,9 +58,9 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> @@ -94,6 +95,7 @@ using ::com::sun::star::drawing::XShapes; using ::com::sun::star::chart2::IncrementData; using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::RelativeSize; using ::com::sun::star::chart2::ScaleData; using ::com::sun::star::chart2::SubIncrement; using ::com::sun::star::chart2::XAxis; @@ -820,6 +822,12 @@ void XclExpChFrame::Convert( const ScfPropertySet& rPropSet ) ConvertFrameBase( GetChRoot(), rPropSet, meObjType ); } +void XclExpChFrame::SetAutoFlags( bool bAutoPos, bool bAutoSize ) +{ + ::set_flag( maData.mnFlags, EXC_CHFRAME_AUTOPOS, bAutoPos ); + ::set_flag( maData.mnFlags, EXC_CHFRAME_AUTOSIZE, bAutoSize ); +} + bool XclExpChFrame::IsDefault() const { return IsDefaultFrameBase( GetFormatInfo( meObjType ).meDefFrameType ); @@ -2287,33 +2295,52 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) mxText.reset( new XclExpChText( GetChRoot() ) ); mxText->ConvertLegend( rPropSet ); - // legend position - Any aRelPosAny; + // legend position and size + Any aRelPosAny, aRelSizeAny; rPropSet.GetAnyProperty( aRelPosAny, EXC_CHPROP_RELATIVEPOSITION ); - if( aRelPosAny.has< RelativePosition >() ) + rPropSet.GetAnyProperty( aRelSizeAny, EXC_CHPROP_RELATIVESIZE ); + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_CUSTOM; + rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); + if( aRelPosAny.has< RelativePosition >() || ((eApiExpand == cssc::ChartLegendExpansion_CUSTOM) && aRelSizeAny.has< RelativeSize >()) ) { try { - /* The 'RelativePosition' property is used as indicator of manually - changed legend position, but due to the different anchor modes - used by this property (in the RelativePosition.Anchor member) - it cannot be used to calculate the position easily. For this, - the Chart1 API will be used instead. */ + /* The 'RelativePosition' or 'RelativeSize' properties are used as + indicator of manually changed legend position/size, but due to + the different anchor modes used by this property (in the + RelativePosition.Anchor member) it cannot be used to calculate + the position easily. For this, the Chart1 API will be used + instead. */ Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW ); // coordinates in CHLEGEND record written but not used by Excel mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE, EXC_CHFRAMEPOS_PARENT ) ); XclChFramePos& rFramePos = mxFramePos->GetFramePosData(); - rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( xChart1Legend->getPosition().X ); - rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( xChart1Legend->getPosition().Y ); + rFramePos.mnTLMode = EXC_CHFRAMEPOS_CHARTSIZE; + ::com::sun::star::awt::Point aLegendPos = xChart1Legend->getPosition(); + rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( aLegendPos.X ); + rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( aLegendPos.Y ); + // legend size, Excel expects points in CHFRAMEPOS record + rFramePos.mnBRMode = EXC_CHFRAMEPOS_ABSSIZE_POINTS; + ::com::sun::star::awt::Size aLegendSize = xChart1Legend->getSize(); + rFramePos.maRect.mnWidth = static_cast< sal_uInt16 >( aLegendSize.Width * EXC_POINTS_PER_HMM + 0.5 ); + rFramePos.maRect.mnHeight = static_cast< sal_uInt16 >( aLegendSize.Height * EXC_POINTS_PER_HMM + 0.5 ); + maData.maRect.mnWidth = CalcChartXFromHmm( aLegendSize.Width ); + maData.maRect.mnHeight = CalcChartYFromHmm( aLegendSize.Height ); + eApiExpand = cssc::ChartLegendExpansion_CUSTOM; // manual legend position implies manual plot area GetChartData().SetManualPlotArea(); maData.mnDockMode = EXC_CHLEGEND_NOTDOCKED; + // a CHFRAME record with cleared auto flags is needed + if( !mxFrame ) + mxFrame.reset( new XclExpChFrame( GetChRoot(), EXC_CHOBJTYPE_LEGEND ) ); + mxFrame->SetAutoFlags( false, false ); } catch( Exception& ) { OSL_ENSURE( false, "XclExpChLegend::Convert - cannot get legend shape" ); maData.mnDockMode = EXC_CHLEGEND_RIGHT; + eApiExpand = cssc::ChartLegendExpansion_HIGH; } } else @@ -2329,13 +2356,10 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) default: OSL_ENSURE( false, "XclExpChLegend::Convert - unrecognized legend position" ); maData.mnDockMode = EXC_CHLEGEND_RIGHT; + eApiExpand = cssc::ChartLegendExpansion_HIGH; } } - - // legend expansion - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; - rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); - ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc2::LegendExpansion_WIDE ); + ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand == cssc::ChartLegendExpansion_HIGH ); // other flags ::set_flag( maData.mnFlags, EXC_CHLEGEND_AUTOSERIES ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 2c8a2baca448..dcd9fc5db164 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart/TimeInterval.hpp> #include <com/sun/star/chart/TimeUnit.hpp> #include <com/sun/star/chart/XChartDocument.hpp> @@ -61,11 +62,11 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -109,6 +110,7 @@ using ::com::sun::star::drawing::XShape; using ::com::sun::star::chart2::IncrementData; using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::RelativeSize; using ::com::sun::star::chart2::ScaleData; using ::com::sun::star::chart2::SubIncrement; using ::com::sun::star::chart2::XAxis; @@ -337,14 +339,24 @@ sal_Int32 XclImpChRoot::CalcHmmFromChartY( sal_Int32 nPosY ) const CalcHmmFromChartY( rRect.mnHeight ) ); } +double XclImpChRoot::CalcRelativeFromHmmX( sal_Int32 nPosX ) const +{ + return static_cast< double >( nPosX ) / mxChData->maChartRect.GetWidth(); +} + +double XclImpChRoot::CalcRelativeFromHmmY( sal_Int32 nPosY ) const +{ + return static_cast< double >( nPosY ) / mxChData->maChartRect.GetHeight(); +} + double XclImpChRoot::CalcRelativeFromChartX( sal_Int32 nPosX ) const { - return static_cast< double >( CalcHmmFromChartX( nPosX ) ) / mxChData->maChartRect.GetWidth(); + return CalcRelativeFromHmmX( CalcHmmFromChartX( nPosX ) ); } double XclImpChRoot::CalcRelativeFromChartY( sal_Int32 nPosY ) const { - return static_cast< double >( CalcHmmFromChartY( nPosY ) ) / mxChData->maChartRect.GetHeight(); + return CalcRelativeFromHmmY( CalcHmmFromChartY( nPosY ) ); } void XclImpChRoot::ConvertLineFormat( ScfPropertySet& rPropSet, @@ -2468,18 +2480,30 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const manual mode, if the legend is moved or resized). With manual plot areas, Excel ignores the value in maData.mnDockMode completely. */ cssc2::LegendPosition eApiPos = cssc2::LegendPosition_CUSTOM; - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_CUSTOM; if( !GetChartData().IsManualPlotArea() ) switch( maData.mnDockMode ) { - case EXC_CHLEGEND_LEFT: eApiPos = cssc2::LegendPosition_LINE_START; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_RIGHT: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_TOP: eApiPos = cssc2::LegendPosition_PAGE_START; eApiExpand = cssc2::LegendExpansion_WIDE; break; - case EXC_CHLEGEND_BOTTOM: eApiPos = cssc2::LegendPosition_PAGE_END; eApiExpand = cssc2::LegendExpansion_WIDE; break; + case EXC_CHLEGEND_LEFT: + eApiPos = cssc2::LegendPosition_LINE_START; + eApiExpand = cssc::ChartLegendExpansion_HIGH; + break; + case EXC_CHLEGEND_RIGHT: // top-right not supported - case EXC_CHLEGEND_CORNER: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; + case EXC_CHLEGEND_CORNER: + eApiPos = cssc2::LegendPosition_LINE_END; + eApiExpand = cssc::ChartLegendExpansion_HIGH; + break; + case EXC_CHLEGEND_TOP: + eApiPos = cssc2::LegendPosition_PAGE_START; + eApiExpand = cssc::ChartLegendExpansion_WIDE; + break; + case EXC_CHLEGEND_BOTTOM: + eApiPos = cssc2::LegendPosition_PAGE_END; + eApiExpand = cssc::ChartLegendExpansion_WIDE; + break; } - // no automatic position: try to find the correct position and size + // no automatic position/size: try to find the correct position and size if( eApiPos == cssc2::LegendPosition_CUSTOM ) { const XclChFramePos* pFramePos = mxFramePos.is() ? &mxFramePos->GetFramePosData() : 0; @@ -2489,38 +2513,35 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const ignored. */ if( pFramePos ) { - RelativePosition aRelPos; - aRelPos.Primary = CalcRelativeFromChartX( pFramePos->maRect.mnX ); - aRelPos.Secondary = CalcRelativeFromChartY( pFramePos->maRect.mnY ); - aRelPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + RelativePosition aRelPos( + CalcRelativeFromChartX( pFramePos->maRect.mnX ), + CalcRelativeFromChartY( pFramePos->maRect.mnY ), + ::com::sun::star::drawing::Alignment_TOP_LEFT ); aLegendProp.SetProperty( EXC_CHPROP_RELATIVEPOSITION, aRelPos ); } else { - // no manual position found, just go for the default + // no manual position/size found, just go for the default eApiPos = cssc2::LegendPosition_LINE_END; } - - /* Legend size. #i71697# It is not possible to set the legend size - directly in the Chart, do some magic here. */ - if( !pFramePos || (pFramePos->mnBRMode != EXC_CHFRAMEPOS_ABSSIZE_POINTS) || - (pFramePos->maRect.mnWidth == 0) || (pFramePos->maRect.mnHeight == 0) ) + /* Legend size. The member mnBRMode specifies whether size is + automatic or changes manually. Manual size is given in points, + not in chart units. */ + if( pFramePos && (pFramePos->mnBRMode == EXC_CHFRAMEPOS_ABSSIZE_POINTS) && + (pFramePos->maRect.mnWidth > 0) && (pFramePos->maRect.mnHeight > 0) ) { - // automatic size: determine entry direction from flags - eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, - cssc2::LegendExpansion_HIGH, cssc2::LegendExpansion_WIDE ); + eApiExpand = cssc::ChartLegendExpansion_CUSTOM; + sal_Int32 nWidthHmm = static_cast< sal_Int32 >( pFramePos->maRect.mnWidth / EXC_POINTS_PER_HMM ); + sal_Int32 nHeightHmm = static_cast< sal_Int32 >( pFramePos->maRect.mnHeight / EXC_POINTS_PER_HMM ); + RelativeSize aRelSize( CalcRelativeFromHmmX( nWidthHmm ), CalcRelativeFromHmmY( nHeightHmm ) ); + aLegendProp.SetProperty( EXC_CHPROP_RELATIVESIZE, aRelSize ); } else { - // legend size is given in points, not in chart units - double fRatio = static_cast< double >( pFramePos->maRect.mnWidth ) / pFramePos->maRect.mnHeight; - if( fRatio > 1.5 ) - eApiExpand = cssc2::LegendExpansion_WIDE; - else if( fRatio < 0.75 ) - eApiExpand = cssc2::LegendExpansion_HIGH; - else - eApiExpand = cssc2::LegendExpansion_BALANCED; + // automatic size: determine entry direction from flags + eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, + cssc::ChartLegendExpansion_HIGH, cssc::ChartLegendExpansion_WIDE ); } } aLegendProp.SetProperty( EXC_CHPROP_ANCHORPOSITION, eApiPos ); diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx index 5178d6d99968..206392ea6890 100644 --- a/sc/source/filter/inc/xechart.hxx +++ b/sc/source/filter/inc/xechart.hxx @@ -382,6 +382,8 @@ public: /** Converts frame formatting properties from the passed property set. */ void Convert( const ScfPropertySet& rPropSet ); + /** Sets the specified automatic flags. */ + void SetAutoFlags( bool bAutoPos, bool bAutoSize ); /** Returns true, if the frame object contains default formats. */ bool IsDefault() const; diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index 0fbde9db0905..097ce1801896 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -134,6 +134,11 @@ public: /** Converts the passed rectangle from Excel chart units into 1/100 mm. */ ::com::sun::star::awt::Rectangle CalcHmmFromChartRect( const XclChRectangle& rRect ) const; + /** Converts the passed horizontal coordinate from 1/100 mm into a relative position. */ + double CalcRelativeFromHmmX( sal_Int32 nPosX ) const; + /** Converts the passed vertical coordinate from 1/100 mm into a relative position. */ + double CalcRelativeFromHmmY( sal_Int32 nPosY ) const; + /** Converts the passed horizontal coordinate from Excel chart units into a relative position. */ double CalcRelativeFromChartX( sal_Int32 nPosX ) const; /** Converts the passed vertical coordinate from Excel chart units into a relative position. */ diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index 68186a238847..925b1d14e805 100755 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -126,6 +126,7 @@ class XclRoot; #define EXC_CHPROP_PERSPECTIVE CREATE_OUSTRING( "Perspective" ) #define EXC_CHPROP_POSITIVEERROR CREATE_OUSTRING( "PositiveError" ) #define EXC_CHPROP_RELATIVEPOSITION CREATE_OUSTRING( "RelativePosition" ) +#define EXC_CHPROP_RELATIVESIZE CREATE_OUSTRING( "RelativeSize" ) #define EXC_CHPROP_RIGHTANGLEDAXES CREATE_OUSTRING( "RightAngledAxes" ) #define EXC_CHPROP_ROLE CREATE_OUSTRING( "Role" ) #define EXC_CHPROP_ROTATIONHORIZONTAL CREATE_OUSTRING( "RotationHorizontal" ) diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx index 42160aae7529..ac0e42496b63 100644 --- a/sc/source/filter/inc/xlconst.hxx +++ b/sc/source/filter/inc/xlconst.hxx @@ -139,6 +139,8 @@ const sal_Int32 EXC_RK_INT100 = EXC_RK_100FLAG | EXC_RK_INTFLAG; const sal_Int32 EXC_POINTS_PER_INCH = 72; const sal_Int32 EXC_TWIPS_PER_INCH = EXC_POINTS_PER_INCH * 20; +const double EXC_POINTS_PER_HMM = static_cast< double >( EXC_POINTS_PER_INCH ) / 2540.0; + const sal_uInt8 EXC_ORIENT_NONE = 0; /// Text orientation: not rotated. const sal_uInt8 EXC_ORIENT_STACKED = 1; /// Text orientation: vertically stacked. const sal_uInt8 EXC_ORIENT_90CCW = 2; /// Text orientation: 90 deg counterclockwise. diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx index 1848c7bfefc0..6873116ee2d8 100644 --- a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx @@ -31,17 +31,11 @@ #include "unoguard.hxx" #include "fieldwnd.hxx" -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEROLE_HPP_ #include <com/sun/star/accessibility/AccessibleRole.hpp> -#endif -#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESTATETYPE_HPP_ #include <com/sun/star/accessibility/AccessibleStateType.hpp> -#endif #include <com/sun/star/accessibility/AccessibleEventId.hpp> -#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX #include <unotools/accessiblestatesethelper.hxx> -#endif #include <rtl/uuid.h> #include <tools/gen.hxx> #include <toolkit/helper/convert.hxx> @@ -58,7 +52,7 @@ public: ScAccessibleDataPilotButton( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, - ScDPFieldWindow* pDPFieldWindow, + ScPivotFieldWindow* pFieldWindow, sal_Int32 nIndex); virtual void Init(); @@ -151,20 +145,20 @@ protected: throw (::com::sun::star::uno::RuntimeException); private: - ScDPFieldWindow* mpDPFieldWindow; + ScPivotFieldWindow* mpFieldWindow; sal_Int32 mnIndex; }; //===== internal ======================================================== ScAccessibleDataPilotControl::ScAccessibleDataPilotControl( const uno::Reference<XAccessible>& rxParent, - ScDPFieldWindow* pDPFieldWindow) + ScPivotFieldWindow* pFieldWindow) : ScAccessibleContextBase(rxParent, AccessibleRole::GROUP_BOX), - mpDPFieldWindow(pDPFieldWindow) + mpFieldWindow(pFieldWindow) { - if (mpDPFieldWindow) - maChildren.resize(mpDPFieldWindow->GetFieldCount()); + if (mpFieldWindow) + maChildren.resize(mpFieldWindow->GetFieldCount()); } ScAccessibleDataPilotControl::~ScAccessibleDataPilotControl(void) @@ -185,7 +179,7 @@ void ScAccessibleDataPilotControl::Init() void SAL_CALL ScAccessibleDataPilotControl::disposing() { ScUnoGuard aGuard; - mpDPFieldWindow = NULL; + mpFieldWindow = NULL; ScAccessibleContextBase::disposing(); } @@ -193,12 +187,12 @@ void SAL_CALL ScAccessibleDataPilotControl::disposing() void ScAccessibleDataPilotControl::AddField(sal_Int32 nNewIndex) { sal_Bool bAdded(sal_False); - if (static_cast<sal_uInt32>(nNewIndex) == maChildren.size()) + if (static_cast<size_t>(nNewIndex) == maChildren.size()) { maChildren.push_back(AccessibleWeak()); bAdded = sal_True; } - else if (static_cast<sal_uInt32>(nNewIndex) < maChildren.size()) + else if (static_cast<size_t>(nNewIndex) < maChildren.size()) { ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nNewIndex; maChildren.insert(aItr, AccessibleWeak()); @@ -238,7 +232,7 @@ void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex) sal_Bool bRemoved(sal_False); uno::Reference< XAccessible > xTempAcc; ScAccessibleDataPilotButton* pField = NULL; - if (static_cast<sal_uInt32>(nOldIndex) < maChildren.size()) + if (static_cast<size_t>(nOldIndex) < maChildren.size()) { xTempAcc = getAccessibleChild(nOldIndex); pField = maChildren[nOldIndex].pAcc; @@ -279,8 +273,8 @@ void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex) void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex) { - DBG_ASSERT(static_cast<sal_uInt32>(nOldIndex) < maChildren.size() && - static_cast<sal_uInt32>(nNewIndex) < maChildren.size(), "did not recognize a child count change"); + DBG_ASSERT(static_cast<size_t>(nOldIndex) < maChildren.size() && + static_cast<size_t>(nNewIndex) < maChildren.size(), "did not recognize a child count change"); uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nOldIndex].pAcc) @@ -293,7 +287,7 @@ void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex) { - DBG_ASSERT(static_cast<sal_uInt32>(nIndex) < maChildren.size(), "did not recognize a child count change"); + DBG_ASSERT(static_cast<size_t>(nIndex) < maChildren.size(), "did not recognize a child count change"); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nIndex].pAcc) @@ -302,11 +296,11 @@ void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex) void ScAccessibleDataPilotControl::GotFocus() { - if (mpDPFieldWindow) + if (mpFieldWindow) { - DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change"); + DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); - sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField()); + sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex()); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nIndex].pAcc) maChildren[nIndex].pAcc->SetFocused(); @@ -315,11 +309,11 @@ void ScAccessibleDataPilotControl::GotFocus() void ScAccessibleDataPilotControl::LostFocus() { - if (mpDPFieldWindow) + if (mpFieldWindow) { - DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change"); + DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); - sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField()); + sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex()); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nIndex].pAcc) maChildren[nIndex].pAcc->ResetFocused(); @@ -337,13 +331,13 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotControl::getAccessib { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) + if (mpFieldWindow) { Point aAbsPoint(VCLPoint(rPoint)); Point aControlEdge(GetBoundingBoxOnScreen().TopLeft()); Point aRelPoint(aAbsPoint - aControlEdge); - size_t nChildIndex(0); - if (mpDPFieldWindow->GetFieldIndex(aRelPoint, nChildIndex)) + size_t nChildIndex = mpFieldWindow->GetFieldIndex( aRelPoint ); + if( nChildIndex != PIVOTFIELD_INVALID ) xAcc = getAccessibleChild(static_cast< long >( nChildIndex )); } } @@ -361,8 +355,8 @@ void SAL_CALL ScAccessibleDataPilotControl::grabFocus( ) { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) - mpDPFieldWindow->GrabFocus(); + if (mpFieldWindow) + mpFieldWindow->GrabFocus(); } sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getForeground( ) @@ -371,9 +365,9 @@ sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getForeground( ) ScUnoGuard aGuard; IsObjectValid(); sal_Int32 nColor(0); - if (mpDPFieldWindow) + if (mpFieldWindow) { - nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowTextColor().GetColor(); + nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetWindowTextColor().GetColor(); } return nColor; } @@ -384,16 +378,10 @@ sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getBackground( ) ScUnoGuard aGuard; IsObjectValid(); sal_Int32 nColor(0); - if (mpDPFieldWindow) + if (mpFieldWindow) { - if (mpDPFieldWindow->GetType() == TYPE_SELECT) - { - nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor(); - } - else - { - nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowColor().GetColor(); - } + const StyleSettings& rStyleSett = mpFieldWindow->GetSettings().GetStyleSettings(); + nColor = (mpFieldWindow->GetType() == PIVOTFIELDTYPE_SELECT) ? rStyleSett.GetFaceColor().GetColor() : rStyleSett.GetWindowColor().GetColor(); } return nColor; } @@ -405,8 +393,8 @@ sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getAccessibleChildCount(void) { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) - return mpDPFieldWindow->GetFieldCount(); + if (mpFieldWindow) + return mpFieldWindow->GetFieldCount(); else return 0; } @@ -417,17 +405,17 @@ uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibl ScUnoGuard aGuard; IsObjectValid(); uno::Reference<XAccessible> xAcc; - if (mpDPFieldWindow) + if (mpFieldWindow) { - if (nIndex < 0 || static_cast< size_t >( nIndex ) >= mpDPFieldWindow->GetFieldCount()) + if (nIndex < 0 || static_cast< size_t >( nIndex ) >= mpFieldWindow->GetFieldCount()) throw lang::IndexOutOfBoundsException(); - DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change"); + DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (!xTempAcc.is()) { - maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpDPFieldWindow, nIndex); + maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpFieldWindow, nIndex); xTempAcc = maChildren[nIndex].pAcc; maChildren[nIndex].xWeakAcc = xTempAcc; } @@ -491,8 +479,8 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementation { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) - return mpDPFieldWindow->GetDescription(); + if (mpFieldWindow) + return mpFieldWindow->GetDescription(); return rtl::OUString(); } @@ -502,8 +490,8 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementation { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) - return mpDPFieldWindow->GetName(); + if (mpFieldWindow) + return mpFieldWindow->GetName(); return rtl::OUString(); } @@ -511,8 +499,8 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementation Rectangle ScAccessibleDataPilotControl::GetBoundingBoxOnScreen(void) const throw (uno::RuntimeException) { - if (mpDPFieldWindow) - return mpDPFieldWindow->GetWindowExtentsRelative(NULL); + if (mpFieldWindow) + return mpFieldWindow->GetWindowExtentsRelative(NULL); else return Rectangle(); } @@ -520,8 +508,8 @@ Rectangle ScAccessibleDataPilotControl::GetBoundingBoxOnScreen(void) const Rectangle ScAccessibleDataPilotControl::GetBoundingBox(void) const throw (uno::RuntimeException) { - if (mpDPFieldWindow) - return mpDPFieldWindow->GetWindowExtentsRelative(mpDPFieldWindow->GetAccessibleParentWindow()); + if (mpFieldWindow) + return mpFieldWindow->GetWindowExtentsRelative(mpFieldWindow->GetAccessibleParentWindow()); else return Rectangle(); } @@ -532,10 +520,10 @@ Rectangle ScAccessibleDataPilotControl::GetBoundingBox(void) const ScAccessibleDataPilotButton::ScAccessibleDataPilotButton( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, - ScDPFieldWindow* pDPFieldWindow, + ScPivotFieldWindow* pFieldWindow, sal_Int32 nIndex) : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON), - mpDPFieldWindow(pDPFieldWindow), + mpFieldWindow(pFieldWindow), mnIndex(nIndex) { } @@ -558,7 +546,7 @@ void ScAccessibleDataPilotButton::Init() void SAL_CALL ScAccessibleDataPilotButton::disposing() { ScUnoGuard aGuard; - mpDPFieldWindow = NULL; + mpFieldWindow = NULL; ScAccessibleContextBase::disposing(); } @@ -593,9 +581,9 @@ void SAL_CALL ScAccessibleDataPilotButton::grabFocus( ) { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) + if (mpFieldWindow) { - mpDPFieldWindow->GrabFocusWithSel(getAccessibleIndexInParent()); + mpFieldWindow->GrabFocusAndSelect(getAccessibleIndexInParent()); } } @@ -605,9 +593,9 @@ throw (uno::RuntimeException) ScUnoGuard aGuard; IsObjectValid(); sal_Int32 nColor(0); - if (mpDPFieldWindow) + if (mpFieldWindow) { - nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor(); + nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor(); } return nColor; } @@ -618,9 +606,9 @@ throw (uno::RuntimeException) ScUnoGuard aGuard; IsObjectValid(); sal_Int32 nColor(0); - if (mpDPFieldWindow) + if (mpFieldWindow) { - nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor(); + nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor(); } return nColor; } @@ -663,7 +651,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAcc pStateSet->AddState(AccessibleStateType::ENABLED); pStateSet->AddState(AccessibleStateType::OPAQUE); pStateSet->AddState(AccessibleStateType::FOCUSABLE); - if (mpDPFieldWindow && (sal::static_int_cast<sal_Int32>(mpDPFieldWindow->GetSelectedField()) == mnIndex)) + if (mpFieldWindow && (sal::static_int_cast<sal_Int32>(mpFieldWindow->GetSelectedIndex()) == mnIndex)) pStateSet->AddState(AccessibleStateType::FOCUSED); if (isShowing()) pStateSet->AddState(AccessibleStateType::SHOWING); @@ -709,8 +697,8 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationI { ScUnoGuard aGuard; IsObjectValid(); - if (mpDPFieldWindow) - return mpDPFieldWindow->GetFieldText(getAccessibleIndexInParent()); + if (mpFieldWindow) + return mpFieldWindow->GetFieldText(getAccessibleIndexInParent()); return rtl::OUString(); } @@ -720,9 +708,9 @@ Rectangle ScAccessibleDataPilotButton::GetBoundingBoxOnScreen(void) const { Rectangle aRect(GetBoundingBox()); - if (mpDPFieldWindow) + if (mpFieldWindow) { - Point aParentPos(mpDPFieldWindow->GetWindowExtentsRelative(NULL).TopLeft()); + Point aParentPos(mpFieldWindow->GetWindowExtentsRelative(NULL).TopLeft()); aRect.Move(aParentPos.getX(), aParentPos.getY()); } @@ -732,8 +720,8 @@ Rectangle ScAccessibleDataPilotButton::GetBoundingBoxOnScreen(void) const Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const throw (::com::sun::star::uno::RuntimeException) { - if (mpDPFieldWindow) - return Rectangle (mpDPFieldWindow->GetFieldPosition(const_cast<ScAccessibleDataPilotButton*> (this)->getAccessibleIndexInParent()), mpDPFieldWindow->GetFieldSize()); + if (mpFieldWindow) + return Rectangle (mpFieldWindow->GetFieldPosition(const_cast<ScAccessibleDataPilotButton*> (this)->getAccessibleIndexInParent()), mpFieldWindow->GetFieldSize()); else return Rectangle(); } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index ed4971fa00ee..fac3b1bb1a0f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -3443,8 +3443,13 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, else aCursorPos.Format( aPosStr, SCA_VALID | nFlags, pDoc, aAddrDetails ); } - + //IAccessibility2 Implementation 2009----- + // Disable the accessible VALUE_CHANGE event + sal_Bool bIsSuppressed = pInputWin->IsAccessibilityEventsSuppressed(sal_False); + pInputWin->SetAccessibilityEventsSuppressed(sal_True); pInputWin->SetPosString(aPosStr); + pInputWin->SetAccessibilityEventsSuppressed(bIsSuppressed); + //-----IAccessibility2 Implementation 2009 pInputWin->SetSumAssignMode(); } diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index a02f6fb0f91a..2da1ed83bf08 100755 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -223,6 +223,7 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) : pViewSh->UpdateInputHandler( sal_True ); // unbedingtes Update pImgMgr->RegisterToolBox( this ); + SetAccessibleName(ScResId(STR_ACC_TOOLBAR_FORMULA)); } __EXPORT ScInputWindow::~ScInputWindow() diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx index 8a7c4b05454d..c3bab9e32296 100644 --- a/sc/source/ui/attrdlg/condfrmt.cxx +++ b/sc/source/ui/attrdlg/condfrmt.cxx @@ -71,7 +71,6 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aFtCond1Template ( this, ScResId( FT_COND1_TEMPLATE ) ), aLbCond1Template ( this, ScResId( LB_COND1_TEMPLATE ) ), aBtnNew1 ( this, ScResId( BTN_COND1_NEW ) ), - aFlSep1 ( this, ScResId( FL_SEP1 ) ), aCbxCond2 ( this, ScResId( CBX_COND2 ) ), aLbCond21 ( this, ScResId( LB_COND2_1 ) ), @@ -84,7 +83,6 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aFtCond2Template ( this, ScResId( FT_COND2_TEMPLATE ) ), aLbCond2Template ( this, ScResId( LB_COND2_TEMPLATE ) ), aBtnNew2 ( this, ScResId( BTN_COND2_NEW ) ), - aFlSep2 ( this, ScResId( FL_SEP2 ) ), aCbxCond3 ( this, ScResId( CBX_COND3 ) ), aLbCond31 ( this, ScResId( LB_COND3_1 ) ), @@ -101,6 +99,8 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), aBtnHelp ( this, ScResId( BTN_HELP ) ), + aFlSep2 ( this, ScResId( FL_SEP2 ) ), + aFlSep1 ( this, ScResId( FL_SEP1 ) ), pEdActive ( NULL ), bDlgLostFocus ( sal_False ), @@ -322,6 +322,32 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( //@BugID 54702 Enablen/Disablen nur noch in Basisklasse //SFX_APPWINDOW->Enable(); // Ref-Feld hat Focus // SFX_APPWINDOW->Disable(); + + aLbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aLbCond12.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aEdtCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aRbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + + aLbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aLbCond22.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aEdtCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aRbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + + aLbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aLbCond32.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aEdtCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aRbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aLbCond11.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond12.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond11.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); + + aLbCond21.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond22.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond21.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); + + aLbCond31.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond32.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond31.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); } diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 45f1ff7d549a..90e4b0f20221 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -1165,9 +1165,9 @@ AbstractScPivotFilterDlg * ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg //add for ScDPFunctionDlg begin AbstractScDPFunctionDlg * ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg ( Window* pParent, int nId, - const ScDPLabelDataVec& rLabelVec, + const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData ) + const ScPivotFuncData& rFuncData ) { ScDPFunctionDlg * pDlg=NULL; switch ( nId ) @@ -1190,7 +1190,7 @@ AbstractScDPSubtotalDlg * ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg ( int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData, + const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) { diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 86aebfc03287..772661a1a10b 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -490,14 +490,14 @@ public: const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ); virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, - const ScDPLabelDataVec& rLabelVec, + const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData ); + const ScPivotFuncData& rFuncData ); virtual AbstractScDPSubtotalDlg * CreateScDPSubtotalDlg( Window* pParent, int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScDPFuncData& rFuncData, + const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ); diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 4e6c61f2e4d0..a518860b1690 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -312,6 +312,10 @@ void ScAsciiOptions::ReadFromString( const String& rString ) aToken = rString.GetToken(7, ','); bDetectSpecialNumber = aToken.EqualsAscii("true") ? true : false; } + else + bDetectSpecialNumber = sal_True; // default of versions that didn't add the parameter + + // 9th token is used for "Save as shown" in export options } @@ -399,6 +403,8 @@ String ScAsciiOptions::WriteToString() const // Detect special nubmers. aOutStr += String::CreateFromAscii(bDetectSpecialNumber ? "true" : "false"); + // 9th token is used for "Save as shown" in export options + return aOutStr; } diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index a4a7c6826daa..03fc34eefe2c 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -185,6 +185,7 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, aBtnDoSize, aBtnKeepFmt, aBtnStripData, theCurArea ); Init(); FreeResource(); + aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); } diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index 8016c20eff34..02bf712e59fb 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -28,749 +28,880 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -#include <vcl/virdev.hxx> +#include "fieldwnd.hxx" + +#include <tools/debug.hxx> #include <vcl/decoview.hxx> -#include <vcl/svapp.hxx> -#include <vcl/mnemonic.hxx> #include <vcl/help.hxx> -#include <tools/debug.hxx> +#include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> -#include "fieldwnd.hxx" #include "pvlaydlg.hxx" -#include "pvglob.hxx" #include "AccessibleDataPilotControl.hxx" #include "scresid.hxx" #include "sc.hrc" -const size_t INVALID_INDEX = static_cast< size_t >( -1 ); - -//=================================================================== - -ScDPFieldWindow::ScDPFieldWindow( - ScDPLayoutDlg* pDialog, - const ResId& rResId, - ScDPFieldType eFieldType, - FixedText* pFtFieldCaption ) : - Control( pDialog, rResId ), - pDlg( pDialog ), - pFtCaption( pFtFieldCaption ), - eType( eFieldType ), - nFieldSelected( 0 ), - pAccessible( NULL ) -{ - Init(); - if (eType != TYPE_SELECT && pFtCaption) - aName = MnemonicGenerator::EraseAllMnemonicChars( pFtCaption->GetText() ); -} - -ScDPFieldWindow::ScDPFieldWindow( - ScDPLayoutDlg* pDialog, - const ResId& rResId, - ScDPFieldType eFieldType, - const String& rName ) : - Control( pDialog, rResId ), - aName(rName), - pDlg( pDialog ), - pFtCaption( NULL ), - eType( eFieldType ), - nFieldSelected( 0 ), - pAccessible( NULL ) -{ - Init(); -} +// ============================================================================ -void ScDPFieldWindow::Init() -{ - aWndRect = Rectangle( GetPosPixel(), GetSizePixel() ); - nFieldSize = (eType == TYPE_SELECT) ? PAGE_SIZE : ((eType == TYPE_PAGE) ? MAX_PAGEFIELDS : MAX_FIELDS); +using namespace ::com::sun::star; +using ::rtl::OUString; - if( pFtCaption ) - { - Size aWinSize( aWndRect.GetSize() ); - Size aTextSize( GetTextWidth( pFtCaption->GetText() ), GetTextHeight() ); - aTextPos.X() = (aWinSize.Width() - aTextSize.Width()) / 2; - aTextPos.Y() = (aWinSize.Height() - aTextSize.Height()) / 2; - } +// ============================================================================ - GetStyleSettings(); -} +namespace { -__EXPORT ScDPFieldWindow::~ScDPFieldWindow() -{ - if (pAccessible) - { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->dispose(); - } -} +/** Line width for insertion cursor in pixels. */ +const long CURSOR_WIDTH = 3; -//------------------------------------------------------------------- +/** Number of tracking events before auto scrolling starts. */ +const size_t INITIAL_TRACKING_DELAY = 20; -void ScDPFieldWindow::GetStyleSettings() -{ - const StyleSettings& rStyleSet = GetSettings().GetStyleSettings(); - aFaceColor = rStyleSet.GetFaceColor(); - aWinColor = rStyleSet.GetWindowColor(); - aTextColor = rStyleSet.GetButtonTextColor(); - aWinTextColor = rStyleSet.GetWindowTextColor(); -} +} // namespace -//------------------------------------------------------------------- +// ============================================================================ -Point ScDPFieldWindow::GetFieldPosition( size_t nIndex ) const +ScPivotFieldWindow::ScPivotWindowField::ScPivotWindowField( const ScDPLabelData& rLabelData ) : + maFuncData( rLabelData.mnCol, rLabelData.mnFuncMask ), + maFieldName( rLabelData.getDisplayName() ) { - Point aPos; - switch( eType ) - { - case TYPE_PAGE: - aPos.X() = OWIDTH * (nIndex % (MAX_PAGEFIELDS / 2)); - aPos.Y() = OHEIGHT * (nIndex / (MAX_PAGEFIELDS / 2)); - break; - case TYPE_COL: - aPos.X() = OWIDTH * (nIndex % (MAX_FIELDS / 2)); - aPos.Y() = OHEIGHT * (nIndex / (MAX_FIELDS / 2)); - break; - case TYPE_ROW: - case TYPE_DATA: - aPos.X() = 0; - aPos.Y() = OHEIGHT * nIndex; - break; - case TYPE_SELECT: - aPos.X() = (OWIDTH + SSPACE) * (nIndex / LINE_SIZE); - aPos.Y() = (OHEIGHT + SSPACE) * (nIndex % LINE_SIZE); - break; - } - return aPos; } -Size ScDPFieldWindow::GetFieldSize() const +ScPivotFieldWindow::ScPivotWindowField::ScPivotWindowField( ScPivotLayoutDlg& rDialog, const ScPivotField& rField, bool bDataWindow ) : + maFuncData( rField.nCol, rField.nFuncMask, rField.maFieldRef ) { - return Size( (eType == TYPE_DATA) ? GetSizePixel().Width() : OWIDTH, OHEIGHT ); + InitFieldName( rDialog, bDataWindow ); } -Point ScDPFieldWindow::GetLastPosition() const +ScPivotFieldWindow::ScPivotWindowField::ScPivotWindowField( ScPivotLayoutDlg& rDialog, const ScPivotFuncData& rFuncData, bool bDataWindow ) : + maFuncData( rFuncData ) { - return OutputToScreenPixel( GetFieldPosition( nFieldSize - 1 ) ); + InitFieldName( rDialog, bDataWindow ); } -bool ScDPFieldWindow::GetFieldIndex( const Point& rPos, size_t& rnIndex ) const +void ScPivotFieldWindow::ScPivotWindowField::InitFieldName( ScPivotLayoutDlg& rDialog, bool bDataWindow ) { - rnIndex = INVALID_INDEX; - if( (rPos.X() >= 0) && (rPos.Y() >= 0) ) + if( maFuncData.mnCol != PIVOT_DATA_FIELD ) { - switch( eType ) + ScDPLabelData* pLabelData = rDialog.GetLabelData( maFuncData.mnCol ); + DBG_ASSERT( pLabelData, "ScPivotWindowField::InitFieldName - no label data found" ); + if( pLabelData ) { - case TYPE_ROW: - case TYPE_DATA: - rnIndex = rPos.Y() / OHEIGHT; - break; - case TYPE_PAGE: - { - size_t nRow = rPos.Y() / OHEIGHT; - size_t nCol = rPos.X() / OWIDTH; - rnIndex = nRow * MAX_PAGEFIELDS / 2 + nCol; - } - break; - case TYPE_COL: - { - size_t nRow = rPos.Y() / OHEIGHT; - size_t nCol = rPos.X() / OWIDTH; - rnIndex = nRow * MAX_FIELDS / 2 + nCol; - } - break; - case TYPE_SELECT: + if( bDataWindow ) { - size_t nRow = rPos.Y() / (OHEIGHT + SSPACE); - size_t nCol = rPos.X() / (OWIDTH + SSPACE); - // is not between controls? - if( (rPos.Y() % (OHEIGHT + SSPACE) < OHEIGHT) && (rPos.X() % (OWIDTH + SSPACE) < OWIDTH) ) - rnIndex = nCol * LINE_SIZE + nRow; + // write original nFuncMask to label data + pLabelData->mnFuncMask = maFuncData.mnFuncMask; + // GetFuncString() modifies nFuncMask (e.g. auto to sum or count) + maFieldName = rDialog.GetFuncString( maFuncData.mnFuncMask, pLabelData->mbIsValue ); } - break; + maFieldName += pLabelData->getDisplayName(); } } - return IsValidIndex( rnIndex ); } -//------------------------------------------------------------------- - -void ScDPFieldWindow::DrawBackground( OutputDevice& rDev ) -{ - Point aPos0; - Size aSize( GetSizePixel() ); +// ============================================================================ - if ( eType == TYPE_SELECT ) - { - rDev.SetLineColor(); - rDev.SetFillColor( aFaceColor ); - rDev.DrawRect( Rectangle( aPos0, aSize ) ); +ScPivotFieldWindow::ScPivotFieldWindow( ScPivotLayoutDlg* pDialog, const ResId& rResId, + ScrollBar& rScrollBar, FixedText* pFtCaption, const OUString& rName, + ScPivotFieldType eFieldType, const sal_Char* pcHelpId, PointerStyle eDropPointer, + size_t nColCount, size_t nRowCount, long nFieldWidthFactor, long nSpaceSize ) : + Control( pDialog, rResId ), + mpDialog( pDialog ), + mpAccessible( 0 ), + mrScrollBar( rScrollBar ), + mpFtCaption( pFtCaption ), + maName( rName ), + meFieldType( eFieldType ), + meDropPointer( eDropPointer ), + mnColCount( nColCount ), + mnRowCount( nRowCount ), + mnFirstVisIndex( 0 ), + mnSelectIndex( 0 ), + mnInsCursorIndex( PIVOTFIELD_INVALID ), + mnOldFirstVisIndex( 0 ), + mnAutoScrollDelay( 0 ), + mbVertical( eFieldType == PIVOTFIELDTYPE_SELECT ), + mbIsTrackingSource( false ) +{ + SetHelpId( pcHelpId ); + + mnLineSize = mbVertical ? mnRowCount : mnColCount; + mnPageSize = mnColCount * mnRowCount; + + // a single field is 36x12 appfont units + maFieldSize = LogicToPixel( Size( 36, 12 ), MapMode( MAP_APPFONT ) ); + maFieldSize.Width() *= nFieldWidthFactor; + maSpaceSize = LogicToPixel( Size( nSpaceSize, nSpaceSize ), MapMode( MAP_APPFONT ) ); + + // set window size + long nWinWidth = static_cast< long >( mnColCount * maFieldSize.Width() + (mnColCount - 1) * maSpaceSize.Width() ); + long nWinHeight = static_cast< long >( mnRowCount * maFieldSize.Height() + (mnRowCount - 1) * maSpaceSize.Height() ); + SetSizePixel( Size( nWinWidth, nWinHeight ) ); + + // scroll bar + Point aScrollBarPos = GetPosPixel(); + Size aScrollBarSize( nWinWidth, nWinHeight ); + if( mbVertical ) + { + aScrollBarPos.Y() += nWinHeight + maSpaceSize.Height(); + aScrollBarSize.Height() = GetSettings().GetStyleSettings().GetScrollBarSize(); } else { - rDev.SetLineColor( aWinTextColor ); - rDev.SetFillColor( aWinColor ); - rDev.DrawRect( Rectangle( aPos0, aSize ) ); - - rDev.SetTextColor( aWinTextColor ); - - /* Draw the caption text. This needs some special handling, because we - support hard line breaks here. This part will draw each line of the - text for itself. */ - - xub_StrLen nTokenCnt = GetText().GetTokenCount( '\n' ); - long nY = (aSize.Height() - nTokenCnt * rDev.GetTextHeight()) / 2; - for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken ) - { - String aLine( GetText().GetToken( 0, '\n', nStringIx ) ); - Point aLinePos( (aSize.Width() - rDev.GetCtrlTextWidth( aLine )) / 2, nY ); - rDev.DrawCtrlText( aLinePos, aLine ); - nY += rDev.GetTextHeight(); - } + aScrollBarPos.X() += nWinWidth + maSpaceSize.Width(); + aScrollBarSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize(); } + mrScrollBar.SetPosSizePixel( aScrollBarPos, aScrollBarSize ); + mrScrollBar.SetLineSize( 1 ); + mrScrollBar.SetPageSize( static_cast< long >( mbVertical ? mnColCount : mnRowCount ) ); + mrScrollBar.SetVisibleSize( static_cast< long >( mbVertical ? mnColCount : mnRowCount ) ); + mrScrollBar.SetScrollHdl( LINK( this, ScPivotFieldWindow, ScrollHdl ) ); + mrScrollBar.SetEndScrollHdl( LINK( this, ScPivotFieldWindow, ScrollHdl ) ); } -void ScDPFieldWindow::DrawField( - OutputDevice& rDev, const Rectangle& rRect, FieldString& rText, bool bFocus ) +ScPivotFieldWindow::~ScPivotFieldWindow() { - VirtualDevice aVirDev( rDev ); - // #i97623# VirtualDevice is always LTR while other windows derive direction from parent - aVirDev.EnableRTL( IsRTLEnabled() ); + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->dispose(); +} - String aText = rText.first; - Size aDevSize( rRect.GetSize() ); - long nWidth = aDevSize.Width(); - long nHeight = aDevSize.Height(); - long nLabelWidth = rDev.GetTextWidth( aText ); - long nLabelHeight = rDev.GetTextHeight(); - - // #i31600# if text is too long, cut and add ellipsis - rText.second = nLabelWidth + 6 <= nWidth; - if( !rText.second ) - { - xub_StrLen nMinLen = 0; - xub_StrLen nMaxLen = aText.Len(); - bool bFits = false; - do - { - xub_StrLen nCurrLen = (nMinLen + nMaxLen) / 2; - aText = String( rText.first, 0, nCurrLen ).AppendAscii( "..." ); - nLabelWidth = rDev.GetTextWidth( aText ); - bFits = nLabelWidth + 6 <= nWidth; - (bFits ? nMinLen : nMaxLen) = nCurrLen; - } - while( !bFits || (nMinLen + 1 < nMaxLen) ); +void ScPivotFieldWindow::ReadDataLabels( const ScDPLabelDataVector& rLabels ) +{ + maFields.clear(); + maFields.reserve( rLabels.size() ); + for( ScDPLabelDataVector::const_iterator aIt = rLabels.begin(), aEnd = rLabels.end(); aIt != aEnd; ++aIt ) + { + ScPivotWindowField aField( *aIt ); + if( aField.maFieldName.getLength() > 0 ) + maFields.push_back( aField ); } - Point aLabelPos( (nWidth - nLabelWidth) / 2, ::std::max< long >( (nHeight - nLabelHeight) / 2, 3 ) ); - - aVirDev.SetOutputSizePixel( aDevSize ); - aVirDev.SetFont( rDev.GetFont() ); - DecorationView aDecoView( &aVirDev ); - aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 ); - aVirDev.SetTextColor( aTextColor ); - aVirDev.DrawText( aLabelPos, aText ); - rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) ); + Invalidate(); } -void ScDPFieldWindow::Redraw() +void ScPivotFieldWindow::ReadPivotFields( const ScPivotFieldVector& rPivotFields ) { - VirtualDevice aVirDev; - // #i97623# VirtualDevice is always LTR while other windows derive direction from parent - aVirDev.EnableRTL( IsRTLEnabled() ); - aVirDev.SetMapMode( MAP_PIXEL ); - - Point aPos0; - Size aSize( GetSizePixel() ); - Font aFont( GetFont() ); // Font vom Window - aFont.SetTransparent( sal_True ); - aVirDev.SetFont( aFont ); - aVirDev.SetOutputSizePixel( aSize ); - - DrawBackground( aVirDev ); - - if( !aFieldArr.empty() && (nFieldSelected >= aFieldArr.size()) ) - nFieldSelected = aFieldArr.size() - 1; - Rectangle aFieldRect( aPos0, GetFieldSize() ); - for( size_t nIx = 0; nIx < aFieldArr.size(); ++nIx ) + maFields.clear(); + maFields.reserve( rPivotFields.size() ); + for( ScPivotFieldVector::const_iterator aIt = rPivotFields.begin(), aEnd = rPivotFields.end(); aIt != aEnd; ++aIt ) { - aFieldRect.SetPos( GetFieldPosition( nIx ) ); - bool bFocus = HasFocus() && (nIx == nFieldSelected); - DrawField( aVirDev, aFieldRect, aFieldArr[ nIx ], bFocus ); + ScPivotWindowField aField( *mpDialog, *aIt, meFieldType == PIVOTFIELDTYPE_DATA ); + if( aField.maFieldName.getLength() > 0 ) + maFields.push_back( aField ); } - DrawBitmap( aPos0, aVirDev.GetBitmap( aPos0, aSize ) ); + Invalidate(); +} - if( HasFocus() && (nFieldSelected < aFieldArr.size()) ) +void ScPivotFieldWindow::WriteFieldNames( ScDPNameVec& rFieldNames ) const +{ + rFieldNames.clear(); + rFieldNames.reserve( maFields.size() ); + // do not use the names stored in maFields, but generate plain display names from label data + for( ScPivotWindowFieldVector::const_iterator aIt = maFields.begin(), aEnd = maFields.end(); aIt != aEnd; ++aIt ) { - long nFieldWidth = aFieldRect.GetWidth(); - long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ].first ) + 4, nFieldWidth - 6 ); - Rectangle aSelection( - GetFieldPosition( nFieldSelected ) + Point( (nFieldWidth - nSelectionWidth) / 2, 3 ), - Size( nSelectionWidth, aFieldRect.GetHeight() - 6 ) ); - InvertTracking( aSelection, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); + if( ScDPLabelData* pLabelData = mpDialog->GetLabelData( aIt->maFuncData.mnCol ) ) + { + OUString aDisplayName = pLabelData->getDisplayName(); + if( aDisplayName.getLength() > 0 ) + rFieldNames.push_back( aDisplayName ); + } } - - UpdateStyle(); } -void ScDPFieldWindow::UpdateStyle() +void ScPivotFieldWindow::WritePivotFields( ScPivotFieldVector& rPivotFields ) const { - WinBits nMask = ~(WB_TABSTOP | WB_NOTABSTOP); - SetStyle( (GetStyle() & nMask) | (IsEmpty() ? WB_NOTABSTOP : WB_TABSTOP) ); + rPivotFields.resize( maFields.size() ); + ScPivotFieldVector::iterator aOutIt = rPivotFields.begin(); + for( ScPivotWindowFieldVector::const_iterator aIt = maFields.begin(), aEnd = maFields.end(); aIt != aEnd; ++aIt, ++aOutIt ) + { + aOutIt->nCol = aIt->maFuncData.mnCol; + aOutIt->nFuncMask = aIt->maFuncData.mnFuncMask; + aOutIt->maFieldRef = aIt->maFuncData.maFieldRef; + } } -//------------------------------------------------------------------- - -bool ScDPFieldWindow::IsValidIndex( size_t nIndex ) const +OUString ScPivotFieldWindow::GetDescription() const { - return nIndex < nFieldSize; + switch( meFieldType ) + { + case PIVOTFIELDTYPE_COL: return String( ScResId( STR_ACC_DATAPILOT_COL_DESCR ) ); + case PIVOTFIELDTYPE_ROW: return String( ScResId( STR_ACC_DATAPILOT_ROW_DESCR ) ); + case PIVOTFIELDTYPE_DATA: return String( ScResId( STR_ACC_DATAPILOT_DATA_DESCR ) ); + case PIVOTFIELDTYPE_SELECT: return String( ScResId( STR_ACC_DATAPILOT_SEL_DESCR ) ); + default:; + } + return OUString(); } -bool ScDPFieldWindow::IsExistingIndex( size_t nIndex ) const +OUString ScPivotFieldWindow::GetFieldText( size_t nFieldIndex ) const { - return nIndex < aFieldArr.size(); + return (nFieldIndex < maFields.size()) ? maFields[ nFieldIndex ].maFieldName : OUString(); } -bool ScDPFieldWindow::IsShortenedText( size_t nIndex ) const +ScPivotFuncDataEntry ScPivotFieldWindow::FindFuncDataByCol( SCCOL nCol ) const { - return (nIndex < aFieldArr.size()) && !aFieldArr[ nIndex ].second; + for( ScPivotWindowFieldVector::const_iterator aIt = maFields.begin(), aEnd = maFields.end(); aIt != aEnd; ++aIt ) + if( aIt->maFuncData.mnCol == nCol ) + return ScPivotFuncDataEntry( &aIt->maFuncData, aIt - maFields.begin() ); + return ScPivotFuncDataEntry( 0, PIVOTFIELD_INVALID ); } -size_t ScDPFieldWindow::CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const +Point ScPivotFieldWindow::GetFieldPosition( size_t nFieldIndex ) const { - size_t nNewField = nFieldSelected; - switch( eType ) - { - case TYPE_PAGE: - nNewField += static_cast<SCsCOLROW>(nDX) + nDY * MAX_PAGEFIELDS / 2; - break; - case TYPE_COL: - nNewField += static_cast<SCsCOLROW>(nDX) + nDY * MAX_FIELDS / 2; - break; - case TYPE_ROW: - case TYPE_DATA: - nNewField += nDY; - break; - case TYPE_SELECT: - nNewField += static_cast<SCsCOLROW>(nDX) * LINE_SIZE + nDY; - break; - } - - return IsExistingIndex( nNewField ) ? nNewField : nFieldSelected; + long nRelIndex = static_cast< long >( nFieldIndex ) - mnFirstVisIndex; + long nCol = static_cast< long >( mbVertical ? (nRelIndex / mnRowCount) : (nRelIndex % mnColCount) ); + long nRow = static_cast< long >( mbVertical ? (nRelIndex % mnRowCount) : (nRelIndex / mnColCount) ); + return Point( nCol * (maFieldSize.Width() + maSpaceSize.Width()), nRow * (maFieldSize.Height() + maSpaceSize.Height()) ); } -void ScDPFieldWindow::SetSelection( size_t nIndex ) +size_t ScPivotFieldWindow::GetFieldIndex( const Point& rWindowPos ) const { - if( !aFieldArr.empty() ) + if( (rWindowPos.X() >= 0) && (rWindowPos.Y() >= 0) ) { - if( nFieldSelected >= aFieldArr.size() ) - nFieldSelected = aFieldArr.size() - 1; - if( nFieldSelected != nIndex ) + long nGridWidth = maFieldSize.Width() + maSpaceSize.Width(); + long nGridHeight = maFieldSize.Height() + maSpaceSize.Height(); + size_t nCol = static_cast< size_t >( rWindowPos.X() / nGridWidth ); + size_t nRow = static_cast< size_t >( rWindowPos.Y() / nGridHeight ); + if( (nCol < mnColCount) && (nRow < mnRowCount) ) { - sal_Int32 nOldSelected(nFieldSelected); - nFieldSelected = nIndex; - Redraw(); - - if (pAccessible && HasFocus()) + long nColOffset = rWindowPos.X() % nGridWidth; + long nRowOffset = rWindowPos.Y() % nGridHeight; + // check that passed position is not in the space between the fields + if( (nColOffset < maFieldSize.Width()) && (nRowOffset < maFieldSize.Height()) ) { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->FieldFocusChange(nOldSelected, nFieldSelected); - else - pAccessible = NULL; + size_t nFieldIndex = mnFirstVisIndex + (mbVertical ? (nCol * mnRowCount + nRow) : (nRow * mnColCount + nCol)); + return (nFieldIndex < maFields.size()) ? nFieldIndex : PIVOTFIELD_INVALID; } } } + return PIVOTFIELD_INVALID; } -void ScDPFieldWindow::SetSelectionHome() +size_t ScPivotFieldWindow::GetDropIndex( const Point& rWindowPos ) const { - if( !aFieldArr.empty() ) + if( (rWindowPos.X() >= 0) && (rWindowPos.Y() >= 0) ) { - if( eType == TYPE_SELECT ) - pDlg->NotifyMoveSlider( KEY_HOME ); - SetSelection( 0 ); + long nGridWidth = maFieldSize.Width() + maSpaceSize.Width(); + long nGridHeight = maFieldSize.Height() + maSpaceSize.Height(); + size_t nCol = static_cast< size_t >( rWindowPos.X() / nGridWidth ); + size_t nRow = static_cast< size_t >( rWindowPos.Y() / nGridHeight ); + if( (nCol < mnColCount) && (nRow < mnRowCount) ) + { + size_t nFieldIndex = mnFirstVisIndex + (mbVertical ? (nCol * mnRowCount + nRow) : (nRow * mnColCount + nCol)); + long nColOffset = rWindowPos.X() % nGridWidth; + long nRowOffset = rWindowPos.Y() % nGridHeight; + // take next field, if position is in right/lower third + if( (mnColCount == 1) ? (nRowOffset * 3 > nGridHeight * 2) : (nColOffset * 3 > nGridWidth * 2) ) + ++nFieldIndex; + return ::std::min( nFieldIndex, maFields.size() ); + } } + return maFields.size(); } -void ScDPFieldWindow::SetSelectionEnd() +void ScPivotFieldWindow::GrabFocusAndSelect( size_t nSelectIndex ) { - if( !aFieldArr.empty() ) - { - if( eType == TYPE_SELECT ) - pDlg->NotifyMoveSlider( KEY_END ); - SetSelection( aFieldArr.size() - 1 ); - } + if( !HasFocus() ) GrabFocus(); + MoveSelection( nSelectIndex ); } -void ScDPFieldWindow::MoveSelection( sal_uInt16 nKeyCode, SCsCOL nDX, SCsROW nDY ) +void ScPivotFieldWindow::SelectNextField() { - size_t nNewIndex = CalcNewFieldIndex( nDX, nDY ); - if( (eType == TYPE_SELECT) && (nNewIndex == nFieldSelected) ) + MoveSelection( NEXT_FIELD ); +} + +void ScPivotFieldWindow::InsertField( size_t nInsertIndex, const ScPivotFuncData& rFuncData ) +{ + if( (meFieldType != PIVOTFIELDTYPE_SELECT) && (nInsertIndex <= maFields.size()) ) { - if( pDlg->NotifyMoveSlider( nKeyCode ) ) + size_t nFieldIndex = FindFuncDataByCol( rFuncData.mnCol ).second; + if( nFieldIndex < maFields.size() ) + { + // field exists already in this window, move it to the specified position + MoveField( nFieldIndex, nInsertIndex ); + } + else { - switch( nKeyCode ) + // insert the field into the vector and notify accessibility object + ScPivotWindowField aField( *mpDialog, rFuncData, meFieldType == PIVOTFIELDTYPE_DATA ); + if( aField.maFieldName.getLength() > 0 ) { - case KEY_UP: nNewIndex += (LINE_SIZE - 1); break; - case KEY_DOWN: nNewIndex -= (LINE_SIZE - 1); break; + InsertFieldUnchecked( nInsertIndex, aField ); + // adjust selection and scroll position + MoveSelection( nInsertIndex ); + Invalidate(); } } } - SetSelection( nNewIndex ); } -void ScDPFieldWindow::ModifySelectionOffset( long nOffsetDiff ) +bool ScPivotFieldWindow::RemoveField( size_t nRemoveIndex ) { - nFieldSelected -= nOffsetDiff; - Redraw(); + if( (meFieldType != PIVOTFIELDTYPE_SELECT) && (nRemoveIndex < maFields.size()) ) + { + // remove the field from the vector and notify accessibility object + RemoveFieldUnchecked( nRemoveIndex ); + // adjust selection and scroll position, if last field is removed + if( !maFields.empty() ) + MoveSelection( (mnSelectIndex < maFields.size()) ? mnSelectIndex : (maFields.size() - 1) ); + Invalidate(); + return true; + } + return false; } -void ScDPFieldWindow::SelectNext() +bool ScPivotFieldWindow::MoveField( size_t nFieldIndex, size_t nInsertIndex ) { - if( eType == TYPE_SELECT ) - MoveSelection( KEY_DOWN, 0, 1 ); + /* If field is moved behind current position, insertion index needs to be + adjusted, because the field is first removed from the vector. This is + done before nFieldIndex and nInsertIndex are checked for equality, to + catch the cases "move before ourselves" and "move bedind ourselves" + which are both no-ops. */ + if( nFieldIndex < nInsertIndex ) + --nInsertIndex; + + if( (meFieldType != PIVOTFIELDTYPE_SELECT) && (nFieldIndex != nInsertIndex) && (nFieldIndex < maFields.size()) && (nInsertIndex < maFields.size()) ) + { + // move the field in the vector and notify accessibility object + ScPivotWindowField aField = maFields[ nFieldIndex ]; + RemoveFieldUnchecked( nFieldIndex ); + InsertFieldUnchecked( nInsertIndex, aField ); + // adjust selection and scroll position + MoveSelection( nInsertIndex ); + Invalidate(); + return true; + } + return false; } -void ScDPFieldWindow::GrabFocusWithSel( size_t nIndex ) +const ScPivotFuncData* ScPivotFieldWindow::GetSelectedFuncData() const { - SetSelection( nIndex ); - if( !HasFocus() ) - GrabFocus(); + return (mnSelectIndex < maFields.size()) ? &maFields[ mnSelectIndex ].maFuncData : 0; } -void ScDPFieldWindow::MoveField( size_t nDestIndex ) +void ScPivotFieldWindow::ModifySelectedField( const ScPivotFuncData& rFuncData ) { - if( nDestIndex != nFieldSelected ) + if( mnSelectIndex < maFields.size() ) { - // "recycle" existing functionality - pDlg->NotifyMouseButtonDown( eType, nFieldSelected ); - pDlg->NotifyMouseButtonUp( OutputToScreenPixel( GetFieldPosition( nDestIndex ) ) ); + maFields[ mnSelectIndex ].maFuncData = rFuncData; + maFields[ mnSelectIndex ].InitFieldName( *mpDialog, meFieldType == PIVOTFIELDTYPE_DATA ); + Invalidate(); } } -void ScDPFieldWindow::MoveFieldRel( SCsCOL nDX, SCsROW nDY ) +bool ScPivotFieldWindow::RemoveSelectedField() { - MoveField( CalcNewFieldIndex( nDX, nDY ) ); + return RemoveField( mnSelectIndex ); } -//------------------------------------------------------------------- - -void __EXPORT ScDPFieldWindow::Paint( const Rectangle& /* rRect */ ) +bool ScPivotFieldWindow::MoveSelectedField( size_t nInsertIndex ) { - // #124828# hiding the caption is now done from StateChanged - Redraw(); + return MoveField( mnSelectIndex, nInsertIndex ); } -void ScDPFieldWindow::UseMnemonic() +void ScPivotFieldWindow::NotifyStartTracking() { - // Now the FixedText has its mnemonic char. Grab the text and hide the - // FixedText to be able to handle tabstop and mnemonics separately. - if( pFtCaption ) - { - SetText( pFtCaption->GetText() ); - pFtCaption->Hide(); - } - - // after reading the mnemonics, tab stop style bits can be updated - UpdateStyle(); + // rescue old scrolling index, to be able to restore it when tracking is cancelled + mnOldFirstVisIndex = mnFirstVisIndex; } -void __EXPORT ScDPFieldWindow::DataChanged( const DataChangedEvent& rDCEvt ) +void ScPivotFieldWindow::NotifyTracking( const Point& rWindowPos ) { - if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + size_t nFieldIndex = GetDropIndex( rWindowPos ); + + // insertion index changed: draw new cursor and exit + if( nFieldIndex != mnInsCursorIndex ) { - GetStyleSettings(); - Redraw(); + mnInsCursorIndex = nFieldIndex; + mnAutoScrollDelay = INITIAL_TRACKING_DELAY; + Invalidate(); + return; } - Control::DataChanged( rDCEvt ); -} -void __EXPORT ScDPFieldWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) + // insertion index unchanged: countdown for auto scrolling + if( mnAutoScrollDelay > 0 ) { - size_t nIndex = 0; - if( GetFieldIndex( rMEvt.GetPosPixel(), nIndex ) && IsExistingIndex( nIndex ) ) - { - GrabFocusWithSel( nIndex ); + --mnAutoScrollDelay; + return; + } - if( rMEvt.GetClicks() == 1 ) - { - PointerStyle ePtr = pDlg->NotifyMouseButtonDown( eType, nIndex ); - CaptureMouse(); - SetPointer( Pointer( ePtr ) ); - } - else - pDlg->NotifyDoubleClick( eType, nIndex ); - } + // check if tracking happens on first or last field + long nScrollDelta = 0; + if( (mnInsCursorIndex > 0) && (mnInsCursorIndex == mnFirstVisIndex) ) + nScrollDelta = -static_cast< long >( mnLineSize ); + else if( (mnInsCursorIndex < maFields.size()) && (mnInsCursorIndex == mnFirstVisIndex + mnPageSize) ) + nScrollDelta = static_cast< long >( mnLineSize ); + if( nScrollDelta != 0 ) + { + // update mnInsCursorIndex, so it will be drawn at the same position after scrolling + mnInsCursorIndex += nScrollDelta; + mnFirstVisIndex += nScrollDelta; + // delay auto scroll by line size, to slow down scrolling in column/page windows + mnAutoScrollDelay = mnLineSize - 1; + Invalidate(); } } -void __EXPORT ScDPFieldWindow::MouseButtonUp( const MouseEvent& rMEvt ) +void ScPivotFieldWindow::NotifyEndTracking( ScPivotFieldEndTracking eEndType ) { - if( rMEvt.IsLeft() ) + if( eEndType != ENDTRACKING_DROP ) + mnFirstVisIndex = mnOldFirstVisIndex; + if( eEndType != ENDTRACKING_SUSPEND ) { - if( rMEvt.GetClicks() == 1 ) - { - pDlg->NotifyMouseButtonUp( OutputToScreenPixel( rMEvt.GetPosPixel() ) ); - SetPointer( Pointer( POINTER_ARROW ) ); - } - - if( IsMouseCaptured() ) - ReleaseMouse(); + mnOldFirstVisIndex = PIVOTFIELD_INVALID; + mbIsTrackingSource = false; } + mnInsCursorIndex = PIVOTFIELD_INVALID; + Invalidate(); } -void __EXPORT ScDPFieldWindow::MouseMove( const MouseEvent& rMEvt ) +// protected ------------------------------------------------------------------ + +void ScPivotFieldWindow::Paint( const Rectangle& /*rRect*/ ) { - if( IsMouseCaptured() ) + // prepare a virtual device for buffered painting + VirtualDevice aVirDev; + // #i97623# VirtualDevice is always LTR on construction while other windows derive direction from parent + aVirDev.EnableRTL( IsRTLEnabled() ); + aVirDev.SetMapMode( MAP_PIXEL ); + aVirDev.SetOutputSizePixel( GetSizePixel() ); + Font aFont = GetFont(); + aFont.SetTransparent( true ); + aVirDev.SetFont( aFont ); + + // draw the background and all fields + DrawBackground( aVirDev ); + for( size_t nFieldIndex = mnFirstVisIndex, nEndIndex = mnFirstVisIndex + mnPageSize; nFieldIndex < nEndIndex; ++nFieldIndex ) + DrawField( aVirDev, nFieldIndex ); + DrawInsertionCursor( aVirDev ); + DrawBitmap( Point( 0, 0 ), aVirDev.GetBitmap( Point( 0, 0 ), GetSizePixel() ) ); + + // draw field text focus + if( HasFocus() && (mnSelectIndex < maFields.size()) && (mnFirstVisIndex <= mnSelectIndex) && (mnSelectIndex < mnFirstVisIndex + mnPageSize) ) { - PointerStyle ePtr = pDlg->NotifyMouseMove( OutputToScreenPixel( rMEvt.GetPosPixel() ) ); - SetPointer( Pointer( ePtr ) ); + long nFieldWidth = maFieldSize.Width(); + long nSelectionWidth = Min( GetTextWidth( maFields[ mnSelectIndex ].maFieldName ) + 4, nFieldWidth - 6 ); + Rectangle aSelection( + GetFieldPosition( mnSelectIndex ) + Point( (nFieldWidth - nSelectionWidth) / 2, 3 ), + Size( nSelectionWidth, maFieldSize.Height() - 6 ) ); + InvertTracking( aSelection, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); } - size_t nIndex = 0; - if( GetFieldIndex( rMEvt.GetPosPixel(), nIndex ) && IsShortenedText( nIndex ) ) + + // update scrollbar + size_t nFieldCount = maFields.size(); + /* Already show the scrollbar if window is full but no fields are hidden + (yet). This gives the user the hint that it is now possible to add more + fields to the window. */ + mrScrollBar.Show( nFieldCount >= mnPageSize ); + mrScrollBar.Enable( nFieldCount > mnPageSize ); + if( mrScrollBar.IsVisible() ) { - Point aPos = OutputToScreenPixel( rMEvt.GetPosPixel() ); - Rectangle aRect( aPos, GetSizePixel() ); - String aHelpText = GetFieldText(nIndex); - Help::ShowQuickHelp( this, aRect, aHelpText ); + mrScrollBar.SetRange( Range( 0, static_cast< long >( (nFieldCount - 1) / mnLineSize + 1 ) ) ); + mrScrollBar.SetThumbPos( static_cast< long >( mnFirstVisIndex / mnLineSize ) ); } + + /* Exclude empty fields from tab chain, but do not disable them. They need + to be enabled because they still act as target for field movement via + keyboard shortcuts. */ + WinBits nMask = ~(WB_TABSTOP | WB_NOTABSTOP); + SetStyle( (GetStyle() & nMask) | (IsEmpty() ? WB_NOTABSTOP : WB_TABSTOP) ); } -void __EXPORT ScDPFieldWindow::KeyInput( const KeyEvent& rKEvt ) +void ScPivotFieldWindow::StateChanged( StateChangedType nStateChange ) { - const KeyCode& rKeyCode = rKEvt.GetKeyCode(); - sal_uInt16 nCode = rKeyCode.GetCode(); - sal_Bool bKeyEvaluated = sal_False; + Control::StateChanged( nStateChange ); - if( rKeyCode.IsMod1() && (eType != TYPE_SELECT) ) - { - bKeyEvaluated = sal_True; - switch( nCode ) - { - case KEY_UP: MoveFieldRel( 0, -1 ); break; - case KEY_DOWN: MoveFieldRel( 0, 1 ); break; - case KEY_LEFT: MoveFieldRel( -1, 0 ); break; - case KEY_RIGHT: MoveFieldRel( 1, 0 ); break; - case KEY_HOME: MoveField( 0 ); break; - case KEY_END: MoveField( aFieldArr.size() - 1 ); break; - default: bKeyEvaluated = sal_False; - } - } - else + if( nStateChange == STATE_CHANGE_INITSHOW ) { - bKeyEvaluated = sal_True; - switch( nCode ) + /* After the fixed text associated to this control has received its + unique mnemonic from VCL dialog initialization code, put this text + into the field windows. + #124828# Hiding the FixedTexts and clearing the tab stop style bits + has to be done after assigning the mnemonics, but Paint() is too + late, because the test tool may send key events to the dialog when + it isn't visible. Mnemonics are assigned in Dialog::StateChanged() + for STATE_CHANGE_INITSHOW, so this can be done immediately + afterwards. */ + if( mpFtCaption ) { - case KEY_UP: MoveSelection( nCode, 0, -1 ); break; - case KEY_DOWN: MoveSelection( nCode, 0, 1 ); break; - case KEY_LEFT: MoveSelection( nCode, -1, 0 ); break; - case KEY_RIGHT: MoveSelection( nCode, 1, 0 ); break; - case KEY_HOME: SetSelectionHome(); break; - case KEY_END: SetSelectionEnd(); break; - case KEY_DELETE: - pDlg->NotifyRemoveField( eType, nFieldSelected ); break; - default: bKeyEvaluated = sal_False; + SetText( mpFtCaption->GetText() ); + mpFtCaption->Hide(); } } - - if( !bKeyEvaluated ) - Control::KeyInput( rKEvt ); } -void __EXPORT ScDPFieldWindow::GetFocus() +void ScPivotFieldWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - Control::GetFocus(); - Redraw(); - if( GetGetFocusFlags() & GETFOCUS_MNEMONIC ) // move field on shortcut - pDlg->NotifyMoveField( eType ); - else // else change focus - pDlg->NotifyFieldFocus( eType, sal_True ); - - if (pAccessible) - { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->GotFocus(); - else - pAccessible = NULL; - } + Control::DataChanged( rDCEvt ); + if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + Invalidate(); } -void __EXPORT ScDPFieldWindow::LoseFocus() +void ScPivotFieldWindow::KeyInput( const KeyEvent& rKEvt ) { - Control::LoseFocus(); - Redraw(); - pDlg->NotifyFieldFocus( eType, sal_False ); + bool bKeyEvaluated = false; - if (pAccessible) + if( !maFields.empty() ) { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->LostFocus(); + const KeyCode& rKeyCode = rKEvt.GetKeyCode(); + sal_uInt16 nCode = rKeyCode.GetCode(); + + // do not move fields in selection window + if( rKeyCode.IsMod1() && (meFieldType != PIVOTFIELDTYPE_SELECT) ) + { + bKeyEvaluated = true; + switch( nCode ) + { + case KEY_UP: MoveSelectedField( mbVertical ? PREV_FIELD : PREV_LINE ); break; + case KEY_DOWN: MoveSelectedField( mbVertical ? NEXT_FIELD : NEXT_LINE ); break; + case KEY_LEFT: MoveSelectedField( mbVertical ? PREV_LINE : PREV_FIELD ); break; + case KEY_RIGHT: MoveSelectedField( mbVertical ? NEXT_LINE : NEXT_FIELD ); break; + case KEY_HOME: MoveSelectedField( FIRST_FIELD ); break; + case KEY_END: MoveSelectedField( LAST_FIELD ); break; + default: bKeyEvaluated = false; + } + } else - pAccessible = NULL; + { + bKeyEvaluated = true; + switch( nCode ) + { + case KEY_UP: MoveSelection( mbVertical ? PREV_FIELD : PREV_LINE ); break; + case KEY_DOWN: MoveSelection( mbVertical ? NEXT_FIELD : NEXT_LINE ); break; + case KEY_LEFT: MoveSelection( mbVertical ? PREV_LINE : PREV_FIELD ); break; + case KEY_RIGHT: MoveSelection( mbVertical ? NEXT_LINE : NEXT_FIELD ); break; + case KEY_PAGEUP: MoveSelection( PREV_PAGE ); break; + case KEY_PAGEDOWN: MoveSelection( NEXT_PAGE ); break; + case KEY_HOME: MoveSelection( FIRST_FIELD ); break; + case KEY_END: MoveSelection( LAST_FIELD ); break; + // delete field per DEL key - dialog needs to change focus if window becomes empty + case KEY_DELETE: RemoveSelectedField(); mpDialog->NotifyFieldRemoved( *this ); break; + default: bKeyEvaluated = false; + } + } } -} -//------------------------------------------------------------------- + if( !bKeyEvaluated ) + Control::KeyInput( rKEvt ); +} -void ScDPFieldWindow::AddField( const String& rText, size_t nNewIndex ) +void ScPivotFieldWindow::MouseButtonDown( const MouseEvent& rMEvt ) { - DBG_ASSERT( nNewIndex == aFieldArr.size(), "ScDPFieldWindow::AddField - invalid index" ); - if( IsValidIndex( nNewIndex ) ) + if( rMEvt.IsLeft() ) { - aFieldArr.push_back( FieldString( rText, true ) ); - if (pAccessible) + size_t nNewSelectIndex = GetFieldIndex( rMEvt.GetPosPixel() ); + if( nNewSelectIndex < maFields.size() ) { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->AddField(nNewIndex); + // grabbing after GetFieldIndex() will prevent to focus empty window + GrabFocusAndSelect( nNewSelectIndex ); + if( rMEvt.GetClicks() == 1 ) + { + // one click: start tracking + mbIsTrackingSource = true; + mnOldFirstVisIndex = mnFirstVisIndex; + mpDialog->NotifyStartTracking( *this ); + } else - pAccessible = NULL; + { + // two clicks: open field options dialog + mpDialog->NotifyDoubleClick( *this ); + } } } } -void ScDPFieldWindow::DelField( size_t nDelIndex ) +void ScPivotFieldWindow::RequestHelp( const HelpEvent& rHEvt ) { - if( IsExistingIndex( nDelIndex ) ) + if( (rHEvt.GetMode() & HELPMODE_QUICK) != 0 ) { - if (pAccessible) // before decrement fieldcount + // show a tooltip with full field name, if field text is clipped + size_t nFieldIndex = GetFieldIndex( rHEvt.GetMousePosPixel() - GetPosPixel() ); + if( (nFieldIndex < maFields.size()) && maFields[ nFieldIndex ].mbClipped ) { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->RemoveField(nDelIndex); - else - pAccessible = NULL; + Rectangle aRect( rHEvt.GetMousePosPixel(), GetSizePixel() ); + Help::ShowQuickHelp( this, aRect, maFields[ nFieldIndex ].maFieldName ); + return; } - aFieldArr.erase( aFieldArr.begin() + nDelIndex ); - Redraw(); } + Control::RequestHelp( rHEvt ); } -void ScDPFieldWindow::ClearFields() +void ScPivotFieldWindow::GetFocus() { - if( eType == TYPE_SELECT || eType == TYPE_PAGE || eType == TYPE_COL || eType == TYPE_ROW || eType == TYPE_DATA) - { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (!xTempAcc.is() && pAccessible) - pAccessible = NULL; - if (pAccessible) - for( size_t nIdx = aFieldArr.size(); nIdx > 0; --nIdx ) - pAccessible->RemoveField( nIdx - 1 ); + Control::GetFocus(); + Invalidate(); + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->GotFocus(); +} - aFieldArr.clear(); - } +void ScPivotFieldWindow::LoseFocus() +{ + Control::LoseFocus(); + Invalidate(); + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->LostFocus(); +} + +uno::Reference< accessibility::XAccessible > ScPivotFieldWindow::CreateAccessible() +{ + mpAccessible = new ScAccessibleDataPilotControl( GetAccessibleParentWindow()->GetAccessible(), this ); + uno::Reference< accessibility::XAccessible > xReturn( mpAccessible ); + mpAccessible->Init(); + mxAccessible = xReturn; + return xReturn; +} + +// private -------------------------------------------------------------------- + +size_t ScPivotFieldWindow::RecalcVisibleIndex( size_t nSelectIndex ) const +{ + // calculate a scrolling offset that shows the selected field + size_t nNewFirstVisIndex = mnFirstVisIndex; + if( nSelectIndex < nNewFirstVisIndex ) + nNewFirstVisIndex = static_cast< size_t >( (nSelectIndex / mnLineSize) * mnLineSize ); + else if( nSelectIndex >= nNewFirstVisIndex + mnPageSize ) + nNewFirstVisIndex = static_cast< size_t >( (nSelectIndex / mnLineSize + 1) * mnLineSize ) - mnPageSize; + // check if there are complete empty lines in the bottom/right + size_t nMaxFirstVisIndex = (maFields.size() <= mnPageSize) ? 0 : (((maFields.size() - 1) / mnLineSize + 1) * mnLineSize - mnPageSize); + return ::std::min( nNewFirstVisIndex, nMaxFirstVisIndex ); } -void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex ) +void ScPivotFieldWindow::SetSelectionUnchecked( size_t nSelectIndex, size_t nFirstVisIndex ) { - if( IsExistingIndex( nIndex ) ) + if( !maFields.empty() && (nSelectIndex < maFields.size()) ) { - aFieldArr[ nIndex ] = FieldString( rText, true ); - Redraw(); + bool bScrollPosChanged = mnFirstVisIndex != nFirstVisIndex; + bool bSelectionChanged = mnSelectIndex != nSelectIndex; - if (pAccessible) + sal_Int32 nOldSelected = static_cast< sal_Int32 >( mnSelectIndex ); + mnFirstVisIndex = nFirstVisIndex; + mnSelectIndex = nSelectIndex; + + if( bScrollPosChanged || bSelectionChanged ) + Invalidate(); + + // TODO: accessibility action for changed scrolling position? + + // notify accessibility object about changed selection + if( bSelectionChanged && HasFocus() ) { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->FieldNameChange(nIndex); - else - pAccessible = NULL; + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->FieldFocusChange( nOldSelected, static_cast< sal_Int32 >( mnSelectIndex ) ); } } } -const String& ScDPFieldWindow::GetFieldText( size_t nIndex ) const +void ScPivotFieldWindow::MoveSelection( size_t nSelectIndex ) { - if( IsExistingIndex( nIndex ) ) - return aFieldArr[ nIndex ].first; - return EMPTY_STRING; + if( nSelectIndex < maFields.size() ) + SetSelectionUnchecked( nSelectIndex, RecalcVisibleIndex( nSelectIndex ) ); } -//------------------------------------------------------------------- - -bool ScDPFieldWindow::AddField( const String& rText, const Point& rPos, size_t& rnIndex ) +void ScPivotFieldWindow::MoveSelection( MoveType eMoveType ) { - if ( aFieldArr.size() == nFieldSize ) - return sal_False; + if( maFields.empty() ) + return; - size_t nNewIndex = 0; - if( GetFieldIndex( rPos, nNewIndex ) ) + size_t nLastIndex = maFields.size() - 1; + size_t nNewSelectIndex = mnSelectIndex; + switch( eMoveType ) { - if( nNewIndex > aFieldArr.size() ) - nNewIndex = aFieldArr.size(); - - aFieldArr.insert( aFieldArr.begin() + nNewIndex, FieldString( rText, true ) ); - nFieldSelected = nNewIndex; - Redraw(); - rnIndex = nNewIndex; + case PREV_FIELD: + nNewSelectIndex = (nNewSelectIndex > 0) ? (nNewSelectIndex - 1) : 0; + break; + case NEXT_FIELD: + nNewSelectIndex = (nNewSelectIndex < nLastIndex) ? (nNewSelectIndex + 1) : nLastIndex; + break; + case PREV_LINE: + nNewSelectIndex = (nNewSelectIndex > mnLineSize) ? (nNewSelectIndex - mnLineSize) : 0; + break; + case NEXT_LINE: + nNewSelectIndex = (nNewSelectIndex + mnLineSize < nLastIndex) ? (nNewSelectIndex + mnLineSize) : nLastIndex; + break; + case PREV_PAGE: + nNewSelectIndex = (nNewSelectIndex > mnPageSize) ? (nNewSelectIndex - mnPageSize) : 0; + break; + case NEXT_PAGE: + nNewSelectIndex = (nNewSelectIndex + mnPageSize < nLastIndex) ? (nNewSelectIndex + mnPageSize) : nLastIndex; + break; + case FIRST_FIELD: + nNewSelectIndex = 0; + break; + case LAST_FIELD: + nNewSelectIndex = nLastIndex; + break; + } - if (pAccessible) - { - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; - if (xTempAcc.is()) - pAccessible->AddField(nNewIndex); - else - pAccessible = NULL; - } + // SetSelectionUnchecked() redraws the control and updates the scrollbar + SetSelectionUnchecked( nNewSelectIndex, RecalcVisibleIndex( nNewSelectIndex ) ); +} - return true; +void ScPivotFieldWindow::MoveSelectedField( MoveType eMoveType ) +{ + if( mnSelectIndex < maFields.size() ) + { + // find position to insert the field by changing the selection first + size_t nOldSelectIndex = mnSelectIndex; + MoveSelection( eMoveType ); + MoveField( nOldSelectIndex, (nOldSelectIndex < mnSelectIndex) ? (mnSelectIndex + 1) : mnSelectIndex ); } +} - return false; +void ScPivotFieldWindow::InsertFieldUnchecked( size_t nInsertIndex, const ScPivotWindowField& rField ) +{ + maFields.insert( maFields.begin() + nInsertIndex, rField ); + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->AddField( static_cast< sal_Int32 >( nInsertIndex ) ); +} + +void ScPivotFieldWindow::RemoveFieldUnchecked( size_t nRemoveIndex ) +{ + ::rtl::Reference< ScAccessibleDataPilotControl > xAcc = GetAccessibleControl(); + if( xAcc.is() ) + xAcc->RemoveField( static_cast< sal_Int32 >( nRemoveIndex ) ); + maFields.erase( maFields.begin() + nRemoveIndex ); } -void ScDPFieldWindow::GetExistingIndex( const Point& rPos, size_t& rnIndex ) +void ScPivotFieldWindow::DrawBackground( OutputDevice& rDev ) { - if( !aFieldArr.empty() && (eType != TYPE_SELECT) && GetFieldIndex( rPos, rnIndex ) ) + Size aDevSize = rDev.GetOutputSizePixel(); + const StyleSettings& rStyleSett = GetSettings().GetStyleSettings(); + + if( meFieldType == PIVOTFIELDTYPE_SELECT ) { - if( rnIndex >= aFieldArr.size() ) - rnIndex = aFieldArr.size() - 1; + rDev.SetLineColor(); + rDev.SetFillColor( rStyleSett.GetFaceColor() ); + rDev.DrawRect( Rectangle( Point( 0, 0 ), aDevSize ) ); } else - rnIndex = 0; + { + rDev.SetLineColor( rStyleSett.GetWindowTextColor() ); + rDev.SetFillColor( rStyleSett.GetWindowColor() ); + rDev.DrawRect( Rectangle( Point( 0, 0 ), aDevSize ) ); + + /* Draw the caption text. This needs some special handling, because we + support hard line breaks here. This part will draw each line of the + text for itself. */ + rDev.SetTextColor( rStyleSett.GetWindowTextColor() ); + xub_StrLen nTokenCnt = GetText().GetTokenCount( '\n' ); + long nY = (aDevSize.Height() - nTokenCnt * rDev.GetTextHeight()) / 2; + for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken ) + { + String aLine = GetText().GetToken( 0, '\n', nStringIx ); + Point aLinePos( (aDevSize.Width() - rDev.GetCtrlTextWidth( aLine )) / 2, nY ); + rDev.DrawCtrlText( aLinePos, aLine ); + nY += rDev.GetTextHeight(); + } + } } -String ScDPFieldWindow::GetDescription() const +void ScPivotFieldWindow::DrawField( OutputDevice& rDev, size_t nFieldIndex ) { - String sDescription; - switch( eType ) + if( (nFieldIndex < maFields.size()) && (mnFirstVisIndex <= nFieldIndex) && (nFieldIndex < mnFirstVisIndex + mnPageSize) ) { - case TYPE_COL: - sDescription = ScResId(STR_ACC_DATAPILOT_COL_DESCR); - break; - case TYPE_ROW: - sDescription = ScResId(STR_ACC_DATAPILOT_ROW_DESCR); - break; - case TYPE_DATA: - sDescription = ScResId(STR_ACC_DATAPILOT_DATA_DESCR); - break; - case TYPE_SELECT: - sDescription = ScResId(STR_ACC_DATAPILOT_SEL_DESCR); - break; - default: + // draw the button + Point aFieldPos = GetFieldPosition( nFieldIndex ); + bool bFocus = HasFocus() && (nFieldIndex == mnSelectIndex); + DecorationView aDecoView( &rDev ); + aDecoView.DrawButton( Rectangle( aFieldPos, maFieldSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 ); + + // #i31600# if text is too long, cut and add ellipsis + const OUString& rFullText = maFields[ nFieldIndex ].maFieldName; + OUString aClippedText = rFullText; + long nLabelWidth = rDev.GetTextWidth( rFullText ); + if( (maFields[ nFieldIndex ].mbClipped = nLabelWidth + 6 > maFieldSize.Width()) == true ) { - // added to avoid warnings + sal_Int32 nMinLen = 0; + sal_Int32 nMaxLen = rFullText.getLength(); + bool bFits = false; + do + { + sal_Int32 nCurrLen = (nMinLen + nMaxLen) / 2; + aClippedText = rFullText.copy( 0, nCurrLen ) + OUString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); + nLabelWidth = rDev.GetTextWidth( aClippedText ); + bFits = nLabelWidth + 6 <= maFieldSize.Width(); + (bFits ? nMinLen : nMaxLen) = nCurrLen; + } + while( !bFits || (nMinLen + 1 < nMaxLen) ); } + + // draw the button text + Point aLabelOffset( (maFieldSize.Width() - nLabelWidth) / 2, ::std::max< long >( (maFieldSize.Height() - rDev.GetTextHeight()) / 2, 3 ) ); + rDev.SetTextColor( GetSettings().GetStyleSettings().GetButtonTextColor() ); + rDev.DrawText( aFieldPos + aLabelOffset, aClippedText ); } - return sDescription; } -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ScDPFieldWindow::CreateAccessible() +void ScPivotFieldWindow::DrawInsertionCursor( OutputDevice& rDev ) { - pAccessible = - new ScAccessibleDataPilotControl(GetAccessibleParentWindow()->GetAccessible(), this); + if( (mnInsCursorIndex <= maFields.size()) && (mnFirstVisIndex <= mnInsCursorIndex) && (mnInsCursorIndex <= mnFirstVisIndex + mnPageSize) && + (!mbIsTrackingSource || (mnInsCursorIndex < mnSelectIndex) || (mnInsCursorIndex > mnSelectIndex + 1)) ) + { + Color aTextColor = GetSettings().GetStyleSettings().GetButtonTextColor(); + rDev.SetLineColor( aTextColor ); + rDev.SetFillColor( aTextColor ); - com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xReturn = pAccessible; + bool bVerticalCursor = mnColCount > 1; + long nCursorLength = bVerticalCursor ? maFieldSize.Height() : maFieldSize.Width(); - pAccessible->Init(); - xAccessible = xReturn; + bool bEndOfLastField = mnInsCursorIndex == mnFirstVisIndex + mnPageSize; + Point aMainLinePos = GetFieldPosition( bEndOfLastField ? (mnInsCursorIndex - 1) : mnInsCursorIndex ); + if( bEndOfLastField ) + (bVerticalCursor ? aMainLinePos.X() : aMainLinePos.Y()) += ((bVerticalCursor ? maFieldSize.Width() : maFieldSize.Height()) - CURSOR_WIDTH); + else if( (bVerticalCursor ? aMainLinePos.X() : aMainLinePos.Y()) > 0 ) + (bVerticalCursor ? aMainLinePos.X() : aMainLinePos.Y()) -= ((CURSOR_WIDTH + 1) / 2); + Size aMainLineSize( bVerticalCursor ? CURSOR_WIDTH : nCursorLength, bVerticalCursor ? nCursorLength : CURSOR_WIDTH ); + rDev.DrawRect( Rectangle( aMainLinePos, aMainLineSize ) ); - return xReturn; + Point aSubLinePos = aMainLinePos; + (bVerticalCursor ? aSubLinePos.X() : aSubLinePos.Y()) -= CURSOR_WIDTH; + Size aSubLineSize( bVerticalCursor ? (3 * CURSOR_WIDTH) : CURSOR_WIDTH, bVerticalCursor ? CURSOR_WIDTH : (3 * CURSOR_WIDTH) ); + rDev.DrawRect( Rectangle( aSubLinePos, aSubLineSize ) ); + + (bVerticalCursor ? aSubLinePos.Y() : aSubLinePos.X()) += (nCursorLength - CURSOR_WIDTH); + rDev.DrawRect( Rectangle( aSubLinePos, aSubLineSize ) ); + } } -//=================================================================== +::rtl::Reference< ScAccessibleDataPilotControl > ScPivotFieldWindow::GetAccessibleControl() +{ + ::rtl::Reference< ScAccessibleDataPilotControl > xAccImpl; + if( mpAccessible ) + { + // try to resolve the weak reference mxAccessible + uno::Reference< accessibility::XAccessible > xAcc = mxAccessible; + if( xAcc.is() ) + xAccImpl.set( mpAccessible ); // the rtl reference keeps the object alive + else + mpAccessible = 0; // object is dead, forget the pointer + } + return xAccImpl; + } + +// handlers ------------------------------------------------------------------- + +IMPL_LINK( ScPivotFieldWindow, ScrollHdl, ScrollBar*, pScrollBar ) +{ + // scrollbar may return negative values, if it is too small + long nThumbPos = pScrollBar->GetThumbPos(); + if( nThumbPos >= 0 ) + { + size_t nNewFirstVisIndex = static_cast< size_t >( nThumbPos * mnLineSize ); + // keep the selection index on same relative position inside row/column + size_t nSelectLineOffset = mnSelectIndex % mnLineSize; + size_t nNewSelectIndex = mnSelectIndex; + if( nNewSelectIndex < nNewFirstVisIndex ) + nNewSelectIndex = nNewFirstVisIndex + nSelectLineOffset; + else if( nNewSelectIndex >= nNewFirstVisIndex + mnPageSize ) + nNewSelectIndex = nNewFirstVisIndex + mnPageSize - mnLineSize + nSelectLineOffset; + nNewSelectIndex = ::std::min( nNewSelectIndex, maFields.size() - 1 ); + SetSelectionUnchecked( nNewSelectIndex, nNewFirstVisIndex ); + } + GrabFocus(); + return 0; +} +// ============================================================================ diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 5b2b7b47fdd2..8e2bbc7458c3 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -132,6 +132,65 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, pTimer = new Timer; pTimer->SetTimeout( 50 ); // 50ms warten pTimer->SetTimeoutHdl( LINK( this, ScFilterDlg, TimeOutHdl ) ); + + String sAccName (ScResId(RID_FILTER_OPERATOR)); + String sIndexName(sAccName); + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbConnect1.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbConnect2.SetAccessibleName(sIndexName); + + sAccName = String(ScResId(RID_FILTER_FIELDNAME)); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbField1.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbField2.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + aLbField3.SetAccessibleName(sIndexName); + + + sAccName = String(ScResId(RID_FILTER_CONDITION)); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbCond1.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbCond2.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + aLbCond3.SetAccessibleName(sIndexName); + + sAccName = String(ScResId(RID_FILTER_VALUE)); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aEdVal1.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aEdVal2.SetAccessibleName(sIndexName); + sIndexName = sAccName; + sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + aEdVal3.SetAccessibleName(sIndexName); + + aLbCopyArea.SetAccessibleName(ScResId(STR_COPY_AREA_TO)); + aEdCopyArea.SetAccessibleName(ScResId(STR_COPY_AREA_TO)); + aLbCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + aEdCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + + aLbConnect1.SetAccessibleRelationLabeledBy(&aFtConnect); + aLbConnect2.SetAccessibleRelationLabeledBy(&aFtConnect); + aLbField1.SetAccessibleRelationLabeledBy(&aFtField); + aLbField2.SetAccessibleRelationLabeledBy(&aFtField); + aLbField3.SetAccessibleRelationLabeledBy(&aFtField); + aLbCond1.SetAccessibleRelationLabeledBy(&aFtCond); + aLbCond2.SetAccessibleRelationLabeledBy(&aFtCond); + aLbCond3.SetAccessibleRelationLabeledBy(&aFtCond); + aEdVal1.SetAccessibleRelationLabeledBy(&aFtVal); + aEdVal2.SetAccessibleRelationLabeledBy(&aFtVal); + aEdVal3.SetAccessibleRelationLabeledBy(&aFtVal); } diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index 64456ef2cf2d..b21afc999b28 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -44,10 +44,20 @@ static const sal_Char pStrFix[] = "FIX"; ScImportOptions::ScImportOptions( const String& rStr ) { + // Use the same string format as ScAsciiOptions, + // because the import options string is passed here when a CSV file is loaded and saved again. + // The old format is still supported because it might be used in macros. + bFixedWidth = sal_False; nFieldSepCode = 0; - if ( rStr.GetTokenCount(',') >= 3 ) + nTextSepCode = 0; + eCharSet = RTL_TEXTENCODING_DONTKNOW; + bSaveAsShown = sal_True; // "true" if not in string (after CSV import) + bQuoteAllText = sal_False; + xub_StrLen nTokenCount = rStr.GetTokenCount(','); + if ( nTokenCount >= 3 ) { + // first 3 tokens: common String aToken( rStr.GetToken( 0, ',' ) ); if( aToken.EqualsIgnoreCaseAscii( pStrFix ) ) bFixedWidth = sal_True; @@ -56,7 +66,21 @@ ScImportOptions::ScImportOptions( const String& rStr ) nTextSepCode = (sal_Unicode) rStr.GetToken(1,',').ToInt32(); aStrFont = rStr.GetToken(2,','); eCharSet = ScGlobal::GetCharsetValue(aStrFont); - bSaveAsShown = (rStr.GetToken( 3, ',' ).ToInt32() ? sal_True : sal_False); + + if ( nTokenCount == 4 ) + { + // compatibility with old options string: "Save as shown" as 4th token, numeric + bSaveAsShown = (rStr.GetToken( 3, ',' ).ToInt32() ? sal_True : sal_False); + bQuoteAllText = sal_True; // use old default then + } + else + { + // look at the same positions as in ScAsciiOptions + if ( nTokenCount >= 7 ) + bQuoteAllText = rStr.GetToken(6, ',').EqualsAscii("true"); + if ( nTokenCount >= 9 ) + bSaveAsShown = rStr.GetToken(8, ',').EqualsAscii("true"); + } } } @@ -74,8 +98,11 @@ String ScImportOptions::BuildString() const aResult += String::CreateFromInt32(nTextSepCode); aResult += ','; aResult += aStrFont; - aResult += ','; - aResult += String::CreateFromInt32( bSaveAsShown ? 1 : 0 ); + // use the same string format as ScAsciiOptions: + aResult.AppendAscii( ",1,,0," ); // first row, no column info, default language + aResult.AppendAscii(bQuoteAllText ? "true" : "false"); // same as "quoted field as text" in ScAsciiOptions + aResult.AppendAscii( ",true," ); // "detect special numbers" + aResult.AppendAscii(bSaveAsShown ? "true" : "false"); // "save as shown": not in ScAsciiOptions return aResult; } diff --git a/sc/source/ui/dbgui/imoptdlg.hrc b/sc/source/ui/dbgui/imoptdlg.hrc index 5fd9256e8009..22136706de9d 100644 --- a/sc/source/ui/dbgui/imoptdlg.hrc +++ b/sc/source/ui/dbgui/imoptdlg.hrc @@ -41,4 +41,5 @@ #define FL_FIELDOPT 11 #define CB_FIXEDWIDTH 12 #define CB_SAVESHOWN 13 +#define CB_QUOTEALL 14 diff --git a/sc/source/ui/dbgui/imoptdlg.src b/sc/source/ui/dbgui/imoptdlg.src index e83f3a9c9dac..905308e9fecb 100644 --- a/sc/source/ui/dbgui/imoptdlg.src +++ b/sc/source/ui/dbgui/imoptdlg.src @@ -96,7 +96,7 @@ ModalDialog RID_SCDLG_IMPORTOPT CheckBox CB_FIXEDWIDTH { HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_FIXEDWIDTH"; - Pos = MAP_APPFONT( 12, 80 ); + Pos = MAP_APPFONT( 12, 92 ); Size = MAP_APPFONT( 172, 10 ); Hide = TRUE; Text [ en-US ] = "Fixed column ~width"; @@ -104,12 +104,20 @@ ModalDialog RID_SCDLG_IMPORTOPT CheckBox CB_SAVESHOWN { HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_SAVESHOWN"; - Pos = MAP_APPFONT( 12, 66 ); + Pos = MAP_APPFONT( 12, 78 ); Size = MAP_APPFONT( 172, 10 ); TabStop = TRUE; Hide = TRUE; Text [ en-US ] = "Save cell content as ~shown"; }; + CheckBox CB_QUOTEALL + { + HelpID = "sc:CheckBox:RID_SCDLG_IMPORTOPT:CB_QUOTEALL"; + Pos = MAP_APPFONT( 20, 64 ); + Size = MAP_APPFONT( 164, 10 ); + Hide = TRUE; + Text [ en-US ] = "~Quote all text cells"; + }; OKButton BTN_OK { Pos = MAP_APPFONT ( 202 , 6 ) ; diff --git a/sc/source/ui/dbgui/pivot.hrc b/sc/source/ui/dbgui/pivot.hrc index 1a97d4c75b52..fd14c0f98a6b 100644 --- a/sc/source/ui/dbgui/pivot.hrc +++ b/sc/source/ui/dbgui/pivot.hrc @@ -34,13 +34,16 @@ #define BTN_OPTIONS 6 #define FL_LAYOUT 10 +#define FL_SELECT 90 +#define SCROLL_COL 91 #define WND_COL 11 +#define SCROLL_ROW 92 #define WND_ROW 12 +#define SCROLL_DATA 93 #define WND_DATA 13 #define WND_SELECT 14 -#define WND_FIELD 15 -#define WND_FIELD_SPACE 16 #define WND_HSCROLL 17 +#define SCROLL_PAGE 98 #define WND_PAGE 18 #define FT_COL 31 #define FT_ROW 32 diff --git a/sc/source/ui/dbgui/pivot.src b/sc/source/ui/dbgui/pivot.src index 763f03fe82bf..52b1a9d584cd 100644 --- a/sc/source/ui/dbgui/pivot.src +++ b/sc/source/ui/dbgui/pivot.src @@ -31,12 +31,12 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT { OutputSize = TRUE ; HelpId = CMD_SID_OPENDLG_PIVOTTABLE ; - Size = MAP_APPFONT ( 336 , 190 ) ; + Size = MAP_APPFONT ( 348 , 186 ) ; Hide = TRUE ; SVLook = TRUE ; Moveable = TRUE ; Closeable = FALSE ; - Text [ en-US ] = "DataPilot" ; + Text [ en-US ] = "Pivot Table" ; FixedText FT_PAGE { @@ -44,10 +44,17 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT Size = MAP_APPFONT ( 37 , 8 ) ; Text[ en-US ] = "Page Fields" ; }; + ScrollBar SCROLL_PAGE + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 8 , 24 ) ; + HScroll = FALSE ; + TabStop = FALSE ; + }; Control WND_PAGE { - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 182 , 24 ) ; + Pos = MAP_APPFONT ( 18 , 14 ) ; + Size = MAP_APPFONT ( 180 , 24 ) ; TabStop = TRUE ; }; FixedText FT_COL @@ -56,9 +63,16 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT Size = MAP_APPFONT ( 37 , 8 ) ; Text [ en-US ] = "Column Fields" ; }; + ScrollBar SCROLL_COL + { + Pos = MAP_APPFONT ( 198 , 42 ) ; + Size = MAP_APPFONT ( 8 , 24 ) ; + HScroll = FALSE ; + TabStop = FALSE ; + }; Control WND_COL { - Pos = MAP_APPFONT ( 44 , 40 ) ; + Pos = MAP_APPFONT ( 54 , 42 ) ; Size = MAP_APPFONT ( 144 , 24 ) ; TabStop = TRUE ; }; @@ -68,9 +82,16 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT Size = MAP_APPFONT ( 37 , 8 ) ; Text [ en-US ] = "Row\nFields" ; }; + ScrollBar SCROLL_ROW + { + Pos = MAP_APPFONT ( 42 , 70 ) ; + Size = MAP_APPFONT ( 8 , 96 ) ; + HScroll = FALSE ; + TabStop = FALSE ; + }; Control WND_ROW { - Pos = MAP_APPFONT ( 6 , 66 ) ; + Pos = MAP_APPFONT ( 6 , 70 ) ; Size = MAP_APPFONT ( 36 , 96 ) ; TabStop = TRUE ; }; @@ -80,16 +101,23 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT Size = MAP_APPFONT ( 37 , 8 ) ; Text [ en-US ] = "Data Fields" ; }; + ScrollBar SCROLL_DATA + { + Pos = MAP_APPFONT ( 198 , 70 ) ; + Size = MAP_APPFONT ( 8 , 96 ) ; + HScroll = FALSE ; + TabStop = FALSE ; + }; Control WND_DATA { - Pos = MAP_APPFONT ( 44 , 66 ) ; + Pos = MAP_APPFONT ( 54 , 70 ) ; Size = MAP_APPFONT ( 144 , 96 ) ; TabStop = TRUE ; }; Control WND_SELECT { - Pos = MAP_APPFONT ( 194 , 14 ) ; - Size = MAP_APPFONT ( 70 , 126 ) ; + Pos = MAP_APPFONT ( 212 , 14 ) ; + Size = MAP_APPFONT ( 74 , 138 ) ; TabStop = TRUE ; }; String STR_SELECT @@ -98,47 +126,53 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT }; ScrollBar WND_HSCROLL { - Pos = MAP_APPFONT ( 194 , 144 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; + Pos = MAP_APPFONT ( 212 , 154 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; HScroll = TRUE ; TabStop = FALSE ; }; FixedText FT_INFO { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 182 , 16 ) ; + Pos = MAP_APPFONT ( 6 , 172 ) ; + Size = MAP_APPFONT ( 280 , 8 ) ; WordBreak = TRUE ; Text [ en-US ] = "Drag the fields from the right into the desired position." ; }; FixedLine FL_LAYOUT { Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 268 , 8 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; Text [ en-US ] = "Layout"; }; + FixedLine FL_SELECT + { + Pos = MAP_APPFONT ( 212 , 3 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + Text [ en-US ] = "Fields"; + }; OKButton BTN_OK { - Pos = MAP_APPFONT ( 280 , 6 ) ; + Pos = MAP_APPFONT ( 292 , 6 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 280 , 23 ) ; + Pos = MAP_APPFONT ( 292 , 23 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 280 , 43 ) ; + Pos = MAP_APPFONT ( 292 , 43 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; PushButton BTN_REMOVE { HelpID = "sc:PushButton:RID_SCDLG_PIVOT_LAYOUT:BTN_REMOVE"; - Pos = MAP_APPFONT ( 280 , 63 ) ; + Pos = MAP_APPFONT ( 292 , 63 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "Remove"; @@ -146,7 +180,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT PushButton BTN_OPTIONS { HelpID = "sc:PushButton:RID_SCDLG_PIVOT_LAYOUT:BTN_OPTIONS"; - Pos = MAP_APPFONT ( 280 , 80 ) ; + Pos = MAP_APPFONT ( 292 , 80 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "Options..."; @@ -154,34 +188,23 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT MoreButton BTN_MORE { HelpID = "sc:MoreButton:RID_SCDLG_PIVOT_LAYOUT:BTN_MORE"; - Pos = MAP_APPFONT ( 280 , 170 ) ; + Pos = MAP_APPFONT ( 292 , 166 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; MapUnit = MAP_APPFONT ; Delta = 90 ; }; - Window WND_FIELD - { - Border = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 36 , 12 ) ; - }; - Window WND_FIELD_SPACE - { - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 2 , 2 ) ; - }; FixedLine FL_OUTPUT { - Pos = MAP_APPFONT ( 6 , 190 ) ; - Size = MAP_APPFONT ( 268 , 8 ) ; + Pos = MAP_APPFONT ( 6 , 186 ) ; + Size = MAP_APPFONT ( 280 , 8 ) ; Text [ en-US ] = "Result" ; Hide = TRUE ; }; FixedText FT_INAREA { - Pos = MAP_APPFONT ( 12 , 203 ) ; + Pos = MAP_APPFONT ( 12 , 199 ) ; Size = MAP_APPFONT ( 59 , 8 ) ; Hide = TRUE ; Text [ en-US ] = "Selection from" ; @@ -190,15 +213,15 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT { HelpID = "sc:Edit:RID_SCDLG_PIVOT_LAYOUT:ED_INAREA"; Border = TRUE ; - Pos = MAP_APPFONT ( 73 , 201 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; + Pos = MAP_APPFONT ( 73 , 197 ) ; + Size = MAP_APPFONT ( 109 , 12 ) ; TabStop = TRUE ; Hide = TRUE ; }; ImageButton RB_INAREA { HelpID = "sc:ImageButton:RID_SCDLG_PIVOT_LAYOUT:RB_INAREA"; - Pos = MAP_APPFONT ( 177 , 200 ) ; + Pos = MAP_APPFONT ( 186 , 196 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; TabStop = TRUE ; Hide = TRUE ; @@ -207,7 +230,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT FixedText FT_OUTAREA { - Pos = MAP_APPFONT ( 12 , 221 ) ; + Pos = MAP_APPFONT ( 12 , 217 ) ; Size = MAP_APPFONT ( 59 , 8 ) ; Hide = TRUE ; Text [ en-US ] = "Results to" ; @@ -216,7 +239,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT { HelpID = "sc:ListBox:RID_SCDLG_PIVOT_LAYOUT:LB_OUTAREA"; Border = TRUE ; - Pos = MAP_APPFONT ( 73 , 219 ) ; + Pos = MAP_APPFONT ( 73 , 215 ) ; Size = MAP_APPFONT ( 75 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -226,15 +249,15 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT { HelpID = "sc:Edit:RID_SCDLG_PIVOT_LAYOUT:ED_OUTAREA"; Border = TRUE ; - Pos = MAP_APPFONT ( 152 , 219 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; + Pos = MAP_APPFONT ( 152 , 215 ) ; + Size = MAP_APPFONT ( 109 , 12 ) ; TabStop = TRUE ; Hide = TRUE ; }; ImageButton RB_OUTAREA { HelpID = "sc:ImageButton:RID_SCDLG_PIVOT_LAYOUT:RB_OUTAREA"; - Pos = MAP_APPFONT ( 256 , 218 ) ; + Pos = MAP_APPFONT ( 265 , 214 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; TabStop = TRUE ; Hide = TRUE ; @@ -243,8 +266,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_IGNEMPTYROWS { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_IGNEMPTYROWS"; - Pos = MAP_APPFONT ( 12 , 237 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 12 , 233 ) ; + Size = MAP_APPFONT ( 136 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "Ignore ~empty rows" ; @@ -252,8 +275,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_DETECTCAT { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_DETECTCAT"; - Pos = MAP_APPFONT ( 142 , 237 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 152 , 233 ) ; + Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Identify categories" ; @@ -261,8 +284,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_TOTALCOL { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_TOTALCOL"; - Pos = MAP_APPFONT ( 12 , 251 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 12 , 247 ) ; + Size = MAP_APPFONT ( 136 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "Total columns" ; @@ -270,8 +293,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_TOTALROW { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_TOTALROW"; - Pos = MAP_APPFONT ( 142 , 251 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 152 , 247 ) ; + Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Total rows" ; @@ -279,8 +302,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_FILTER { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_FILTER"; - Pos = MAP_APPFONT ( 12 , 265 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 12 , 261 ) ; + Size = MAP_APPFONT ( 136 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Add filter" ; @@ -288,8 +311,8 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT CheckBox BTN_DRILLDOWN { HelpID = "sc:CheckBox:RID_SCDLG_PIVOT_LAYOUT:BTN_DRILLDOWN"; - Pos = MAP_APPFONT ( 142 , 265 ) ; - Size = MAP_APPFONT ( 124 , 10 ) ; + Pos = MAP_APPFONT ( 152 , 261 ) ; + Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "Ena~ble drill to details" ; diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 794e7361338e..5ee9b320a04e 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -209,8 +209,8 @@ void ScDPFunctionListBox::FillFunctionNames() // ============================================================================ ScDPFunctionDlg::ScDPFunctionDlg( - Window* pParent, const ScDPLabelDataVec& rLabelVec, - const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) : + Window* pParent, const ScDPLabelDataVector& rLabelVec, + const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) : ModalDialog ( pParent, ScResId( RID_SCDLG_DPDATAFIELD ) ), maFlFunc ( this, ScResId( FL_FUNC ) ), maLbFunc ( this, ScResId( LB_FUNC ) ), @@ -267,7 +267,7 @@ DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const return aRef; } -void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) +void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) { // list box sal_uInt16 nFuncMask = (rFuncData.mnFuncMask == PIVOT_FUNC_NONE) ? PIVOT_FUNC_SUM : rFuncData.mnFuncMask; @@ -291,7 +291,7 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData& maLbBaseField.SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) ); // base field list box - for( ScDPLabelDataVec::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt ) + for( ScDPLabelDataVector::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt ) maLbBaseField.InsertEntry(aIt->getDisplayName()); // base item list box @@ -393,7 +393,7 @@ IMPL_LINK( ScDPFunctionDlg, DblClickHdl, MultiListBox*, EMPTYARG ) // ============================================================================ ScDPSubtotalDlg::ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj, - const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData, + const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) : ModalDialog ( pParent, ScResId( RID_SCDLG_PIVOTSUBT ) ), maFlSubt ( this, ScResId( FL_FUNC ) ), @@ -440,7 +440,7 @@ void ScDPSubtotalDlg::FillLabelData( ScDPLabelData& rLabelData ) const rLabelData.maShowInfo = maLabelData.maShowInfo; } -void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) +void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) { // field name maFtName.SetText(rLabelData.getDisplayName()); diff --git a/sc/source/ui/dbgui/pvglob.hxx b/sc/source/ui/dbgui/pvglob.hxx deleted file mode 100644 index 6b6526266035..000000000000 --- a/sc/source/ui/dbgui/pvglob.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SC_PVGLOB_HXX -#define SC_PVGLOB_HXX - -//------------------------------------------------------------------- - -class PivotGlobal -{ -public: - static long nObjHeight; - static long nObjWidth; - static long nSelSpace; -}; - - -#endif // SC_PVGLOB_HXX diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index 10134e696571..b43779ffa62b 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -28,19 +28,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -//---------------------------------------------------------------------------- - #include "pvlaydlg.hxx" -#include "dbdocfun.hxx" - -#include <sfx2/dispatch.hxx> -#include <vcl/msgbox.hxx> #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp> +#include <sfx2/dispatch.hxx> +#include <vcl/mnemonic.hxx> +#include <vcl/msgbox.hxx> + +#include "dbdocfun.hxx" #include "uiitems.hxx" #include "rangeutl.hxx" #include "document.hxx" @@ -48,8 +45,6 @@ #include "tabvwsh.hxx" #include "reffact.hxx" #include "scresid.hxx" -#include "pvglob.hxx" -//CHINA001 #include "pvfundlg.hxx" #include "globstr.hrc" #include "pivot.hrc" #include "dpobject.hxx" @@ -59,221 +54,140 @@ #include "sc.hrc" //CHINA001 #include "scabstdlg.hxx" //CHINA001 -using namespace com::sun::star; -using ::rtl::OUString; -using ::std::vector; - -//---------------------------------------------------------------------------- - -#define FSTR(index) aFuncNameArr[index-1] -#define STD_FORMAT SCA_VALID | SCA_TAB_3D \ - | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE -long PivotGlobal::nObjHeight = 0; // initialized with resource data -long PivotGlobal::nObjWidth = 0; -long PivotGlobal::nSelSpace = 0; +// ============================================================================ +using namespace ::com::sun::star; +using ::rtl::OUString; -//============================================================================ +// ============================================================================ namespace { -void lcl_FillToPivotField( PivotField& rPivotField, const ScDPFuncData& rFuncData ) -{ - rPivotField.nCol = rFuncData.mnCol; - rPivotField.nFuncMask = rFuncData.mnFuncMask; - rPivotField.maFieldRef = rFuncData.maFieldRef; -} +const sal_uInt16 STD_FORMAT = sal_uInt16( SCA_VALID | SCA_TAB_3D | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE ); -PointerStyle lclGetPointerForField( ScDPFieldType eType ) +OUString lclGetNameWithoutMnemonic( const FixedText& rFixedText ) { - switch( eType ) - { - case TYPE_PAGE: return POINTER_PIVOT_FIELD; - case TYPE_COL: return POINTER_PIVOT_COL; - case TYPE_ROW: return POINTER_PIVOT_ROW; - case TYPE_DATA: return POINTER_PIVOT_FIELD; - case TYPE_SELECT: return POINTER_PIVOT_FIELD; - } - return POINTER_ARROW; + return MnemonicGenerator::EraseAllMnemonicChars( rFixedText.GetText() ); } } // namespace -//============================================================================ - -//---------------------------------------------------------------------------- - -ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, - const ScDPObject& rDPObject ) - : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_PIVOT_LAYOUT ), - aFlLayout ( this, ScResId( FL_LAYOUT ) ), - aFtPage ( this, ScResId( FT_PAGE ) ), - aWndPage ( this, ScResId( WND_PAGE ), TYPE_PAGE, &aFtPage ), - aFtCol ( this, ScResId( FT_COL ) ), - aWndCol ( this, ScResId( WND_COL ), TYPE_COL, &aFtCol ), - aFtRow ( this, ScResId( FT_ROW ) ), - aWndRow ( this, ScResId( WND_ROW ), TYPE_ROW, &aFtRow ), - aFtData ( this, ScResId( FT_DATA ) ), - aWndData ( this, ScResId( WND_DATA ), TYPE_DATA, &aFtData ), - aWndSelect ( this, ScResId( WND_SELECT ), TYPE_SELECT, String(ScResId(STR_SELECT)) ), - aSlider ( this, ScResId( WND_HSCROLL ) ), - aFtInfo ( this, ScResId( FT_INFO ) ), - - aFlAreas ( this, ScResId( FL_OUTPUT ) ), - - aFtInArea ( this, ScResId( FT_INAREA) ), - aEdInPos ( this, ScResId( ED_INAREA) ), - aRbInPos ( this, ScResId( RB_INAREA ), &aEdInPos, this ), - - aLbOutPos ( this, ScResId( LB_OUTAREA ) ), - aFtOutArea ( this, ScResId( FT_OUTAREA ) ), - aEdOutPos ( this, this, ScResId( ED_OUTAREA ) ), - aRbOutPos ( this, ScResId( RB_OUTAREA ), &aEdOutPos, this ), - aBtnIgnEmptyRows( this, ScResId( BTN_IGNEMPTYROWS ) ), - aBtnDetectCat ( this, ScResId( BTN_DETECTCAT ) ), - aBtnTotalCol ( this, ScResId( BTN_TOTALCOL ) ), - aBtnTotalRow ( this, ScResId( BTN_TOTALROW ) ), - aBtnFilter ( this, ScResId( BTN_FILTER ) ), - aBtnDrillDown ( this, ScResId( BTN_DRILLDOWN ) ), - - aBtnOk ( this, ScResId( BTN_OK ) ), - aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aBtnRemove ( this, ScResId( BTN_REMOVE ) ), - aBtnOptions ( this, ScResId( BTN_OPTIONS ) ), - aBtnMore ( this, ScResId( BTN_MORE ) ), - - aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ), - aStrNewTable ( ScResId( SCSTR_NEWTABLE ) ), - - bIsDrag ( sal_False ), - - pEditActive ( NULL ), - - eLastActiveType ( TYPE_SELECT ), - nOffset ( 0 ), - // - xDlgDPObject ( new ScDPObject( rDPObject ) ), - pViewData ( ((ScTabViewShell*)SfxViewShell::Current())-> - GetViewData() ), - pDoc ( ((ScTabViewShell*)SfxViewShell::Current())-> - GetViewData()->GetDocument() ), - bRefInputMode ( sal_False ) -{ - xDlgDPObject->SetAlive( sal_True ); // needed to get structure information - xDlgDPObject->FillOldParam( thePivotData, sal_False ); - xDlgDPObject->FillLabelData( thePivotData ); - - Init(); - FreeResource(); -} - - -//---------------------------------------------------------------------------- - -ScDPLayoutDlg::~ScDPLayoutDlg() -{ - sal_uInt16 nEntries = aLbOutPos.GetEntryCount(); - sal_uInt16 i; - - for ( i=2; i<nEntries; i++ ) - delete (String*)aLbOutPos.GetEntryData( i ); -} - - -//---------------------------------------------------------------------------- - -ScDPFieldWindow& ScDPLayoutDlg::GetFieldWindow( ScDPFieldType eType ) -{ - switch( eType ) - { - case TYPE_PAGE: return aWndPage; - case TYPE_ROW: return aWndRow; - case TYPE_COL: return aWndCol; - case TYPE_DATA: return aWndData; - default: - { - // added to avoid warnings - } - } - return aWndSelect; -} - -void __EXPORT ScDPLayoutDlg::Init() -{ - DBG_ASSERT( pViewData && pDoc, - "Ctor-Initialisierung fehlgeschlagen!" ); - - aBtnRemove.SetClickHdl( LINK( this, ScDPLayoutDlg, ClickHdl ) ); - aBtnOptions.SetClickHdl( LINK( this, ScDPLayoutDlg, ClickHdl ) ); - - aFuncNameArr.reserve( FUNC_COUNT ); - for ( sal_uInt16 i = 0; i < FUNC_COUNT; ++i ) - aFuncNameArr.push_back( String( ScResId( i + 1 ) ) ); - - aBtnMore.AddWindow( &aFlAreas ); - aBtnMore.AddWindow( &aFtInArea ); - aBtnMore.AddWindow( &aEdInPos ); - aBtnMore.AddWindow( &aRbInPos ); - aBtnMore.AddWindow( &aFtOutArea ); - aBtnMore.AddWindow( &aLbOutPos ); - aBtnMore.AddWindow( &aEdOutPos ); - aBtnMore.AddWindow( &aRbOutPos ); - aBtnMore.AddWindow( &aBtnIgnEmptyRows ); - aBtnMore.AddWindow( &aBtnDetectCat ); - aBtnMore.AddWindow( &aBtnTotalCol ); - aBtnMore.AddWindow( &aBtnTotalRow ); - aBtnMore.AddWindow( &aBtnFilter ); - aBtnMore.AddWindow( &aBtnDrillDown ); - aBtnMore.SetClickHdl( LINK( this, ScDPLayoutDlg, MoreClickHdl ) ); - - { - Size aFieldSize( Window( this, ScResId( WND_FIELD ) ).GetSizePixel() ); - OHEIGHT = aFieldSize.Height(); - OWIDTH = aFieldSize.Width(); - } - SSPACE = Window( this, ScResId( WND_FIELD_SPACE ) ).GetSizePixel().Width(); - - CalcWndSizes(); - - aSelectArr.resize( MAX_LABELS ); - aPageArr.resize( MAX_PAGEFIELDS ); - aColArr.resize( MAX_FIELDS ); - aRowArr.resize( MAX_FIELDS ); - aDataArr.resize( MAX_FIELDS ); - - ScRange inRange; - String inString; - if (xDlgDPObject->GetSheetDesc()) - { - aEdInPos.Enable(); - aRbInPos.Enable(); - aOldRange = xDlgDPObject->GetSheetDesc()->aSourceRange; - aOldRange.Format( inString, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); - aEdInPos.SetText(inString); +// ============================================================================ + +ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, const ScDPObject& rDPObject ) : + + ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_PIVOT_LAYOUT ), + + maFlLayout( this, ScResId( FL_LAYOUT ) ), + maScrPage( this, ScResId( SCROLL_PAGE ) ), + maFtPage( this, ScResId( FT_PAGE ) ), + maWndPage( this, ScResId( WND_PAGE ), maScrPage, &maFtPage, lclGetNameWithoutMnemonic( maFtPage ), PIVOTFIELDTYPE_PAGE, HID_SC_DPLAY_PAGE, POINTER_PIVOT_FIELD, 5, 2, 1, 0 ), + maScrCol( this, ScResId( SCROLL_COL ) ), + maFtCol( this, ScResId( FT_COL ) ), + maWndCol( this, ScResId( WND_COL ), maScrCol, &maFtCol, lclGetNameWithoutMnemonic( maFtCol ), PIVOTFIELDTYPE_COL, HID_SC_DPLAY_COLUMN, POINTER_PIVOT_COL, 4, 2, 1, 0 ), + maScrRow( this, ScResId( SCROLL_ROW ) ), + maFtRow( this, ScResId( FT_ROW ) ), + maWndRow( this, ScResId( WND_ROW ), maScrRow, &maFtRow, lclGetNameWithoutMnemonic( maFtRow ), PIVOTFIELDTYPE_ROW, HID_SC_DPLAY_ROW, POINTER_PIVOT_ROW, 1, 8, 1, 0 ), + maScrData( this, ScResId( SCROLL_DATA ) ), + maFtData( this, ScResId( FT_DATA ) ), + maWndData( this, ScResId( WND_DATA ), maScrData, &maFtData, lclGetNameWithoutMnemonic( maFtData ), PIVOTFIELDTYPE_DATA, HID_SC_DPLAY_DATA, POINTER_PIVOT_FIELD, 1, 8, 4, 0 ), + maFlSelect( this, ScResId( FL_SELECT ) ), + maScrSelect( this, ScResId( WND_HSCROLL ) ), + maWndSelect( this, ScResId( WND_SELECT ), maScrSelect, 0, String( ScResId( STR_SELECT ) ), PIVOTFIELDTYPE_SELECT, HID_SC_DPLAY_SELECT, POINTER_PIVOT_FIELD, 2, 10, 1, 2 ), + maFtInfo( this, ScResId( FT_INFO ) ), + + maFlAreas( this, ScResId( FL_OUTPUT ) ), + maFtInArea( this, ScResId( FT_INAREA) ), + maEdInPos( this, ScResId( ED_INAREA) ), + maRbInPos( this, ScResId( RB_INAREA ), &maEdInPos, this ), + maLbOutPos( this, ScResId( LB_OUTAREA ) ), + maFtOutArea( this, ScResId( FT_OUTAREA ) ), + maEdOutPos( this, this, ScResId( ED_OUTAREA ) ), + maRbOutPos( this, ScResId( RB_OUTAREA ), &maEdOutPos, this ), + maBtnIgnEmptyRows( this, ScResId( BTN_IGNEMPTYROWS ) ), + maBtnDetectCat( this, ScResId( BTN_DETECTCAT ) ), + maBtnTotalCol( this, ScResId( BTN_TOTALCOL ) ), + maBtnTotalRow( this, ScResId( BTN_TOTALROW ) ), + maBtnFilter( this, ScResId( BTN_FILTER ) ), + maBtnDrillDown( this, ScResId( BTN_DRILLDOWN ) ), + + maBtnOk( this, ScResId( BTN_OK ) ), + maBtnCancel( this, ScResId( BTN_CANCEL ) ), + maBtnHelp( this, ScResId( BTN_HELP ) ), + maBtnRemove( this, ScResId( BTN_REMOVE ) ), + maBtnOptions( this, ScResId( BTN_OPTIONS ) ), + maBtnMore( this, ScResId( BTN_MORE ) ), + + mxDlgDPObject( new ScDPObject( rDPObject ) ), + mpViewData( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData() ), + mpDoc( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument() ), + mpFocusWindow( 0 ), + mpTrackingWindow( 0 ), + mpDropWindow( 0 ), + mpActiveEdit( 0 ), + mbRefInputMode( false ) +{ + DBG_ASSERT( mpViewData && mpDoc, "ScPivotLayoutDlg::ScPivotLayoutDlg - missing document or view data" ); + + mxDlgDPObject->SetAlive( true ); // needed to get structure information + mxDlgDPObject->FillOldParam( maPivotData ); + mxDlgDPObject->FillLabelData( maPivotData ); + + maBtnRemove.SetClickHdl( LINK( this, ScPivotLayoutDlg, ClickHdl ) ); + maBtnOptions.SetClickHdl( LINK( this, ScPivotLayoutDlg, ClickHdl ) ); + + // PIVOT_MAXFUNC defined in sc/inc/dpglobal.hxx + maFuncNames.reserve( PIVOT_MAXFUNC ); + for( sal_uInt16 i = 1; i <= PIVOT_MAXFUNC; ++i ) + maFuncNames.push_back( String( ScResId( i ) ) ); + + maBtnMore.AddWindow( &maFlAreas ); + maBtnMore.AddWindow( &maFtInArea ); + maBtnMore.AddWindow( &maEdInPos ); + maBtnMore.AddWindow( &maRbInPos ); + maBtnMore.AddWindow( &maFtOutArea ); + maBtnMore.AddWindow( &maLbOutPos ); + maBtnMore.AddWindow( &maEdOutPos ); + maBtnMore.AddWindow( &maRbOutPos ); + maBtnMore.AddWindow( &maBtnIgnEmptyRows ); + maBtnMore.AddWindow( &maBtnDetectCat ); + maBtnMore.AddWindow( &maBtnTotalCol ); + maBtnMore.AddWindow( &maBtnTotalRow ); + maBtnMore.AddWindow( &maBtnFilter ); + maBtnMore.AddWindow( &maBtnDrillDown ); + maBtnMore.SetClickHdl( LINK( this, ScPivotLayoutDlg, MoreClickHdl ) ); + + if( mxDlgDPObject->GetSheetDesc() ) + { + maEdInPos.Enable(); + maRbInPos.Enable(); + ScRange aRange = mxDlgDPObject->GetSheetDesc()->aSourceRange; + String aString; + aRange.Format( aString, SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention() ); + maEdInPos.SetText( aString ); } else { - /* Data is not reachable, so could be a remote database */ - aEdInPos.Disable(); - aRbInPos.Disable(); + // data is not reachable, so could be a remote database + maEdInPos.Disable(); + maRbInPos.Disable(); } - InitFields(); + // #i29203# align right border of page window with data window + long nPagePosX = maWndData.GetPosPixel().X() + maWndData.GetSizePixel().Width() - maWndPage.GetSizePixel().Width(); + maWndPage.SetPosPixel( Point( nPagePosX, maWndPage.GetPosPixel().Y() ) ); + maScrPage.SetPosPixel( Point( maScrData.GetPosPixel().X(), maScrPage.GetPosPixel().Y() ) ); + + InitFieldWindows(); - aLbOutPos .SetSelectHdl( LINK( this, ScDPLayoutDlg, SelAreaHdl ) ); - aEdOutPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdModifyHdl ) ); - aEdInPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdInModifyHdl ) ); - aBtnOk .SetClickHdl ( LINK( this, ScDPLayoutDlg, OkHdl ) ); - aBtnCancel.SetClickHdl ( LINK( this, ScDPLayoutDlg, CancelHdl ) ); - Link aLink = LINK( this, ScDPLayoutDlg, GetFocusHdl ); - if ( aEdInPos.IsEnabled() ) - // Once disabled it will never get enabled, so no need to handle focus. - aEdInPos.SetGetFocusHdl( aLink ); - aEdOutPos.SetGetFocusHdl( aLink ); + maLbOutPos.SetSelectHdl( LINK( this, ScPivotLayoutDlg, SelAreaHdl ) ); + maEdOutPos.SetModifyHdl( LINK( this, ScPivotLayoutDlg, EdOutModifyHdl ) ); + maEdInPos.SetModifyHdl( LINK( this, ScPivotLayoutDlg, EdInModifyHdl ) ); + maBtnOk.SetClickHdl( LINK( this, ScPivotLayoutDlg, OkHdl ) ); + maBtnCancel.SetClickHdl( LINK( this, ScPivotLayoutDlg, CancelHdl ) ); - if ( pViewData && pDoc ) + if( mpViewData && mpDoc ) { /* * Aus den RangeNames des Dokumentes werden nun die @@ -281,11 +195,11 @@ void __EXPORT ScDPLayoutDlg::Init() * um sinnvolle Bereiche handelt */ - aLbOutPos.Clear(); - aLbOutPos.InsertEntry( aStrUndefined, 0 ); - aLbOutPos.InsertEntry( aStrNewTable, 1 ); + maLbOutPos.Clear(); + maLbOutPos.InsertEntry( String( ScResId( SCSTR_UNDEFINED ) ), 0 ); + maLbOutPos.InsertEntry( String( ScResId( SCSTR_NEWTABLE ) ), 1 ); - ScAreaNameIterator aIter( pDoc ); + ScAreaNameIterator aIter( mpDoc ); String aName; ScRange aRange; String aRefStr; @@ -293,1531 +207,742 @@ void __EXPORT ScDPLayoutDlg::Init() { if ( !aIter.WasDBName() ) // hier keine DB-Bereiche ! { - sal_uInt16 nInsert = aLbOutPos.InsertEntry( aName ); + sal_uInt16 nInsert = maLbOutPos.InsertEntry( aName ); - aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention() ); - aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) ); + aRange.aStart.Format( aRefStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention() ); + maLbOutPos.SetEntryData( nInsert, new String( aRefStr ) ); } } } - if ( thePivotData.nTab != MAXTAB+1 ) + if ( maPivotData.nTab != MAXTAB+1 ) { String aStr; - ScAddress( thePivotData.nCol, - thePivotData.nRow, - thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() ); - aEdOutPos.SetText( aStr ); - EdModifyHdl(0); + ScAddress( maPivotData.nCol, + maPivotData.nRow, + maPivotData.nTab ).Format( aStr, STD_FORMAT, mpDoc, mpDoc->GetAddressConvention() ); + maEdOutPos.SetText( aStr ); + EdOutModifyHdl( 0 ); } else { - aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 ); + maLbOutPos.SelectEntryPos( maLbOutPos.GetEntryCount()-1 ); SelAreaHdl(NULL); } - aBtnIgnEmptyRows.Check( thePivotData.bIgnoreEmptyRows ); - aBtnDetectCat .Check( thePivotData.bDetectCategories ); - aBtnTotalCol .Check( thePivotData.bMakeTotalCol ); - aBtnTotalRow .Check( thePivotData.bMakeTotalRow ); - - if( const ScDPSaveData* pSaveData = xDlgDPObject->GetSaveData() ) - { - aBtnFilter.Check( pSaveData->GetFilterButton() ); - aBtnDrillDown.Check( pSaveData->GetDrillDown() ); - } - else - { - aBtnFilter.Check(); - aBtnDrillDown.Check(); - } - - aWndPage.SetHelpId( HID_SC_DPLAY_PAGE ); - aWndCol.SetHelpId( HID_SC_DPLAY_COLUMN ); - aWndRow.SetHelpId( HID_SC_DPLAY_ROW ); - aWndData.SetHelpId( HID_SC_DPLAY_DATA ); - aWndSelect.SetHelpId( HID_SC_DPLAY_SELECT ); - - InitFocus(); + maBtnIgnEmptyRows.Check( maPivotData.bIgnoreEmptyRows ); + maBtnDetectCat.Check( maPivotData.bDetectCategories ); + maBtnTotalCol.Check( maPivotData.bMakeTotalCol ); + maBtnTotalRow.Check( maPivotData.bMakeTotalRow ); -// SetDispatcherLock( sal_True ); // Modal-Modus einschalten - - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Disable(sal_False); //! allgemeine Methode im ScAnyRefDlg -} + const ScDPSaveData* pSaveData = mxDlgDPObject->GetSaveData(); + maBtnFilter.Check( !pSaveData || pSaveData->GetFilterButton() ); + maBtnDrillDown.Check( !pSaveData || pSaveData->GetDrillDown() ); + // child event listener handles field movement when keyboard shortcut is pressed + AddChildEventListener( LINK( this, ScPivotLayoutDlg, ChildEventListener ) ); + GrabFieldFocus( maWndSelect ); -//---------------------------------------------------------------------------- - -sal_Bool __EXPORT ScDPLayoutDlg::Close() -{ - return DoClose( ScPivotLayoutWrapper::GetChildWindowId() ); + FreeResource(); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::StateChanged( StateChangedType nStateChange ) +ScPivotLayoutDlg::~ScPivotLayoutDlg() { - ScAnyRefDlg::StateChanged( nStateChange ); + RemoveChildEventListener( LINK( this, ScPivotLayoutDlg, ChildEventListener ) ); - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - // #124828# Hiding the FixedTexts and clearing the tab stop style bits - // has to be done after assigning the mnemonics, but Paint is too late, - // because the test tool may send key events to the dialog when it isn't visible. - // Mnemonics are assigned in the Dialog::StateChanged for STATE_CHANGE_INITSHOW, - // so this can be done immediately afterwards. - - aWndPage.UseMnemonic(); - aWndCol.UseMnemonic(); - aWndRow.UseMnemonic(); - aWndData.UseMnemonic(); - } + for( sal_uInt16 i = 2, nEntries = maLbOutPos.GetEntryCount(); i < nEntries; ++i ) + delete (String*)maLbOutPos.GetEntryData( i ); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::InitWndSelect( const vector<ScDPLabelDataRef>& rLabels ) +ScDPLabelData* ScPivotLayoutDlg::GetLabelData( SCCOL nCol, size_t* pnIndex ) { - size_t nLabelCount = rLabels.size(); - if (nLabelCount > MAX_LABELS) - nLabelCount = MAX_LABELS; - size_t nLast = (nLabelCount > PAGE_SIZE) ? (PAGE_SIZE - 1) : (nLabelCount - 1); - - aLabelDataArr.clear(); - aLabelDataArr.reserve( nLabelCount ); - for ( size_t i=0; i < nLabelCount; i++ ) + ScDPLabelData* pLabelData = 0; + for( ScDPLabelDataVector::iterator aIt = maLabelData.begin(), aEnd = maLabelData.end(); !pLabelData && (aIt != aEnd); ++aIt ) { - aLabelDataArr.push_back(*rLabels[i]); - - if ( i <= nLast ) + if( aIt->mnCol == nCol ) { - aWndSelect.AddField(aLabelDataArr[i].getDisplayName(), i); - aSelectArr[i].reset( new ScDPFuncData( aLabelDataArr[i].mnCol, aLabelDataArr[i].mnFuncMask ) ); + pLabelData = &*aIt; + if( pnIndex ) + *pnIndex = aIt - maLabelData.begin(); } } + return pLabelData; } - -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::InitWnd( PivotField* pArr, long nCount, ScDPFieldType eType ) +String ScPivotLayoutDlg::GetFuncString( sal_uInt16& rnFuncMask, bool bIsValue ) { - if ( pArr && (eType != TYPE_SELECT) ) - { - ScDPFuncDataVec* pInitArr = NULL; - ScDPFieldWindow* pInitWnd = NULL; - sal_Bool bDataArr = sal_False; + String aStr; - switch ( eType ) + if( (rnFuncMask == PIVOT_FUNC_NONE) || (rnFuncMask == PIVOT_FUNC_AUTO) ) + { + if( bIsValue ) { - case TYPE_PAGE: - pInitArr = &aPageArr; - pInitWnd = &aWndPage; - break; - - case TYPE_COL: - pInitArr = &aColArr; - pInitWnd = &aWndCol; - break; - - case TYPE_ROW: - pInitArr = &aRowArr; - pInitWnd = &aWndRow; - break; - - case TYPE_DATA: - pInitArr = &aDataArr; - pInitWnd = &aWndData; - bDataArr = sal_True; - break; - default: - break; + aStr = GetFuncName( PIVOTSTR_SUM ); + rnFuncMask = PIVOT_FUNC_SUM; } - - if ( pInitArr && pInitWnd ) + else { - long j=0; - for ( long i=0; (i<nCount); i++ ) - { - SCCOL nCol = pArr[i].nCol; - sal_uInt16 nMask = pArr[i].nFuncMask; - - if ( nCol != PIVOT_DATA_FIELD ) - { - (*pInitArr)[j].reset( new ScDPFuncData( nCol, nMask, pArr[i].maFieldRef ) ); - - if ( !bDataArr ) - { - pInitWnd->AddField( GetLabelString( nCol ), j ); - } - else - { - ScDPLabelData* pData = GetLabelData( nCol ); - DBG_ASSERT( pData, "ScDPLabelData not found" ); - if (pData) - { - String aStr( GetFuncString( (*pInitArr)[j]->mnFuncMask, - pData->mbIsValue ) ); - - aStr += GetLabelString( nCol ); - pInitWnd->AddField( aStr, j ); - - pData->mnFuncMask = nMask; - } - } - ++j; - } - } -// Do not redraw here -> first the FixedText has to get its mnemonic char -// pInitWnd->Redraw(); - } + aStr = GetFuncName( PIVOTSTR_COUNT ); + rnFuncMask = PIVOT_FUNC_COUNT; + } + } + else if( rnFuncMask == PIVOT_FUNC_SUM ) aStr = GetFuncName( PIVOTSTR_SUM ); + else if( rnFuncMask == PIVOT_FUNC_COUNT ) aStr = GetFuncName( PIVOTSTR_COUNT ); + else if( rnFuncMask == PIVOT_FUNC_AVERAGE ) aStr = GetFuncName( PIVOTSTR_AVG ); + else if( rnFuncMask == PIVOT_FUNC_MAX ) aStr = GetFuncName( PIVOTSTR_MAX ); + else if( rnFuncMask == PIVOT_FUNC_MIN ) aStr = GetFuncName( PIVOTSTR_MIN ); + else if( rnFuncMask == PIVOT_FUNC_PRODUCT ) aStr = GetFuncName( PIVOTSTR_PROD ); + else if( rnFuncMask == PIVOT_FUNC_COUNT_NUM ) aStr = GetFuncName( PIVOTSTR_COUNT2 ); + else if( rnFuncMask == PIVOT_FUNC_STD_DEV ) aStr = GetFuncName( PIVOTSTR_DEV ); + else if( rnFuncMask == PIVOT_FUNC_STD_DEVP ) aStr = GetFuncName( PIVOTSTR_DEV2 ); + else if( rnFuncMask == PIVOT_FUNC_STD_VAR ) aStr = GetFuncName( PIVOTSTR_VAR ); + else if( rnFuncMask == PIVOT_FUNC_STD_VARP ) aStr = GetFuncName( PIVOTSTR_VAR2 ); + else + { + aStr = ScGlobal::GetRscString( STR_TABLE_ERGEBNIS ); + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ) ); } -} + return aStr; +} -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::InitFocus() +void ScPivotLayoutDlg::NotifyStartTracking( ScPivotFieldWindow& rSourceWindow ) { - if( aWndSelect.IsEmpty() ) - { - aBtnOk.GrabFocus(); - NotifyFieldFocus( TYPE_SELECT, sal_False ); - } - else - aWndSelect.GrabFocus(); + mpTrackingWindow = &rSourceWindow; + mpDropWindow = 0; + rSourceWindow.NotifyStartTracking(); + StartTracking( STARTTRACK_BUTTONREPEAT ); + SetPointer( Pointer( rSourceWindow.GetDropPointerStyle() ) ); } -void ScDPLayoutDlg::InitFields() +void ScPivotLayoutDlg::NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow ) { - InitWndSelect(thePivotData.maLabelArray); - InitWnd( thePivotData.aPageArr, static_cast<long>(thePivotData.nPageCount), TYPE_PAGE ); - InitWnd( thePivotData.aColArr, static_cast<long>(thePivotData.nColCount), TYPE_COL ); - InitWnd( thePivotData.aRowArr, static_cast<long>(thePivotData.nRowCount), TYPE_ROW ); - InitWnd( thePivotData.aDataArr, static_cast<long>(thePivotData.nDataCount), TYPE_DATA ); - - size_t nLabels = thePivotData.maLabelArray.size(); - aSlider.SetPageSize( PAGE_SIZE ); - aSlider.SetVisibleSize( PAGE_SIZE ); - aSlider.SetLineSize( LINE_SIZE ); - aSlider.SetRange( Range( 0, static_cast<long>(((nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE) ) ); - - if ( nLabels > PAGE_SIZE ) - { - aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) ); - aSlider.Show(); - } - else - aSlider.Hide(); -} + // nothing to do on double-click in selection window + if( rSourceWindow.GetType() == PIVOTFIELDTYPE_SELECT ) + return; -//---------------------------------------------------------------------------- + const ScPivotFuncData* pFuncData = rSourceWindow.GetSelectedFuncData(); + DBG_ASSERT( pFuncData, "ScPivotLayoutDlg::NotifyDoubleClick - invalid selection" ); + if( !pFuncData ) + return; -void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Point& rAtPos ) -{ - ScDPFuncData fData( *(aSelectArr[nFromIndex]) ); - size_t nAt = 0; - ScDPFieldWindow* toWnd = NULL; - ScDPFieldWindow* rmWnd1 = NULL; - ScDPFieldWindow* rmWnd2 = NULL; - ScDPFuncDataVec* toArr = NULL; - ScDPFuncDataVec* rmArr1 = NULL; - ScDPFuncDataVec* rmArr2 = NULL; - sal_Bool bDataArr = sal_False; - - switch ( eToType ) + ScDPLabelData* pLabelData = GetLabelData( pFuncData->mnCol ); + DBG_ASSERT( pLabelData, "ScPivotLayoutDlg::NotifyDoubleClick - missing label data" ); + if( !pLabelData ) + return; + + ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); + DBG_ASSERT( pFactory, "ScPivotLayoutDlg::NotifyDoubleClick - ScAbstractDialogFactory creation failed" ); + if( !pFactory ) + return; + + if( rSourceWindow.GetType() == PIVOTFIELDTYPE_DATA ) { - case TYPE_PAGE: - toWnd = &aWndPage; - rmWnd1 = &aWndRow; - rmWnd2 = &aWndCol; - toArr = &aPageArr; - rmArr1 = &aRowArr; - rmArr2 = &aColArr; - break; - - case TYPE_COL: - toWnd = &aWndCol; - rmWnd1 = &aWndPage; - rmWnd2 = &aWndRow; - toArr = &aColArr; - rmArr1 = &aPageArr; - rmArr2 = &aRowArr; - break; - - case TYPE_ROW: - toWnd = &aWndRow; - rmWnd1 = &aWndPage; - rmWnd2 = &aWndCol; - toArr = &aRowArr; - rmArr1 = &aPageArr; - rmArr2 = &aColArr; - break; - - case TYPE_DATA: - toWnd = &aWndData; - toArr = &aDataArr; - bDataArr = sal_True; - break; - - default: + ::std::auto_ptr< AbstractScDPFunctionDlg > xDlg( pFactory->CreateScDPFunctionDlg( + this, RID_SCDLG_DPDATAFIELD, maLabelData, *pLabelData, *pFuncData ) ); + if( xDlg->Execute() == RET_OK ) { - // added to avoid warnings + ScPivotFuncData aFuncData( *pFuncData ); + aFuncData.mnFuncMask = pLabelData->mnFuncMask = xDlg->GetFuncMask(); + aFuncData.maFieldRef = xDlg->GetFieldRef(); + rSourceWindow.ModifySelectedField( aFuncData ); } } - - bool bAllowed = IsOrientationAllowed( fData.mnCol, eToType ); - if ( bAllowed - && (toArr->back().get() == NULL) - && (!Contains( toArr, fData.mnCol, nAt )) ) + else { - // ggF. in anderem Fenster entfernen - if ( rmArr1 ) - { - if ( Contains( rmArr1, fData.mnCol, nAt ) ) - { - rmWnd1->DelField( nAt ); - Remove( rmArr1, nAt ); - } - } - if ( rmArr2 ) - { - if ( Contains( rmArr2, fData.mnCol, nAt ) ) - { - rmWnd2->DelField( nAt ); - Remove( rmArr2, nAt ); - } - } + // list of plain names of all data fields + ScDPNameVec aDataFieldNames; + maWndData.WriteFieldNames( aDataFieldNames ); + // allow to modify layout options for row fields, if multiple data fields exist, or if it is not the last row field + bool bLayout = (rSourceWindow.GetType() == PIVOTFIELDTYPE_ROW) && ((aDataFieldNames.size() > 1) || (rSourceWindow.GetSelectedIndex() + 1 < rSourceWindow.GetFieldCount())); - ScDPLabelData& rData = aLabelDataArr[nFromIndex+nOffset]; - size_t nAddedAt = 0; - - if ( !bDataArr ) - { - if ( toWnd->AddField( rData.getDisplayName(), - DlgPos2WndPos( rAtPos, *toWnd ), - nAddedAt ) ) - { - Insert( toArr, fData, nAddedAt ); - toWnd->GrabFocus(); - } - } - else + ::std::auto_ptr< AbstractScDPSubtotalDlg > xDlg( pFactory->CreateScDPSubtotalDlg( + this, RID_SCDLG_PIVOTSUBT, *mxDlgDPObject, *pLabelData, *pFuncData, aDataFieldNames, bLayout ) ); + if( xDlg->Execute() == RET_OK ) { - sal_uInt16 nMask = fData.mnFuncMask; - OUString aStr = GetFuncString( nMask, rData.mbIsValue ); - - aStr += rData.getDisplayName(); - - if ( toWnd->AddField( aStr, - DlgPos2WndPos( rAtPos, *toWnd ), - nAddedAt ) ) - { - fData.mnFuncMask = nMask; - Insert( toArr, fData, nAddedAt ); - toWnd->GrabFocus(); - } + xDlg->FillLabelData( *pLabelData ); + ScPivotFuncData aFuncData( *pFuncData ); + aFuncData.mnFuncMask = pLabelData->mnFuncMask; + rSourceWindow.ModifySelectedField( aFuncData ); } - } } +void ScPivotLayoutDlg::NotifyFieldRemoved( ScPivotFieldWindow& rSourceWindow ) +{ + // update focus: move to selection window, if source window is empty now + GrabFieldFocus( rSourceWindow ); +} -//---------------------------------------------------------------------------- +// protected ------------------------------------------------------------------ -void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPFieldType eToType, const Point& rAtPos ) +void ScPivotLayoutDlg::Tracking( const TrackingEvent& rTEvt ) { - if ( eFromType == TYPE_SELECT ) - AddField( nFromIndex, eToType, rAtPos ); - else if ( eFromType != eToType ) - { - ScDPFieldWindow* fromWnd = NULL; - ScDPFieldWindow* toWnd = NULL; - ScDPFieldWindow* rmWnd1 = NULL; - ScDPFieldWindow* rmWnd2 = NULL; - ScDPFuncDataVec* fromArr = NULL; - ScDPFuncDataVec* toArr = NULL; - ScDPFuncDataVec* rmArr1 = NULL; - ScDPFuncDataVec* rmArr2 = NULL; - size_t nAt = 0; - sal_Bool bDataArr = sal_False; - - switch ( eFromType ) - { - case TYPE_PAGE: - fromWnd = &aWndPage; - fromArr = &aPageArr; - break; - - case TYPE_COL: - fromWnd = &aWndCol; - fromArr = &aColArr; - break; - - case TYPE_ROW: - fromWnd = &aWndRow; - fromArr = &aRowArr; - break; - - case TYPE_DATA: - fromWnd = &aWndData; - fromArr = &aDataArr; - break; - - default: - { - // added to avoid warnings - } - } + DBG_ASSERT( mpTrackingWindow, "ScPivotLayoutDlg::Tracking - missing tracking source window" ); + if( !mpTrackingWindow ) + return; - switch ( eToType ) - { - case TYPE_PAGE: - toWnd = &aWndPage; - toArr = &aPageArr; - rmWnd1 = &aWndCol; - rmWnd2 = &aWndRow; - rmArr1 = &aColArr; - rmArr2 = &aRowArr; - break; - - case TYPE_COL: - toWnd = &aWndCol; - toArr = &aColArr; - rmWnd1 = &aWndPage; - rmWnd2 = &aWndRow; - rmArr1 = &aPageArr; - rmArr2 = &aRowArr; - break; - - case TYPE_ROW: - toWnd = &aWndRow; - toArr = &aRowArr; - rmWnd1 = &aWndPage; - rmWnd2 = &aWndCol; - rmArr1 = &aPageArr; - rmArr2 = &aColArr; - break; - - case TYPE_DATA: - toWnd = &aWndData; - toArr = &aDataArr; - bDataArr = sal_True; - break; - - default: - { - // added to avoid warnings - } - } + // find target window + const Point& rDialogPos = rTEvt.GetMouseEvent().GetPosPixel(); + ScPivotFieldWindow* pTargetWindow = dynamic_cast< ScPivotFieldWindow* >( FindWindow( rDialogPos ) ); - if ( fromArr && toArr && fromWnd && toWnd ) - { - ScDPFuncData fData( *((*fromArr)[nFromIndex]) ); + // check if the target orientation is allowed for this field + if( pTargetWindow && (mpTrackingWindow != pTargetWindow) && !IsInsertAllowed( *mpTrackingWindow, *pTargetWindow ) ) + pTargetWindow = 0; - bool bAllowed = IsOrientationAllowed( fData.mnCol, eToType ); - if ( bAllowed && Contains( fromArr, fData.mnCol, nAt ) ) - { - fromWnd->DelField( nAt ); - Remove( fromArr, nAt ); + // tracking from selection window: do not show "delete" mouse pointer + PointerStyle eTargetPointer = pTargetWindow ? pTargetWindow->GetDropPointerStyle() : + ((mpTrackingWindow->GetType() == PIVOTFIELDTYPE_SELECT) ? POINTER_NOTALLOWED : POINTER_PIVOT_DELETE); - if ( (toArr->back().get() == NULL) - && (!Contains( toArr, fData.mnCol, nAt )) ) - { - size_t nAddedAt = 0; - if ( !bDataArr ) - { - // ggF. in anderem Fenster entfernen - if ( rmArr1 ) - { - if ( Contains( rmArr1, fData.mnCol, nAt ) ) - { - rmWnd1->DelField( nAt ); - Remove( rmArr1, nAt ); - } - } - if ( rmArr2 ) - { - if ( Contains( rmArr2, fData.mnCol, nAt ) ) - { - rmWnd2->DelField( nAt ); - Remove( rmArr2, nAt ); - } - } + // after calculating pointer style, check if target is selection window + if( pTargetWindow && (pTargetWindow->GetType() == PIVOTFIELDTYPE_SELECT) ) + pTargetWindow = 0; - if ( toWnd->AddField( GetLabelString( fData.mnCol ), - DlgPos2WndPos( rAtPos, *toWnd ), - nAddedAt ) ) - { - Insert( toArr, fData, nAddedAt ); - toWnd->GrabFocus(); - } - } - else - { - String aStr; - sal_uInt16 nMask = fData.mnFuncMask; - aStr = GetFuncString( nMask ); - aStr += GetLabelString( fData.mnCol ); - - if ( toWnd->AddField( aStr, - DlgPos2WndPos( rAtPos, *toWnd ), - nAddedAt ) ) - { - fData.mnFuncMask = nMask; - Insert( toArr, fData, nAddedAt ); - toWnd->GrabFocus(); - } - } - } - } - } + // notify windows about tracking + if( mpDropWindow != pTargetWindow ) + { + // tracking window changed + if( mpDropWindow ) + mpDropWindow->NotifyEndTracking( ENDTRACKING_SUSPEND ); + if( pTargetWindow ) + pTargetWindow->NotifyStartTracking(); + mpDropWindow = pTargetWindow; } - else // -> eFromType == eToType + if( mpDropWindow ) + mpDropWindow->NotifyTracking( rDialogPos - pTargetWindow->GetPosPixel() ); + + // end tracking: move or remove field + if( rTEvt.IsTrackingEnded() ) { - ScDPFieldWindow* theWnd = NULL; - ScDPFuncDataVec* theArr = NULL; - size_t nAt = 0; - size_t nToIndex = 0; - Point aToPos; - sal_Bool bDataArr = sal_False; - - switch ( eFromType ) + bool bCancelled = rTEvt.IsTrackingCanceled(); + if( mpDropWindow ) { - case TYPE_PAGE: - theWnd = &aWndPage; - theArr = &aPageArr; - break; - - case TYPE_COL: - theWnd = &aWndCol; - theArr = &aColArr; - break; - - case TYPE_ROW: - theWnd = &aWndRow; - theArr = &aRowArr; - break; - - case TYPE_DATA: - theWnd = &aWndData; - theArr = &aDataArr; - bDataArr = sal_True; - break; - - default: + mpDropWindow->NotifyEndTracking( bCancelled ? ENDTRACKING_CANCEL : ENDTRACKING_DROP ); + if( !bCancelled ) { - // added to avoid warnings + size_t nInsertIndex = mpDropWindow->GetDropIndex( rDialogPos - mpDropWindow->GetPosPixel() ); + bool bMoved = MoveField( *mpTrackingWindow, *mpDropWindow, nInsertIndex, true ); + // focus drop window, if move was successful, otherwise back to source window + GrabFieldFocus( bMoved ? *mpDropWindow : *mpTrackingWindow ); } } - - ScDPFuncData fData( *((*theArr)[nFromIndex]) ); - - if ( Contains( theArr, fData.mnCol, nAt ) ) + else { - aToPos = DlgPos2WndPos( rAtPos, *theWnd ); - theWnd->GetExistingIndex( aToPos, nToIndex ); - - if ( nToIndex != nAt ) - { - size_t nAddedAt = 0; - - theWnd->DelField( nAt ); - Remove( theArr, nAt ); - - if ( !bDataArr ) - { - if ( theWnd->AddField( GetLabelString( fData.mnCol ), - aToPos, - nAddedAt ) ) - { - Insert( theArr, fData, nAddedAt ); - } - } - else - { - String aStr; - sal_uInt16 nMask = fData.mnFuncMask; - aStr = GetFuncString( nMask ); - aStr += GetLabelString( fData.mnCol ); - - if ( theWnd->AddField( aStr, - DlgPos2WndPos( rAtPos, *theWnd ), - nAddedAt ) ) - { - fData.mnFuncMask = nMask; - Insert( theArr, fData, nAddedAt ); - } - } - } + // drop target invalid (outside field windows): remove tracked field + if( !bCancelled ) + mpTrackingWindow->RemoveSelectedField(); + // focus source window (or another window, if it is empty now) + GrabFieldFocus( *mpTrackingWindow ); } + eTargetPointer = POINTER_ARROW; + if( mpTrackingWindow != mpDropWindow ) + mpTrackingWindow->NotifyEndTracking( ENDTRACKING_CANCEL ); + mpTrackingWindow = mpDropWindow = 0; } + SetPointer( eTargetPointer ); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::RemoveField( ScDPFieldType eFromType, size_t nIndex ) +void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { - ScDPFuncDataVec* pArr = NULL; - switch( eFromType ) + if( !mbRefInputMode || !mpActiveEdit ) + return; + + if( rRef.aStart != rRef.aEnd ) + RefInputStart( mpActiveEdit ); + + if( mpActiveEdit == &maEdInPos ) { - case TYPE_PAGE: pArr = &aPageArr; break; - case TYPE_COL: pArr = &aColArr; break; - case TYPE_ROW: pArr = &aRowArr; break; - case TYPE_DATA: pArr = &aDataArr; break; - default: - { - // added to avoid warnings - } + String aRefStr; + rRef.Format( aRefStr, SCR_ABS_3D, pDocP, pDocP->GetAddressConvention() ); + mpActiveEdit->SetRefString( aRefStr ); } - - if( pArr ) + else if( mpActiveEdit == &maEdOutPos ) { - ScDPFieldWindow& rWnd = GetFieldWindow( eFromType ); - rWnd.DelField( nIndex ); - Remove( pArr, nIndex ); - if( rWnd.IsEmpty() ) InitFocus(); + String aRefStr; + rRef.aStart.Format( aRefStr, STD_FORMAT, pDocP, pDocP->GetAddressConvention() ); + mpActiveEdit->SetRefString( aRefStr ); } } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::NotifyMouseButtonUp( const Point& rAt ) +sal_Bool ScPivotLayoutDlg::IsRefInputMode() const { - if ( bIsDrag ) - { - bIsDrag = sal_False; - - ScDPFieldType eDnDToType = TYPE_SELECT; - Point aPos = ScreenToOutputPixel( rAt ); - sal_Bool bDel = sal_False; - - if ( aRectPage.IsInside( aPos ) ) - { - eDnDToType = TYPE_PAGE; - bDel = sal_False; - } - else if ( aRectCol.IsInside( aPos ) ) - { - eDnDToType = TYPE_COL; - bDel = sal_False; - } - else if ( aRectRow.IsInside( aPos ) ) - { - eDnDToType = TYPE_ROW; - bDel = sal_False; - } - else if ( aRectData.IsInside( aPos ) ) - { - eDnDToType = TYPE_DATA; - bDel = sal_False; - } - else if ( aRectSelect.IsInside( aPos ) ) - { - eDnDToType = TYPE_SELECT; - bDel = sal_True; - } - else - bDel = sal_True; - - if ( bDel ) - RemoveField( eDnDFromType, nDnDFromIndex ); - else - MoveField( eDnDFromType, nDnDFromIndex, eDnDToType, aPos ); - } + return mbRefInputMode; } - -//---------------------------------------------------------------------------- - -PointerStyle ScDPLayoutDlg::NotifyMouseMove( const Point& rAt ) +void ScPivotLayoutDlg::SetActive() { - PointerStyle ePtr = POINTER_ARROW; - - if ( bIsDrag ) + if( mbRefInputMode ) { - Point aPos = ScreenToOutputPixel( rAt ); - ScDPFieldType eCheckTarget = TYPE_SELECT; - - if ( aRectPage.IsInside( aPos ) ) - eCheckTarget = TYPE_PAGE; - else if ( aRectCol.IsInside( aPos ) ) - eCheckTarget = TYPE_COL; - else if ( aRectRow.IsInside( aPos ) ) - eCheckTarget = TYPE_ROW; - else if ( aRectData.IsInside( aPos ) ) - eCheckTarget = TYPE_DATA; - else if ( eDnDFromType != TYPE_SELECT ) - ePtr = POINTER_PIVOT_DELETE; - else if ( aRectSelect.IsInside( aPos ) ) - ePtr = lclGetPointerForField( TYPE_SELECT ); - else - ePtr = POINTER_NOTALLOWED; + if( mpActiveEdit ) + mpActiveEdit->GrabFocus(); - if ( eCheckTarget != TYPE_SELECT ) - { - // check if the target orientation is allowed for this field - ScDPFuncDataVec* fromArr = NULL; - switch ( eDnDFromType ) - { - case TYPE_PAGE: fromArr = &aPageArr; break; - case TYPE_COL: fromArr = &aColArr; break; - case TYPE_ROW: fromArr = &aRowArr; break; - case TYPE_DATA: fromArr = &aDataArr; break; - case TYPE_SELECT: fromArr = &aSelectArr; break; - } - ScDPFuncData fData( *((*fromArr)[nDnDFromIndex]) ); - if (IsOrientationAllowed( fData.mnCol, eCheckTarget )) - ePtr = lclGetPointerForField( eCheckTarget ); - else - ePtr = POINTER_NOTALLOWED; - } + if( mpActiveEdit == &maEdInPos ) + EdInModifyHdl( 0 ); + else if( mpActiveEdit == &maEdOutPos ) + EdOutModifyHdl( 0 ); + } + else + { + GrabFocus(); } - return ePtr; + RefInputDone(); } - -//---------------------------------------------------------------------------- - -PointerStyle ScDPLayoutDlg::NotifyMouseButtonDown( ScDPFieldType eType, size_t nFieldIndex ) +sal_Bool ScPivotLayoutDlg::Close() { - bIsDrag = sal_True; - eDnDFromType = eType; - nDnDFromIndex = nFieldIndex; - return lclGetPointerForField( eType ); + return DoClose( ScPivotLayoutWrapper::GetChildWindowId() ); } +// private -------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex ) +ScPivotFieldWindow& ScPivotLayoutDlg::GetFieldWindow( ScPivotFieldType eFieldType ) { - ScDPFuncDataVec* pArr = NULL; - switch ( eType ) + switch( eFieldType ) { - case TYPE_PAGE: pArr = &aPageArr; break; - case TYPE_COL: pArr = &aColArr; break; - case TYPE_ROW: pArr = &aRowArr; break; - case TYPE_DATA: pArr = &aDataArr; break; - default: - { - // added to avoid warnings - } + case PIVOTFIELDTYPE_PAGE: return maWndPage; + case PIVOTFIELDTYPE_ROW: return maWndRow; + case PIVOTFIELDTYPE_COL: return maWndCol; + case PIVOTFIELDTYPE_DATA: return maWndData; + default:; } + return maWndSelect; +} - if ( pArr ) +bool ScPivotLayoutDlg::IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow ) +{ + if( rTargetWindow.GetType() != PIVOTFIELDTYPE_SELECT ) { - if ( nFieldIndex >= pArr->size() ) + const ScPivotFuncData* pSourceData = rSourceWindow.GetSelectedFuncData(); + ScDPLabelData* pLabelData = pSourceData ? GetLabelData( pSourceData->mnCol ) : 0; + DBG_ASSERT( pLabelData, "ScPivotLayoutDlg::IsInsertAllowed - label data not found" ); + if( pLabelData ) { - DBG_ERROR("invalid selection"); - return; - } - - size_t nArrPos = 0; - if( ScDPLabelData* pData = GetLabelData( (*pArr)[nFieldIndex]->mnCol, &nArrPos ) ) - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 - - switch ( eType ) + sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN; + switch( rTargetWindow.GetType() ) { - case TYPE_PAGE: - case TYPE_COL: - case TYPE_ROW: - { - // list of names of all data fields - std::vector< String > 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 ); - } - - bool bLayout = (eType == TYPE_ROW) && - ((aDataFieldNames.size() > 1) || ((nFieldIndex + 1 < pArr->size()) && (*pArr)[nFieldIndex+1].get())); - - AbstractScDPSubtotalDlg* pDlg = pFact->CreateScDPSubtotalDlg( - this, RID_SCDLG_PIVOTSUBT, - *xDlgDPObject, *pData, *(*pArr)[nFieldIndex], aDataFieldNames, bLayout ); - - if ( pDlg->Execute() == RET_OK ) - { - pDlg->FillLabelData( *pData ); - (*pArr)[nFieldIndex]->mnFuncMask = pData->mnFuncMask; - } - delete pDlg; - } - break; - - case TYPE_DATA: - { - AbstractScDPFunctionDlg* pDlg = pFact->CreateScDPFunctionDlg( - this, RID_SCDLG_DPDATAFIELD, - aLabelDataArr, *pData, *(*pArr)[nFieldIndex] ); - - if ( pDlg->Execute() == RET_OK ) - { - (*pArr)[nFieldIndex]->mnFuncMask = pData->mnFuncMask = pDlg->GetFuncMask(); - (*pArr)[nFieldIndex]->maFieldRef = pDlg->GetFieldRef(); - - String aStr( GetFuncString ( aDataArr[nFieldIndex]->mnFuncMask ) ); - aStr += GetLabelString( aDataArr[nFieldIndex]->mnCol ); - aWndData.SetFieldText( aStr, nFieldIndex ); - } - delete pDlg; - } - break; - - default: - { - // added to avoid warnings - } + case PIVOTFIELDTYPE_PAGE: eOrient = sheet::DataPilotFieldOrientation_PAGE; break; + case PIVOTFIELDTYPE_COL: eOrient = sheet::DataPilotFieldOrientation_COLUMN; break; + case PIVOTFIELDTYPE_ROW: eOrient = sheet::DataPilotFieldOrientation_ROW; break; + case PIVOTFIELDTYPE_DATA: eOrient = sheet::DataPilotFieldOrientation_DATA; break; + default: return false; } + return ScDPObject::IsOrientationAllowed( static_cast< sal_uInt16 >( eOrient ), pLabelData->mnFlags ); } } + return false; } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::NotifyFieldFocus( ScDPFieldType eType, sal_Bool bGotFocus ) +void ScPivotLayoutDlg::InitFieldWindows() { - /* Enable Remove/Options buttons on GetFocus in field window. - #107616# Enable them also, if dialog is deactivated (click into document). - The !IsActive() condition handles the case that a LoseFocus event of a - field window would follow the Deactivate event of this dialog. */ - sal_Bool bEnable = (bGotFocus || !IsActive()) && (eType != TYPE_SELECT); - - // #128113# The TestTool may set the focus into an empty field. - // Then the Remove/Options buttons must be disabled. - if ( bEnable && bGotFocus && GetFieldWindow( eType ).IsEmpty() ) - bEnable = sal_False; - - aBtnRemove.Enable( bEnable ); - aBtnOptions.Enable( bEnable ); - if( bGotFocus ) - eLastActiveType = eType; + maLabelData = maPivotData.maLabelArray; + maWndSelect.ReadDataLabels( maLabelData ); + maWndPage.ReadPivotFields( maPivotData.maPageArr ); + maWndCol.ReadPivotFields( maPivotData.maColArr ); + maWndRow.ReadPivotFields( maPivotData.maRowArr ); + maWndData.ReadPivotFields( maPivotData.maDataArr ); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::NotifyMoveField( ScDPFieldType eToType ) +void ScPivotLayoutDlg::GrabFieldFocus( ScPivotFieldWindow& rFieldWindow ) { - ScDPFieldWindow& rWnd = GetFieldWindow( eLastActiveType ); - if( (eToType != TYPE_SELECT) && !rWnd.IsEmpty() ) + if( rFieldWindow.IsEmpty() ) { - MoveField( eLastActiveType, rWnd.GetSelectedField(), eToType, GetFieldWindow( eToType ).GetLastPosition() ); - if( rWnd.IsEmpty() ) - NotifyFieldFocus( eToType, sal_True ); + if( maWndSelect.IsEmpty() ) + maBtnOk.GrabFocus(); else - rWnd.GrabFocus(); - if( eLastActiveType == TYPE_SELECT ) - aWndSelect.SelectNext(); + maWndSelect.GrabFocus(); } else - InitFocus(); + rFieldWindow.GrabFocus(); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::NotifyRemoveField( ScDPFieldType eType, size_t nFieldIndex ) -{ - if( eType != TYPE_SELECT ) - RemoveField( eType, nFieldIndex ); -} - -//---------------------------------------------------------------------------- +namespace { -sal_Bool ScDPLayoutDlg::NotifyMoveSlider( sal_uInt16 nKeyCode ) +void lclFindFieldWindow( ScPivotFieldWindow*& rpFieldWindow, const ScPivotFuncData*& rpFuncData, size_t& rnFieldIndex, ScPivotFieldWindow& rFieldWindow ) { - long nOldPos = aSlider.GetThumbPos(); - switch( nKeyCode ) + ScPivotFuncDataEntry aEntry = rFieldWindow.FindFuncDataByCol( rpFuncData->mnCol ); + if( aEntry.first ) { - case KEY_HOME: aSlider.DoScroll( 0 ); break; - case KEY_END: aSlider.DoScroll( aSlider.GetRangeMax() ); break; - case KEY_UP: - case KEY_LEFT: aSlider.DoScrollAction( SCROLL_LINEUP ); break; - case KEY_DOWN: - case KEY_RIGHT: aSlider.DoScrollAction( SCROLL_LINEDOWN ); break; + rpFieldWindow = &rFieldWindow; + rpFuncData = aEntry.first; + rnFieldIndex = aEntry.second; } - return nOldPos != aSlider.GetThumbPos(); } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::Deactivate() -{ - /* #107616# If the dialog has been deactivated (click into document), the LoseFocus - event from field window disables Remove/Options buttons. Re-enable them here by - simulating a GetFocus event. Event order of LoseFocus and Deactivate is not important. - The last event will enable the buttons in both cases (see NotifyFieldFocus). */ - NotifyFieldFocus( eLastActiveType, sal_True ); -} - -//---------------------------------------------------------------------------- +} // namespace -sal_Bool ScDPLayoutDlg::Contains( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt ) +bool ScPivotLayoutDlg::MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting ) { - if ( !pArr ) - return sal_False; - - sal_Bool bFound = sal_False; - size_t i = 0; + // move inside the same window + if( &rSourceWindow == &rTargetWindow ) + return bMoveExisting && rTargetWindow.MoveSelectedField( nInsertIndex ); - while ( (i<pArr->size()) && ((*pArr)[i].get() != NULL) && !bFound ) + // do not insert if not supported by target window + if( !IsInsertAllowed( rSourceWindow, rTargetWindow ) ) { - bFound = ((*pArr)[i]->mnCol == nCol); - if ( bFound ) - nAt = i; - i++; + rSourceWindow.RemoveSelectedField(); + return false; } - return bFound; -} - - -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::Remove( ScDPFuncDataVec* pArr, size_t nAt ) -{ - if ( !pArr || (nAt>=pArr->size()) ) - return; - - pArr->erase( pArr->begin() + nAt ); - pArr->push_back( ScDPFuncDataRef() ); -} - - -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::Insert( ScDPFuncDataVec* pArr, const ScDPFuncData& rFData, size_t nAt ) -{ - if ( !pArr || (nAt>=pArr->size()) ) - return; - - if ( (*pArr)[nAt].get() == NULL ) - { - (*pArr)[nAt].reset( new ScDPFuncData( rFData ) ); - } - else + // move from one window to another window + if( const ScPivotFuncData* pSourceData = rSourceWindow.GetSelectedFuncData() ) { - if ( pArr->back().get() == NULL ) // mind. ein Slot frei? + // move to page/col/row window: try to find existing field in another window + ScPivotFieldWindow* pSourceWindow = &rSourceWindow; + size_t nSourceIndex = rSourceWindow.GetSelectedIndex(); + if( rTargetWindow.GetType() != PIVOTFIELDTYPE_DATA ) { - pArr->insert( pArr->begin() + nAt, ScDPFuncDataRef( new ScDPFuncData( rFData ) ) ); - pArr->erase( pArr->end() - 1 ); + lclFindFieldWindow( pSourceWindow, pSourceData, nSourceIndex, maWndPage ); + lclFindFieldWindow( pSourceWindow, pSourceData, nSourceIndex, maWndCol ); + lclFindFieldWindow( pSourceWindow, pSourceData, nSourceIndex, maWndRow ); } - } -} + // found in target window: move to new position + if( pSourceWindow == &rTargetWindow ) + return bMoveExisting && pSourceWindow->MoveField( nSourceIndex, nInsertIndex ); -//---------------------------------------------------------------------------- + // insert field into target window + rTargetWindow.InsertField( nInsertIndex, *pSourceData ); + // remove field from source window + pSourceWindow->RemoveField( nSourceIndex ); + // remove field from data window, if it is the original source + if( (rSourceWindow.GetType() == PIVOTFIELDTYPE_DATA) && (pSourceWindow->GetType() != PIVOTFIELDTYPE_DATA) ) + rSourceWindow.RemoveSelectedField(); -ScDPLabelData* ScDPLayoutDlg::GetLabelData( SCsCOL nCol, size_t* pnPos ) -{ - ScDPLabelData* pData = 0; - for( ScDPLabelDataVec::iterator aIt = aLabelDataArr.begin(), aEnd = aLabelDataArr.end(); !pData && (aIt != aEnd); ++aIt ) - { - if( aIt->mnCol == nCol ) - { - pData = &*aIt; - if( pnPos ) *pnPos = aIt - aLabelDataArr.begin(); - } + return true; } - return pData; -} - -//---------------------------------------------------------------------------- - -String ScDPLayoutDlg::GetLabelString( SCsCOL nCol ) -{ - ScDPLabelData* pData = GetLabelData( nCol ); - DBG_ASSERT( pData, "LabelData not found" ); - if (pData) - return pData->getDisplayName(); - return String(); + return false; } -//---------------------------------------------------------------------------- +// handlers ------------------------------------------------------------------- -bool ScDPLayoutDlg::IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType ) +IMPL_LINK( ScPivotLayoutDlg, ClickHdl, PushButton *, pBtn ) { - bool bAllowed = true; - ScDPLabelData* pData = GetLabelData( nCol ); - DBG_ASSERT( pData, "LabelData not found" ); - if (pData) + if( mpFocusWindow ) { - sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN; - switch (eType) - { - case TYPE_PAGE: eOrient = sheet::DataPilotFieldOrientation_PAGE; break; - case TYPE_COL: eOrient = sheet::DataPilotFieldOrientation_COLUMN; break; - case TYPE_ROW: eOrient = sheet::DataPilotFieldOrientation_ROW; break; - case TYPE_DATA: eOrient = sheet::DataPilotFieldOrientation_DATA; break; - case TYPE_SELECT: eOrient = sheet::DataPilotFieldOrientation_HIDDEN; break; - } - bAllowed = ScDPObject::IsOrientationAllowed( (sal_uInt16)eOrient, pData->mnFlags ); - } - return bAllowed; -} - -//---------------------------------------------------------------------------- - -String ScDPLayoutDlg::GetFuncString( sal_uInt16& rFuncMask, sal_Bool bIsValue ) -{ - String aStr; + /* Raising sub dialogs (from the NotifyDoubleClick function) triggers + VCL child window focus events from this sub dialog which may + invalidate the member mpFocusWindow pointing to the target field + window. This would cause a crash with the following call to the + GrabFieldFocus function, if mpFocusWindow is used directly. */ + ScPivotFieldWindow& rTargetWindow = *mpFocusWindow; - if ( rFuncMask == PIVOT_FUNC_NONE - || rFuncMask == PIVOT_FUNC_AUTO ) - { - if ( bIsValue ) + if( pBtn == &maBtnRemove ) { - aStr = FSTR(PIVOTSTR_SUM); - rFuncMask = PIVOT_FUNC_SUM; + rTargetWindow.RemoveSelectedField(); + // focus back to field window + GrabFieldFocus( rTargetWindow ); } - else + else if( pBtn == &maBtnOptions ) { - aStr = FSTR(PIVOTSTR_COUNT); - rFuncMask = PIVOT_FUNC_COUNT; + NotifyDoubleClick( rTargetWindow ); + // focus back to field window + GrabFieldFocus( rTargetWindow ); } } - else if ( rFuncMask == PIVOT_FUNC_SUM ) aStr = FSTR(PIVOTSTR_SUM); - else if ( rFuncMask == PIVOT_FUNC_COUNT ) aStr = FSTR(PIVOTSTR_COUNT); - else if ( rFuncMask == PIVOT_FUNC_AVERAGE ) aStr = FSTR(PIVOTSTR_AVG); - else if ( rFuncMask == PIVOT_FUNC_MAX ) aStr = FSTR(PIVOTSTR_MAX); - else if ( rFuncMask == PIVOT_FUNC_MIN ) aStr = FSTR(PIVOTSTR_MIN); - else if ( rFuncMask == PIVOT_FUNC_PRODUCT ) aStr = FSTR(PIVOTSTR_PROD); - else if ( rFuncMask == PIVOT_FUNC_COUNT_NUM ) aStr = FSTR(PIVOTSTR_COUNT2); - else if ( rFuncMask == PIVOT_FUNC_STD_DEV ) aStr = FSTR(PIVOTSTR_DEV); - else if ( rFuncMask == PIVOT_FUNC_STD_DEVP ) aStr = FSTR(PIVOTSTR_DEV2); - else if ( rFuncMask == PIVOT_FUNC_STD_VAR ) aStr = FSTR(PIVOTSTR_VAR); - else if ( rFuncMask == PIVOT_FUNC_STD_VARP ) aStr = FSTR(PIVOTSTR_VAR2); - else - { - aStr = ScGlobal::GetRscString( STR_TABLE_ERGEBNIS ); - aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " - " )); - } - - return aStr; -} - - -//---------------------------------------------------------------------------- - -Point ScDPLayoutDlg::DlgPos2WndPos( const Point& rPt, Window& rWnd ) -{ - Point aWndPt( rPt ); - aWndPt.X() = rPt.X()-rWnd.GetPosPixel().X(); - aWndPt.Y() = rPt.Y()-rWnd.GetPosPixel().Y(); - - return aWndPt; -} - - -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::CalcWndSizes() -{ - // row/column/data area sizes - aWndPage.SetSizePixel( Size( MAX_PAGEFIELDS * OWIDTH / 2, 2 * OHEIGHT ) ); - aWndRow.SetSizePixel( Size( OWIDTH, MAX_FIELDS * OHEIGHT ) ); - aWndCol.SetSizePixel( Size( MAX_FIELDS * OWIDTH / 2, 2 * OHEIGHT ) ); - aWndData.SetSizePixel( Size( MAX_FIELDS * OWIDTH / 2, MAX_FIELDS * OHEIGHT ) ); - - // #i29203# align right border of page window with data window - long nDataPosX = aWndData.GetPosPixel().X() + aWndData.GetSizePixel().Width(); - aWndPage.SetPosPixel( Point( nDataPosX - aWndPage.GetSizePixel().Width(), aWndPage.GetPosPixel().Y() ) ); - - // selection area - aWndSelect.SetSizePixel( Size( - 2 * OWIDTH + SSPACE, LINE_SIZE * OHEIGHT + (LINE_SIZE - 1) * SSPACE ) ); - - // scroll bar - Point aSliderPos( aWndSelect.GetPosPixel() ); - Size aSliderSize( aWndSelect.GetSizePixel() ); - aSliderPos.Y() += aSliderSize.Height() + SSPACE; - aSliderSize.Height() = GetSettings().GetStyleSettings().GetScrollBarSize(); - aSlider.SetPosSizePixel( aSliderPos, aSliderSize ); - - aRectPage = Rectangle( aWndPage.GetPosPixel(), aWndPage.GetSizePixel() ); - aRectRow = Rectangle( aWndRow.GetPosPixel(), aWndRow.GetSizePixel() ); - aRectCol = Rectangle( aWndCol.GetPosPixel(), aWndCol.GetSizePixel() ); - aRectData = Rectangle( aWndData.GetPosPixel(), aWndData.GetSizePixel() ); - aRectSelect = Rectangle( aWndSelect.GetPosPixel(), aWndSelect.GetSizePixel() ); -} - - -//---------------------------------------------------------------------------- - -sal_Bool ScDPLayoutDlg::GetPivotArrays( PivotField* pPageArr, - PivotField* pColArr, - PivotField* pRowArr, - PivotField* pDataArr, - sal_uInt16& rPageCount, - sal_uInt16& rColCount, - sal_uInt16& rRowCount, - sal_uInt16& rDataCount ) -{ - sal_Bool bFit = sal_True; - sal_uInt16 i=0; - - for ( i=0; (i<aDataArr.size()) && (aDataArr[i].get() != NULL ); i++ ) - lcl_FillToPivotField( pDataArr[i], *aDataArr[i] ); - rDataCount = i; - - for ( i=0; (i<aPageArr.size()) && (aPageArr[i].get() != NULL ); i++ ) - lcl_FillToPivotField( pPageArr[i], *aPageArr[i] ); - rPageCount = i; - - for ( i=0; (i<aColArr.size()) && (aColArr[i].get() != NULL ); i++ ) - lcl_FillToPivotField( pColArr[i], *aColArr[i] ); - rColCount = i; - - for ( i=0; (i<aRowArr.size()) && (aRowArr[i].get() != NULL ); i++ ) - lcl_FillToPivotField( pRowArr[i], *aRowArr[i] ); - rRowCount = i; - - if ( rRowCount < aRowArr.size() ) - pRowArr[rRowCount++].nCol = PIVOT_DATA_FIELD; - else if ( rColCount < aColArr.size() ) - pColArr[rColCount++].nCol = PIVOT_DATA_FIELD; - else - bFit = sal_False; // kein Platz fuer Datenfeld - - return bFit; -} - -void ScDPLayoutDlg::UpdateSrcRange() -{ - String theCurPosStr = aEdInPos.GetText(); - sal_uInt16 nResult = ScRange().Parse(theCurPosStr, pDoc, pDoc->GetAddressConvention()); - - if ( SCA_VALID != (nResult & SCA_VALID) ) - // invalid source range. - return; - - ScRefAddress start, end; - ConvertDoubleRef(pDoc, theCurPosStr, 1, start, end, pDoc->GetAddressConvention()); - ScRange aNewRange(start.GetAddress(), end.GetAddress()); - ScSheetSourceDesc inSheet = *xDlgDPObject->GetSheetDesc(); - - if (inSheet.aSourceRange == aNewRange) - // new range is identical to the current range. Nothing to do. - return; - - ScTabViewShell * pTabViewShell = pViewData->GetViewShell(); - inSheet.aSourceRange = aNewRange; - xDlgDPObject->SetSheetDesc(inSheet); - xDlgDPObject->FillOldParam( thePivotData, sal_False ); - xDlgDPObject->FillLabelData(thePivotData); - - pTabViewShell->SetDialogDPObject(xDlgDPObject.get()); - aLabelDataArr.clear(); - aWndSelect.ClearFields(); - aWndData.ClearFields(); - aWndRow.ClearFields(); - aWndCol.ClearFields(); - aWndPage.ClearFields(); - - for (size_t i = 0; i < MAX_LABELS; ++i) - aSelectArr[i].reset(); - - for (size_t i = 0; i < MAX_FIELDS; ++i) - { - aRowArr[i].reset(); - aColArr[i].reset(); - aDataArr[i].reset(); - } - - for (size_t i = 0; i < MAX_PAGEFIELDS; ++i) - aPageArr[i].reset(); - - InitFields(); + return 0; } -//---------------------------------------------------------------------------- - -void ScDPLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) +IMPL_LINK( ScPivotLayoutDlg, OkHdl, OKButton *, EMPTYARG ) { - if ( !bRefInputMode || !pEditActive ) - return; + String aOutPosStr = maEdOutPos.GetText(); + ScAddress aAdrDest; + bool bToNewTable = maLbOutPos.GetSelectEntryPos() == 1; + sal_uInt16 nResult = !bToNewTable ? aAdrDest.Parse( aOutPosStr, mpDoc, mpDoc->GetAddressConvention() ) : 0; - if ( rRef.aStart != rRef.aEnd ) - RefInputStart( pEditActive ); - - if ( pEditActive == &aEdInPos ) - { - String aRefStr; - rRef.Format( aRefStr, SCR_ABS_3D, pDocP, pDocP->GetAddressConvention() ); - pEditActive->SetRefString( aRefStr ); - } - else if ( pEditActive == &aEdOutPos ) + if( bToNewTable || ((aOutPosStr.Len() > 0) && ((nResult & SCA_VALID) == SCA_VALID)) ) { - String aRefStr; - rRef.aStart.Format( aRefStr, STD_FORMAT, pDocP, pDocP->GetAddressConvention() ); - pEditActive->SetRefString( aRefStr ); - } -} + ScPivotFieldVector aPageFields, aColFields, aRowFields, aDataFields; + maWndPage.WritePivotFields( aPageFields ); + maWndCol.WritePivotFields( aColFields ); + maWndRow.WritePivotFields( aRowFields ); + maWndData.WritePivotFields( aDataFields ); + // TODO: handle data field in dialog field windows? + aRowFields.resize( aRowFields.size() + 1 ); + aRowFields.back().nCol = PIVOT_DATA_FIELD; -//---------------------------------------------------------------------------- + ScDPSaveData* pOldSaveData = mxDlgDPObject->GetSaveData(); -void ScDPLayoutDlg::SetActive() -{ - if ( bRefInputMode ) - { - if ( pEditActive ) - pEditActive->GrabFocus(); + ScRange aOutRange( aAdrDest ); // bToNewTable is passed separately - if ( pEditActive == &aEdInPos ) - EdInModifyHdl( NULL ); - else if ( pEditActive == &aEdOutPos ) - EdModifyHdl( NULL ); - } - else - { - GrabFocus(); - } + ScDPSaveData aSaveData; + aSaveData.SetIgnoreEmptyRows( maBtnIgnEmptyRows.IsChecked() ); + aSaveData.SetRepeatIfEmpty( maBtnDetectCat.IsChecked() ); + aSaveData.SetColumnGrand( maBtnTotalCol.IsChecked() ); + aSaveData.SetRowGrand( maBtnTotalRow.IsChecked() ); + aSaveData.SetFilterButton( maBtnFilter.IsChecked() ); + aSaveData.SetDrillDown( maBtnDrillDown.IsChecked() ); - RefInputDone(); -} + uno::Reference< sheet::XDimensionsSupplier > xSource = mxDlgDPObject->GetSource(); -//---------------------------------------------------------------------------- -// Handler: -//---------------------------------------------------------------------------- + ScDPObject::ConvertOrientation( aSaveData, aPageFields, sheet::DataPilotFieldOrientation_PAGE, 0, 0, 0, xSource, false ); + ScDPObject::ConvertOrientation( aSaveData, aColFields, sheet::DataPilotFieldOrientation_COLUMN, 0, 0, 0, xSource, false ); + ScDPObject::ConvertOrientation( aSaveData, aRowFields, sheet::DataPilotFieldOrientation_ROW, 0, 0, 0, xSource, false ); + ScDPObject::ConvertOrientation( aSaveData, aDataFields, sheet::DataPilotFieldOrientation_DATA, 0, 0, 0, xSource, false, &aColFields, &aRowFields, &aPageFields ); -IMPL_LINK( ScDPLayoutDlg, ClickHdl, PushButton *, pBtn ) -{ - if( pBtn == &aBtnRemove ) - { - ScDPFieldWindow& rWnd = GetFieldWindow( eLastActiveType ); - RemoveField( eLastActiveType, rWnd.GetSelectedField() ); - if( !rWnd.IsEmpty() ) rWnd.GrabFocus(); - } - else if( pBtn == &aBtnOptions ) - { - ScDPFieldWindow& rWnd = GetFieldWindow( eLastActiveType ); - NotifyDoubleClick( eLastActiveType, rWnd.GetSelectedField() ); - rWnd.GrabFocus(); - } - return 0; -} - -//---------------------------------------------------------------------------- - -IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG ) -{ - String aOutPosStr( aEdOutPos.GetText() ); - ScAddress aAdrDest; - sal_Bool bToNewTable = (aLbOutPos.GetSelectEntryPos() == 1); - sal_uInt16 nResult = !bToNewTable ? aAdrDest.Parse( aOutPosStr, pDoc, pDoc->GetAddressConvention() ) : 0; - - if ( bToNewTable - || ( (aOutPosStr.Len() > 0) && (SCA_VALID == (nResult & SCA_VALID)) ) ) - { - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); - - ScPivotParam theOutParam; - PivotPageFieldArr aPageFieldArr; - PivotFieldArr aColFieldArr; - PivotFieldArr aRowFieldArr; - PivotFieldArr aDataFieldArr; - sal_uInt16 nPageCount; - sal_uInt16 nColCount; - sal_uInt16 nRowCount; - sal_uInt16 nDataCount; - - sal_Bool bFit = GetPivotArrays( aPageFieldArr, aColFieldArr, aRowFieldArr, aDataFieldArr, - nPageCount, nColCount, nRowCount, nDataCount ); - if ( bFit ) + for( ScDPLabelDataVector::const_iterator aIt = maLabelData.begin(), aEnd = maLabelData.end(); aIt != aEnd; ++aIt ) { - ScDPSaveData* pOldSaveData = xDlgDPObject->GetSaveData(); - - ScRange aOutRange( aAdrDest ); // bToNewTable is passed separately - - ScDPSaveData aSaveData; - aSaveData.SetIgnoreEmptyRows( aBtnIgnEmptyRows.IsChecked() ); - aSaveData.SetRepeatIfEmpty( aBtnDetectCat.IsChecked() ); - aSaveData.SetColumnGrand( aBtnTotalCol.IsChecked() ); - aSaveData.SetRowGrand( aBtnTotalRow.IsChecked() ); - aSaveData.SetFilterButton( aBtnFilter.IsChecked() ); - aSaveData.SetDrillDown( aBtnDrillDown.IsChecked() ); - - uno::Reference<sheet::XDimensionsSupplier> xSource = xDlgDPObject->GetSource(); - - ScDPObject::ConvertOrientation( aSaveData, aPageFieldArr, nPageCount, - sheet::DataPilotFieldOrientation_PAGE, NULL, 0, 0, xSource, sal_False ); - ScDPObject::ConvertOrientation( aSaveData, aColFieldArr, nColCount, - sheet::DataPilotFieldOrientation_COLUMN, NULL, 0, 0, xSource, sal_False ); - ScDPObject::ConvertOrientation( aSaveData, aRowFieldArr, nRowCount, - sheet::DataPilotFieldOrientation_ROW, NULL, 0, 0, xSource, sal_False ); - ScDPObject::ConvertOrientation( aSaveData, aDataFieldArr, nDataCount, - sheet::DataPilotFieldOrientation_DATA, NULL, 0, 0, xSource, sal_False, - aColFieldArr, nColCount, aRowFieldArr, nRowCount, aPageFieldArr, nPageCount ); - - for( ScDPLabelDataVec::const_iterator aIt = aLabelDataArr.begin(), aEnd = aLabelDataArr.end(); aIt != aEnd; ++aIt ) + if( ScDPSaveDimension* pDim = aSaveData.GetExistingDimensionByName( aIt->maName ) ) { - if( ScDPSaveDimension* pDim = aSaveData.GetExistingDimensionByName( aIt->maName ) ) + pDim->SetUsedHierarchy( aIt->mnUsedHier ); + pDim->SetShowEmpty( aIt->mbShowAll ); + pDim->SetSortInfo( &aIt->maSortInfo ); + pDim->SetLayoutInfo( &aIt->maLayoutInfo ); + pDim->SetAutoShowInfo( &aIt->maShowInfo ); + ScDPSaveDimension* pOldDim = NULL; + if (pOldSaveData) { - pDim->SetUsedHierarchy( aIt->mnUsedHier ); - pDim->SetShowEmpty( aIt->mbShowAll ); - pDim->SetSortInfo( &aIt->maSortInfo ); - pDim->SetLayoutInfo( &aIt->maLayoutInfo ); - pDim->SetAutoShowInfo( &aIt->maShowInfo ); - ScDPSaveDimension* pOldDim = NULL; - if (pOldSaveData) + // Transfer the existing layout names to new dimension instance. + pOldDim = pOldSaveData->GetExistingDimensionByName(aIt->maName); + if (pOldDim) { - // Transfer the existing layout names to new dimension instance. - pOldDim = pOldSaveData->GetExistingDimensionByName(aIt->maName); - if (pOldDim) - { - const OUString* pLayoutName = pOldDim->GetLayoutName(); - if (pLayoutName) - pDim->SetLayoutName(*pLayoutName); + const OUString* pLayoutName = pOldDim->GetLayoutName(); + if (pLayoutName) + pDim->SetLayoutName(*pLayoutName); - const OUString* pSubtotalName = pOldDim->GetSubtotalName(); - if (pSubtotalName) - pDim->SetSubtotalName(*pSubtotalName); - } + const OUString* pSubtotalName = pOldDim->GetSubtotalName(); + if (pSubtotalName) + pDim->SetSubtotalName(*pSubtotalName); } + } - bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL ); + bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL ); - // visibility of members - for (vector<ScDPLabelData::Member>::const_iterator itr = aIt->maMembers.begin(), itrEnd = aIt->maMembers.end(); - itr != itrEnd; ++itr) - { - ScDPSaveMember* pMember = pDim->GetMemberByName(itr->maName); + // visibility of members + for (::std::vector<ScDPLabelData::Member>::const_iterator itr = aIt->maMembers.begin(), itrEnd = aIt->maMembers.end(); + itr != itrEnd; ++itr) + { + ScDPSaveMember* pMember = pDim->GetMemberByName(itr->maName); - // #i40054# create/access members only if flags are not default - // (or in manual sorting mode - to keep the order) - if (bManualSort || !itr->mbVisible || !itr->mbShowDetails) - { - pMember->SetIsVisible(itr->mbVisible); - pMember->SetShowDetails(itr->mbShowDetails); - } - if (pOldDim) + // #i40054# create/access members only if flags are not default + // (or in manual sorting mode - to keep the order) + if (bManualSort || !itr->mbVisible || !itr->mbShowDetails) + { + pMember->SetIsVisible(itr->mbVisible); + pMember->SetShowDetails(itr->mbShowDetails); + } + if (pOldDim) + { + // Transfer the existing layout name. + ScDPSaveMember* pOldMember = pOldDim->GetMemberByName(itr->maName); + if (pOldMember) { - // Transfer the existing layout name. - ScDPSaveMember* pOldMember = pOldDim->GetMemberByName(itr->maName); - if (pOldMember) - { - const OUString* pLayoutName = pOldMember->GetLayoutName(); - if (pLayoutName) - pMember->SetLayoutName(*pLayoutName); - } + const OUString* pLayoutName = pOldMember->GetLayoutName(); + if (pLayoutName) + pMember->SetLayoutName(*pLayoutName); } } } } - ScDPSaveDimension* pDim = aSaveData.GetDataLayoutDimension(); - if (pDim && pOldSaveData) + } + ScDPSaveDimension* pDim = aSaveData.GetDataLayoutDimension(); + if (pDim && pOldSaveData) + { + ScDPSaveDimension* pOldDim = pOldSaveData->GetDataLayoutDimension(); + if (pOldDim) { - ScDPSaveDimension* pOldDim = pOldSaveData->GetDataLayoutDimension(); - if (pOldDim) - { - const OUString* pLayoutName = pOldDim->GetLayoutName(); - if (pLayoutName) - pDim->SetLayoutName(*pLayoutName); - } + const OUString* pLayoutName = pOldDim->GetLayoutName(); + if (pLayoutName) + pDim->SetLayoutName(*pLayoutName); } + } - sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE ); - ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable ); + sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE ); + ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable ); - bRefInputMode = sal_False; // to allow deselecting when switching sheets + mbRefInputMode = false; // to allow deselecting when switching sheets - SetDispatcherLock( sal_False ); - SwitchToDocument(); + SetDispatcherLock( false ); + SwitchToDocument(); - // #95513# don't hide the dialog before executing the slot, instead it is used as - // parent for message boxes in ScTabViewShell::GetDialogParent + // #95513# don't hide the dialog before executing the slot, instead it is used as + // parent for message boxes in ScTabViewShell::GetDialogParent - const SfxPoolItem* pRet = GetBindings().GetDispatcher()->Execute( - SID_PIVOT_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aOutItem, 0L, 0L ); + const SfxPoolItem* pRet = GetBindings().GetDispatcher()->Execute( + SID_PIVOT_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aOutItem, 0L, 0L ); - bool bSuccess = true; - if (pRet) - { - const SfxBoolItem* pItem = dynamic_cast<const SfxBoolItem*>(pRet); - if (pItem) - bSuccess = pItem->GetValue(); - } - if (bSuccess) - // Table successfully inserted. - Close(); - else - { - // Table insertion failed. Keep the dialog open. - bRefInputMode = true; - SetDispatcherLock(true); - } + bool bSuccess = true; + if (pRet) + { + const SfxBoolItem* pItem = dynamic_cast<const SfxBoolItem*>(pRet); + if (pItem) + bSuccess = pItem->GetValue(); } + if (bSuccess) + // Table successfully inserted. + Close(); else { - ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ), - ScGlobal::GetRscString( STR_PIVOT_ERROR ) - ).Execute(); + // Table insertion failed. Keep the dialog open. + mbRefInputMode = true; + SetDispatcherLock(true); } } else { - if ( !aBtnMore.GetState() ) - aBtnMore.SetState( sal_True ); + if( !maBtnMore.GetState() ) + maBtnMore.SetState( true ); - ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ), - ScGlobal::GetRscString( STR_INVALID_TABREF ) - ).Execute(); - aEdOutPos.GrabFocus(); + ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ), ScGlobal::GetRscString( STR_INVALID_TABREF ) ).Execute(); + maEdOutPos.GrabFocus(); } return 0; } - -//---------------------------------------------------------------------------- - -IMPL_LINK( ScDPLayoutDlg, CancelHdl, CancelButton *, EMPTYARG ) +IMPL_LINK( ScPivotLayoutDlg, CancelHdl, CancelButton *, EMPTYARG ) { Close(); return 0; } - -//---------------------------------------------------------------------------- - -IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG ) +IMPL_LINK( ScPivotLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG ) { - if ( aBtnMore.GetState() ) + if ( maBtnMore.GetState() ) { - bRefInputMode = sal_True; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); - if ( aEdInPos.IsEnabled() ) + mbRefInputMode = true; + if ( maEdInPos.IsEnabled() ) { - aEdInPos.Enable(); - aEdInPos.GrabFocus(); - aEdInPos.Enable(); + maEdInPos.Enable(); + maEdInPos.GrabFocus(); + maEdInPos.Enable(); } else { - aEdOutPos.Enable(); - aEdOutPos.GrabFocus(); - aEdOutPos.Enable(); + maEdOutPos.Enable(); + maEdOutPos.GrabFocus(); + maEdOutPos.Enable(); } } else { - bRefInputMode = sal_False; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Disable(sal_False); //! allgemeine Methode im ScAnyRefDlg + mbRefInputMode = false; } return 0; } - -//---------------------------------------------------------------------------- - -IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, Edit *, EMPTYARG ) +IMPL_LINK( ScPivotLayoutDlg, EdOutModifyHdl, Edit *, EMPTYARG ) { - String theCurPosStr = aEdOutPos.GetText(); - sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() ); + String theCurPosStr = maEdOutPos.GetText(); + sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, mpDoc, mpDoc->GetAddressConvention() ); if ( SCA_VALID == (nResult & SCA_VALID) ) { - String* pStr = NULL; - sal_Bool bFound = sal_False; - sal_uInt16 i = 0; - sal_uInt16 nCount = aLbOutPos.GetEntryCount(); + String* pStr = 0; + bool bFound = false; + sal_uInt16 i = 0; + sal_uInt16 nCount = maLbOutPos.GetEntryCount(); for ( i=2; i<nCount && !bFound; i++ ) { - pStr = (String*)aLbOutPos.GetEntryData( i ); + pStr = (String*)maLbOutPos.GetEntryData( i ); bFound = (theCurPosStr == *pStr); } if ( bFound ) - aLbOutPos.SelectEntryPos( --i ); + maLbOutPos.SelectEntryPos( --i ); else - aLbOutPos.SelectEntryPos( 0 ); + maLbOutPos.SelectEntryPos( 0 ); } return 0; } -IMPL_LINK( ScDPLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG ) +IMPL_LINK( ScPivotLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG ) { - UpdateSrcRange(); - return 0; -} + String theCurPosStr = maEdInPos.GetText(); + sal_uInt16 nResult = ScRange().Parse( theCurPosStr, mpDoc, mpDoc->GetAddressConvention() ); + // invalid source range + if( SCA_VALID != (nResult & SCA_VALID) ) + return 0; -//---------------------------------------------------------------------------- + ScRefAddress start, end; + ConvertDoubleRef( mpDoc, theCurPosStr, 1, start, end, mpDoc->GetAddressConvention() ); + ScRange aNewRange( start.GetAddress(), end.GetAddress() ); + ScSheetSourceDesc inSheet = *mxDlgDPObject->GetSheetDesc(); -IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG ) -{ - String aString; - sal_uInt16 nSelPos = aLbOutPos.GetSelectEntryPos(); + // new range is identical to the current range + if( inSheet.aSourceRange == aNewRange ) + return 0; - if ( nSelPos > 1 ) - { - aString = *(String*)aLbOutPos.GetEntryData( nSelPos ); - } - else if ( nSelPos == aLbOutPos.GetEntryCount()-1 ) // auf neue Tabelle? + ScTabViewShell* pTabViewShell = mpViewData->GetViewShell(); + inSheet.aSourceRange = aNewRange; + mxDlgDPObject->SetSheetDesc( inSheet ); + mxDlgDPObject->FillOldParam( maPivotData ); + mxDlgDPObject->FillLabelData( maPivotData ); + + // SetDialogDPObject does not take ownership but makes a copy internally + pTabViewShell->SetDialogDPObject( mxDlgDPObject.get() ); + + // re-initialize the field windows from the new data + InitFieldWindows(); + + return 0; +} + +IMPL_LINK( ScPivotLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG ) +{ + String aString; + sal_uInt16 nSelPos = maLbOutPos.GetSelectEntryPos(); + if( nSelPos > 1 ) { - aEdOutPos.Disable(); - aRbOutPos.Disable(); + aString = *(String*)maLbOutPos.GetEntryData( nSelPos ); } else { - aEdOutPos.Enable(); - aRbOutPos.Enable(); + // do not allow to specify output position, if target is "new sheet" + bool bNewSheet = nSelPos == 1; + maEdOutPos.Enable( !bNewSheet ); + maRbOutPos.Enable( !bNewSheet ); } - aEdOutPos.SetText( aString ); + maEdOutPos.SetText( aString ); return 0; } - -//---------------------------------------------------------------------------- - -IMPL_LINK( ScDPLayoutDlg, ScrollHdl, ScrollBar *, EMPTYARG ) +IMPL_LINK( ScPivotLayoutDlg, ChildEventListener, VclWindowEvent*, pEvent ) { - long nNewOffset = aSlider.GetThumbPos(); - long nOffsetDiff = nNewOffset - nOffset; - nOffset = nNewOffset; - - size_t nFields = std::min< size_t >( aLabelDataArr.size() - nOffset, PAGE_SIZE ); - - aWndSelect.ClearFields(); - - size_t i=0; - for ( i=0; i<nFields; i++ ) + Window* pWindow = pEvent->GetWindow(); + // check that this dialog is the parent of the window, to ignore focus events from sub dialogs + if( (pEvent->GetId() == VCLEVENT_WINDOW_GETFOCUS) && pWindow && (pWindow->GetParent() == this) ) { - const ScDPLabelData& rData = aLabelDataArr[nOffset+i]; - aWndSelect.AddField(rData.getDisplayName(), i); - aSelectArr[i].reset( new ScDPFuncData( rData.mnCol, rData.mnFuncMask ) ); - } - for ( ; i<aSelectArr.size(); i++ ) - aSelectArr[i].reset(); - - aWndSelect.ModifySelectionOffset( nOffsetDiff ); // adjusts selection & redraws - return 0; -} + // check if old window and/or new window are field windows + ScPivotFieldWindow* pSourceWindow = mpFocusWindow; + ScPivotFieldWindow* pTargetWindow = dynamic_cast< ScPivotFieldWindow* >( pWindow ); -//---------------------------------------------------------------------------- + /* Enable or disable the Remove/Options buttons. Do nothing if the + buttons themselves get the focus. + #128113# The TestTool may set the focus into an empty window. Then + the Remove/Options buttons must be disabled. */ + if( (pWindow != &maBtnRemove) && (pWindow != &maBtnOptions) ) + { + bool bEnableButtons = pTargetWindow && (pTargetWindow->GetType() != PIVOTFIELDTYPE_SELECT) && !pTargetWindow->IsEmpty(); + maBtnRemove.Enable( bEnableButtons ); + maBtnOptions.Enable( bEnableButtons ); + /* Remember the new focus window (will not be changed, if + Remove/Option buttons are getting focus, because they need to + know the field window they are working on). */ + mpFocusWindow = pTargetWindow; + } -IMPL_LINK( ScDPLayoutDlg, GetFocusHdl, Control*, pCtrl ) -{ - pEditActive = NULL; - if ( pCtrl == &aEdInPos ) - pEditActive = &aEdInPos; - else if ( pCtrl == &aEdOutPos ) - pEditActive = &aEdOutPos; + /* Move the last selected field to target window, if focus changes via + keyboard shortcut. */ + if( pSourceWindow && pTargetWindow && (pSourceWindow != pTargetWindow) && ((pTargetWindow->GetGetFocusFlags() & GETFOCUS_MNEMONIC) != 0) ) + { + // append field in target window + MoveField( *pSourceWindow, *pTargetWindow, pTargetWindow->GetFieldCount(), false ); + // move cursor in selection window to next field + if( pSourceWindow->GetType() == PIVOTFIELDTYPE_SELECT ) + pSourceWindow->SelectNextField(); + // return focus to source window (if it is not empty) + GrabFieldFocus( pSourceWindow->IsEmpty() ? *pTargetWindow : *pSourceWindow ); + } + mpActiveEdit = dynamic_cast< ::formula::RefEdit* >( pEvent->GetWindow() ); + } return 0; } +// ============================================================================ diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index f1f35a4fbf48..080c80e509ea 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -117,6 +117,8 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bo aBtnOk .SetClickHdl( LINK( this, ScNewScenarioDlg, OkHdl ) ); aCbShowFrame.SetClickHdl( LINK( this, ScNewScenarioDlg, EnableHdl ) ); + aLbColor.SetAccessibleName(String(ScResId( STR_COLOR ) )); + FreeResource(); aLbColor.SelectEntry( Color( COL_LIGHTGRAY ) ); @@ -142,6 +144,9 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bo aCbAttrib.Enable(sal_False); aCbValue.Enable(sal_False); */ + + aEdComment.SetAccessibleRelationMemberOf(&aFlComment); + aLbColor.SetAccessibleRelationLabeledBy(&aCbShowFrame); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/dbgui/scendlg.hrc b/sc/source/ui/dbgui/scendlg.hrc index 83818773bf5a..f7fa562a5b17 100644 --- a/sc/source/ui/dbgui/scendlg.hrc +++ b/sc/source/ui/dbgui/scendlg.hrc @@ -55,3 +55,6 @@ #define STR_CREATEDBY 31 #define STR_ON 32 #define STR_EDIT 33 +//IAccessibility2 Implementation 2009----- +#define STR_COLOR 34 +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/dbgui/scendlg.src b/sc/source/ui/dbgui/scendlg.src index f7c3d29b8365..640fdda8bc30 100644 --- a/sc/source/ui/dbgui/scendlg.src +++ b/sc/source/ui/dbgui/scendlg.src @@ -147,6 +147,10 @@ ModalDialog RID_SCDLG_NEWSCENARIO { Text [ en-US ] = "on" ; }; + String STR_COLOR + { + Text [ en-US ] = "Display border in" ; + }; FixedLine FL_NAME { Pos = MAP_APPFONT ( 6 , 3 ) ; diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index abbda7b995e7..2cf981a15ff3 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -273,7 +273,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, OUString sTextSeparators; bool bMergeDelimiters = false; bool bFixedWidth = false; - bool bQuotedFieldAsText = true; + bool bQuotedFieldAsText = false; bool bDetectSpecialNum = false; sal_Int32 nFromRow = 1; sal_Int32 nCharSet = -1; @@ -316,34 +316,45 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, maFieldSeparators = GetSeparators(); // Clipboard is always Unicode, else detect. - bool bPreselectUnicode = !mbFileImport; + rtl_TextEncoding ePreselectUnicode = (mbFileImport ? + RTL_TEXTENCODING_DONTKNOW : RTL_TEXTENCODING_UNICODE); // Sniff for Unicode / not - if( !bPreselectUnicode && mpDatStream ) + if( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW && mpDatStream ) { Seek( 0 ); - mpDatStream->StartReadingUnicodeText(); + mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_DONTKNOW ); sal_uLong nUniPos = mpDatStream->Tell(); - if ( nUniPos > 0 ) - bPreselectUnicode = sal_True; // read 0xfeff/0xfffe - else + switch (nUniPos) { - sal_uInt16 n; - *mpDatStream >> n; - // Assume that normal ASCII/ANSI/ISO/etc. text doesn't start with - // control characters except CR,LF,TAB - if ( (n & 0xff00) < 0x2000 ) - { - switch ( n & 0xff00 ) + case 2: + ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16 + break; + case 3: + ePreselectUnicode = RTL_TEXTENCODING_UTF8; // UTF-8 + break; + case 0: { - case 0x0900 : - case 0x0a00 : - case 0x0d00 : - break; - default: - bPreselectUnicode = sal_True; + sal_uInt16 n; + *mpDatStream >> n; + // Assume that normal ASCII/ANSI/ISO/etc. text doesn't start with + // control characters except CR,LF,TAB + if ( (n & 0xff00) < 0x2000 ) + { + switch ( n & 0xff00 ) + { + case 0x0900 : + case 0x0a00 : + case 0x0d00 : + break; + default: + ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16 + } + } + mpDatStream->Seek(0); } - } - mpDatStream->Seek(0); + break; + default: + ; // nothing } mnStreamPos = mpDatStream->Tell(); } @@ -373,10 +384,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, // Insert one "SYSTEM" entry for compatibility in AsciiOptions and system // independent document linkage. aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser ); - aLbCharSet.SelectTextEncoding( bPreselectUnicode ? - RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() ); + aLbCharSet.SelectTextEncoding( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ? + gsl_getSystemTextEncoding() : ePreselectUnicode ); - if( nCharSet >= 0 ) + if( nCharSet >= 0 && ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ) aLbCharSet.SelectEntryPos( static_cast<sal_uInt16>(nCharSet) ); SetSelectedCharSet(); @@ -410,6 +421,9 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, UpdateVertical(); maTableBox.Execute( CSVCMD_NEWCELLTEXTS ); + + aEdOther.SetAccessibleName(aCkbOther.GetText()); + aEdOther.SetAccessibleRelationLabeledBy(&aCkbOther); } @@ -437,8 +451,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, String &rText ) memset( mpRowPosArray, 0, sizeof(mpRowPosArray[0]) * (ASCIIDLG_MAXROWS+2)); Seek(0); - if ( mpDatStream->GetStreamCharSet() == RTL_TEXTENCODING_UNICODE ) - mpDatStream->StartReadingUnicodeText(); + mpDatStream->StartReadingUnicodeText( mpDatStream->GetStreamCharSet() ); mnStreamPos = mpDatStream->Tell(); mpRowPosArray[mnRowPosCount] = mnStreamPos; diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 3bca3a8ade22..486704ca4d12 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -132,11 +132,12 @@ ScImportOptionsDlg::ScImportOptionsDlg( aEdFieldSep ( this, ScResId( ED_FIELDSEP ) ), aFtTextSep ( this, ScResId( FT_TEXTSEP ) ), aEdTextSep ( this, ScResId( ED_TEXTSEP ) ), + aCbQuoteAll ( this, ScResId( CB_QUOTEALL ) ), + aCbShown ( this, ScResId( CB_SAVESHOWN ) ), aCbFixed ( this, ScResId( CB_FIXEDWIDTH ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aCbShown ( this, ScResId( CB_SAVESHOWN ) ) + aBtnHelp ( this, ScResId( BTN_HELP ) ) { // im Ctor-Initializer nicht moeglich (MSC kann das nicht): pFieldSepTab = new ScDelimiterTable( String(ScResId(SCSTR_FIELDSEP)) ); @@ -214,6 +215,8 @@ ScImportOptionsDlg::ScImportOptionsDlg( aCbFixed.Check( sal_False ); aCbShown.Show(); aCbShown.Check( sal_True ); + aCbQuoteAll.Show(); + aCbQuoteAll.Check( sal_False ); } else { @@ -225,6 +228,7 @@ ScImportOptionsDlg::ScImportOptionsDlg( aEdTextSep.Hide(); aCbFixed.Hide(); aCbShown.Hide(); + aCbQuoteAll.Hide(); aLbFont.GrabFocus(); aLbFont.SetDoubleClickHdl( LINK( this, ScImportOptionsDlg, DoubleClickHdl ) ); } @@ -259,6 +263,7 @@ void ScImportOptionsDlg::GetImportOptions( ScImportOptions& rOptions ) const rOptions.nTextSepCode = GetCodeFromCombo( aEdTextSep ); rOptions.bFixedWidth = aCbFixed.IsChecked(); rOptions.bSaveAsShown = aCbShown.IsChecked(); + rOptions.bQuoteAllText = aCbQuoteAll.IsChecked(); } } @@ -302,6 +307,7 @@ IMPL_LINK( ScImportOptionsDlg, FixedWidthHdl, CheckBox*, pCheckBox ) aFtTextSep.Enable( bEnable ); aEdTextSep.Enable( bEnable ); aCbShown.Enable( bEnable ); + aCbQuoteAll.Enable( bEnable ); } return 0; } diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 24751946253f..7e0b53d863cc 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -70,8 +70,8 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_SPEC_FILTER ), // - aLbFilterArea ( this, ScResId( LB_CRITERIA_AREA ) ), aFtFilterArea ( this, ScResId( FT_CRITERIA_AREA ) ), + aLbFilterArea ( this, ScResId( LB_CRITERIA_AREA ) ), aEdFilterArea ( this, this, ScResId( ED_CRITERIA_AREA ) ), aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ), // @@ -103,6 +103,11 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi pTimer->SetTimeout( 50 ); // 50ms warten pTimer->SetTimeoutHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); pTimer->Start(); + + aLbCopyArea.SetAccessibleName(aBtnCopyResult.GetText()); + aEdCopyArea.SetAccessibleName(aBtnCopyResult.GetText()); + aLbCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + aEdCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 65411f7f82d2..2bf85de61a0b 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -600,6 +600,13 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent, Init(); FreeResource(); SetExchangeSupport(); + + aLbOutPos.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + aLbOutPos.SetAccessibleName(aBtnCopyResult.GetText()); + aEdOutPos.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + aEdOutPos.SetAccessibleName(aBtnCopyResult.GetText()); + aLbSortUser.SetAccessibleRelationLabeledBy(&aBtnSortUser); + aLbSortUser.SetAccessibleName(aBtnSortUser.GetText()); } // ----------------------------------------------------------------------- diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index 070167f8ff95..d2f4db3cde07 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -523,6 +523,9 @@ ScTpSubTotalOptions::ScTpSubTotalOptions( Window* pParent, { Init(); FreeResource(); + + aLbUserDef.SetAccessibleRelationLabeledBy(&aBtnUserDef); + aLbUserDef.SetAccessibleName(aBtnUserDef.GetText()); } // ----------------------------------------------------------------------- diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 7e274a86f0f7..734fd20a71d7 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1650,6 +1650,8 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt sal_uInt16 nOldNumberFormatInt = rStream.GetNumberFormatInt(); ByteString aStrDelimEncoded; // only used if not Unicode UniString aStrDelimDecoded; // only used if context encoding + ByteString aDelimEncoded; + UniString aDelimDecoded; sal_Bool bContextOrNotAsciiEncoding; if ( eCharSet == RTL_TEXTENCODING_UNICODE ) { @@ -1659,6 +1661,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt else { aStrDelimEncoded = ByteString( cStrDelim, eCharSet ); + aDelimEncoded = ByteString( cDelim, eCharSet ); rtl_TextEncodingInfo aInfo; aInfo.StructSize = sizeof(aInfo); if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) ) @@ -1667,7 +1670,10 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt (((aInfo.Flags & RTL_TEXTENCODING_INFO_CONTEXT) != 0) || ((aInfo.Flags & RTL_TEXTENCODING_INFO_ASCII) == 0)); if ( bContextOrNotAsciiEncoding ) + { aStrDelimDecoded = String( aStrDelimEncoded, eCharSet ); + aDelimDecoded = String( aDelimEncoded, eCharSet ); + } } else bContextOrNotAsciiEncoding = sal_False; @@ -1895,14 +1901,21 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt if ( eCharSet == RTL_TEXTENCODING_UNICODE ) { xub_StrLen nPos = aString.Search( cStrDelim ); + // #i116636# quotes are needed if text delimiter (quote), field delimiter, or LF is in the cell text + bool bNeedQuotes = rAsciiOpt.bQuoteAllText || + ( nPos != STRING_NOTFOUND ) || + ( aString.Search( cDelim ) != STRING_NOTFOUND ) || + ( aString.Search( sal_Unicode(_LF) ) != STRING_NOTFOUND ); while ( nPos != STRING_NOTFOUND ) { aString.Insert( cStrDelim, nPos ); nPos = aString.Search( cStrDelim, nPos+2 ); } - rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); + if ( bNeedQuotes ) + rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); rStream.WriteUnicodeText( aString ); - rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); + if ( bNeedQuotes ) + rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); } else { @@ -1928,6 +1941,10 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt UniString aStrDec( aStrEnc, eCharSet ); // search on re-decoded string xub_StrLen nPos = aStrDec.Search( aStrDelimDecoded ); + bool bNeedQuotes = rAsciiOpt.bQuoteAllText || + ( nPos != STRING_NOTFOUND ) || + ( aStrDec.Search( aDelimDecoded ) != STRING_NOTFOUND ) || + ( aStrDec.Search( sal_Unicode(_LF) ) != STRING_NOTFOUND ); while ( nPos != STRING_NOTFOUND ) { aStrDec.Insert( aStrDelimDecoded, nPos ); @@ -1935,15 +1952,21 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt nPos+1+aStrDelimDecoded.Len() ); } // write byte re-encoded - rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); + if ( bNeedQuotes ) + rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); rStream.WriteUnicodeOrByteText( aStrDec, eCharSet ); - rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); + if ( bNeedQuotes ) + rStream.WriteUniOrByteChar( cStrDelim, eCharSet ); } else { ByteString aStrEnc( aString, eCharSet ); // search on encoded string xub_StrLen nPos = aStrEnc.Search( aStrDelimEncoded ); + bool bNeedQuotes = rAsciiOpt.bQuoteAllText || + ( nPos != STRING_NOTFOUND ) || + ( aStrEnc.Search( aDelimEncoded ) != STRING_NOTFOUND ) || + ( aStrEnc.Search( sal_Char(_LF) ) != STRING_NOTFOUND ); while ( nPos != STRING_NOTFOUND ) { aStrEnc.Insert( aStrDelimEncoded, nPos ); @@ -1951,11 +1974,13 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt nPos+1+aStrDelimEncoded.Len() ); } // write byte encoded - rStream.Write( aStrDelimEncoded.GetBuffer(), - aStrDelimEncoded.Len() ); + if ( bNeedQuotes ) + rStream.Write( aStrDelimEncoded.GetBuffer(), + aStrDelimEncoded.Len() ); rStream.Write( aStrEnc.GetBuffer(), aStrEnc.Len() ); - rStream.Write( aStrDelimEncoded.GetBuffer(), - aStrDelimEncoded.Len() ); + if ( bNeedQuotes ) + rStream.Write( aStrDelimEncoded.GetBuffer(), + aStrDelimEncoded.Len() ); } } } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 244f80dd0d5a..7f11f15f5db4 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -826,8 +826,7 @@ sal_Bool ScImportExport::Text2Doc( SvStream& rStrm ) SCCOL nEndCol = aRange.aEnd.Col(); SCROW nEndRow = aRange.aEnd.Row(); sal_uLong nOldPos = rStrm.Tell(); - if ( rStrm.GetStreamCharSet() == RTL_TEXTENCODING_UNICODE ) - rStrm.StartReadingUnicodeText(); + rStrm.StartReadingUnicodeText( rStrm.GetStreamCharSet() ); sal_Bool bData = sal_Bool( !bSingle ); if( !bSingle) bOk = StartPaste(); @@ -1167,8 +1166,7 @@ sal_Bool ScImportExport::ExtText2Doc( SvStream& rStrm ) ::std::auto_ptr<ScProgress> xProgress( new ScProgress( pDocSh, ScGlobal::GetRscString( STR_LOAD_DOC ), rStrm.Tell() - nOldPos )); rStrm.Seek( nOldPos ); - if ( rStrm.GetStreamCharSet() == RTL_TEXTENCODING_UNICODE ) - rStrm.StartReadingUnicodeText(); + rStrm.StartReadingUnicodeText( rStrm.GetStreamCharSet() ); sal_Bool bOld = ScColumn::bDoubleAlloc; ScColumn::bDoubleAlloc = sal_True; diff --git a/sc/source/ui/inc/AccessibleDataPilotControl.hxx b/sc/source/ui/inc/AccessibleDataPilotControl.hxx index c86d598b6e9c..f92fb79987a7 100644 --- a/sc/source/ui/inc/AccessibleDataPilotControl.hxx +++ b/sc/source/ui/inc/AccessibleDataPilotControl.hxx @@ -31,7 +31,7 @@ #include "AccessibleContextBase.hxx" -class ScDPFieldWindow; +class ScPivotFieldWindow; class ScAccessibleDataPilotButton; class ScAccessibleDataPilotControl @@ -42,7 +42,7 @@ public: ScAccessibleDataPilotControl( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, - ScDPFieldWindow* pDPFieldWindow); + ScPivotFieldWindow* pFieldWindow); virtual void Init(); @@ -131,7 +131,7 @@ protected: throw (::com::sun::star::uno::RuntimeException); private: - ScDPFieldWindow* mpDPFieldWindow; + ScPivotFieldWindow* mpFieldWindow; struct AccessibleWeak { ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xWeakAcc; diff --git a/sc/source/ui/inc/areasdlg.hxx b/sc/source/ui/inc/areasdlg.hxx index c5e0e4cde789..914e2917d2e0 100644 --- a/sc/source/ui/inc/areasdlg.hxx +++ b/sc/source/ui/inc/areasdlg.hxx @@ -62,18 +62,18 @@ public: virtual sal_Bool Close(); private: - ListBox aLbPrintArea; FixedLine aFlPrintArea; + ListBox aLbPrintArea; formula::RefEdit aEdPrintArea; formula::RefButton aRbPrintArea; - ListBox aLbRepeatRow; FixedLine aFlRepeatRow; + ListBox aLbRepeatRow; formula::RefEdit aEdRepeatRow; formula::RefButton aRbRepeatRow; - ListBox aLbRepeatCol; FixedLine aFlRepeatCol; + ListBox aLbRepeatCol; formula::RefEdit aEdRepeatCol; formula::RefButton aRbRepeatCol; diff --git a/sc/source/ui/inc/condfrmt.hrc b/sc/source/ui/inc/condfrmt.hrc index 099d82b2fa85..06af0cd485ce 100644 --- a/sc/source/ui/inc/condfrmt.hrc +++ b/sc/source/ui/inc/condfrmt.hrc @@ -63,6 +63,12 @@ #define FL_SEP1 41 #define FL_SEP2 42 +//IAccessibility2 Implementation 2009----- +#define LABEL_FORMARTTING_CONDITIONS 5043 +#define LABEL_CONDITIONS 5044 +#define LABEL_CONDITION_VALUE 5045 +//-----IAccessibility2 Implementation 2009 + #define BTN_OK 31 #define BTN_CANCEL 32 #define BTN_HELP 33 diff --git a/sc/source/ui/inc/condfrmt.hxx b/sc/source/ui/inc/condfrmt.hxx index 3909792d753d..c8963ef689ee 100644 --- a/sc/source/ui/inc/condfrmt.hxx +++ b/sc/source/ui/inc/condfrmt.hxx @@ -69,8 +69,6 @@ private: FixedText aFtCond1Template; ListBox aLbCond1Template; PushButton aBtnNew1; - FixedLine aFlSep1; - CheckBox aCbxCond2; ListBox aLbCond21; ListBox aLbCond22; @@ -82,8 +80,6 @@ private: FixedText aFtCond2Template; ListBox aLbCond2Template; PushButton aBtnNew2; - FixedLine aFlSep2; - CheckBox aCbxCond3; ListBox aLbCond31; ListBox aLbCond32; @@ -123,7 +119,8 @@ private: Size aCond3Size1; Size aCond3Size2; Size aCond3Size3; - + FixedLine aFlSep2; + FixedLine aFlSep1; formula::RefEdit* pEdActive; sal_Bool bDlgLostFocus; ScDocument* pDoc; diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx index 5c74777edf47..65dd07d19e8a 100644 --- a/sc/source/ui/inc/fieldwnd.hxx +++ b/sc/source/ui/inc/fieldwnd.hxx @@ -28,193 +28,225 @@ #ifndef SC_FIELDWND_HXX #define SC_FIELDWND_HXX +#include <utility> #include <vector> -#include "address.hxx" +#include <boost/shared_ptr.hpp> +#include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> #include <vcl/ctrl.hxx> #include <vcl/fixed.hxx> -#include <cppuhelper/weakref.hxx> -#define PAGE_SIZE 16 // count of visible fields for scrollbar -#define LINE_SIZE 8 // count of fields per column for scrollbar -#define MAX_FIELDS 8 // maximum count of fields for row/col/data area -#define MAX_PAGEFIELDS 10 // maximum count of fields for page area +#include "address.hxx" +#include "pivot.hxx" -#define OWIDTH PivotGlobal::nObjWidth -#define OHEIGHT PivotGlobal::nObjHeight -#define SSPACE PivotGlobal::nSelSpace +// ============================================================================ -class ScDPLayoutDlg; +class ScPivotLayoutDlg; class ScAccessibleDataPilotControl; -//=================================================================== +const size_t PIVOTFIELD_INVALID = static_cast< size_t >( -1 ); + +// ============================================================================ -/** Type of content area. */ -enum ScDPFieldType +/** Type of the pivot table field window. */ +enum ScPivotFieldType { - TYPE_PAGE, /// Area for all page fields. - TYPE_ROW, /// Area for all row fields. - TYPE_COL, /// Area for all column fields. - TYPE_DATA, /// Area for all data fields. - TYPE_SELECT /// Selection area with all fields. + PIVOTFIELDTYPE_PAGE, /// Window for all page fields. + PIVOTFIELDTYPE_COL, /// Window for all column fields. + PIVOTFIELDTYPE_ROW, /// Window for all row fields. + PIVOTFIELDTYPE_DATA, /// Window for all data fields. + PIVOTFIELDTYPE_SELECT /// Selection window with all fields. }; -//------------------------------------------------------------------- +/** Type of an end tracking event. */ +enum ScPivotFieldEndTracking +{ + ENDTRACKING_SUSPEND, /// Stop tracking in this window, but tracking still active (in another window). + ENDTRACKING_CANCEL, /// Tracking has been cancelled. + ENDTRACKING_DROP /// Tracking has ended, a field has been dropped. +}; + +// ============================================================================ + +typedef ::std::pair< const ScPivotFuncData*, size_t > ScPivotFuncDataEntry; + +// ============================================================================ -/** Represents a field area in the DataPilot layout dialog. */ -class ScDPFieldWindow : public Control +/** Represents a field area in the pivot table layout dialog. */ +class ScPivotFieldWindow : public Control { +public: + ScPivotFieldWindow( + ScPivotLayoutDlg* pDialog, + const ResId& rResId, + ScrollBar& rScrollBar, + FixedText* pFtCaption, + const ::rtl::OUString& rName, + ScPivotFieldType eFieldType, + const sal_Char* pcHelpId, + PointerStyle eDropPointer, + size_t nColCount, + size_t nRowCount, + long nFieldWidthFactor, + long nSpaceSize ); + + virtual ~ScPivotFieldWindow(); + + /** Initializes this field window from the passed label data (used for selection window). */ + void ReadDataLabels( const ScDPLabelDataVector& rLabels ); + /** Initializes this field window from the passed field data (used for row/col/page/data window). */ + void ReadPivotFields( const ScPivotFieldVector& rPivotFields ); + + /** Fills the passed vector with the plain names of all fields from this field window. */ + void WriteFieldNames( ScDPNameVec& rFieldNames ) const; + /** Fills the passed pivot field vector with the fields of this field window. */ + void WritePivotFields( ScPivotFieldVector& rPivotFields ) const; + + /** Returns the type of this field window. */ + inline ScPivotFieldType GetType() const { return meFieldType; } + /** Returns the mouse pointer style for tracking over this window. */ + inline PointerStyle GetDropPointerStyle() const { return meDropPointer; } + /** Returns the name of the control without shortcut. */ + inline ::rtl::OUString GetName() const { return maName; } + /** Returns the description of the control which is used for the accessibility objects. */ + ::rtl::OUString GetDescription() const; + + /** Returns true, if the window is empty. */ + inline bool IsEmpty() const { return maFields.empty(); } + /** Returns the number of existing fields. */ + inline size_t GetFieldCount() const { return maFields.size(); } + /** Returns the text of an existing field. */ + ::rtl::OUString GetFieldText( size_t nFieldIndex ) const; + + /** Returns the index of a field with the specified column identifier. */ + ScPivotFuncDataEntry FindFuncDataByCol( SCCOL nCol ) const; + + /** Returns the pixel size of a field. */ + inline const Size& GetFieldSize() const { return maFieldSize; } + /** Returns the pixel position of a field (without bound check). */ + Point GetFieldPosition( size_t nFieldIndex ) const; + /** Calculates the field index at a specific pixel position. */ + size_t GetFieldIndex( const Point& rWindowPos ) const; + /** Calculates the field insertion index for mouse drop at a specific pixel position. */ + size_t GetDropIndex( const Point& rWindowPos ) const; + + /** Returns the index of the selected field. */ + inline size_t GetSelectedIndex() const { return mnSelectIndex; } + /** Grabs focus and sets the passed selection. */ + void GrabFocusAndSelect( size_t nIndex ); + /** Selects the next field. */ + void SelectNextField(); + + /** Inserts a new field in front of the specified field. */ + void InsertField( size_t nInsertIndex, const ScPivotFuncData& rFuncData ); + /** Removes the specified field. */ + bool RemoveField( size_t nRemoveIndex ); + /** Moves the specified field to a new position. */ + bool MoveField( size_t nFieldIndex, size_t nInsertIndex ); + + /** Returns the selected field (pointer is valid as long as field vector is not changed). */ + const ScPivotFuncData* GetSelectedFuncData() const; + /** Removes the selected field. */ + void ModifySelectedField( const ScPivotFuncData& rFuncData ); + /** Removes the selected field. */ + bool RemoveSelectedField(); + /** Moves the selected field in front of the specified field. */ + bool MoveSelectedField( size_t nInsertIndex ); + + /** Called from dialog when tracking starts in this field window. */ + void NotifyStartTracking(); + /** Called from dialog while tracking in this field window. */ + void NotifyTracking( const Point& rWindowPos ); + /** Called from dialog when tracking ends in this field window. */ + void NotifyEndTracking( ScPivotFieldEndTracking eEndType ); + +protected: + virtual void Paint( const Rectangle& rRect ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateAccessible(); + private: - typedef ::std::pair< String, bool > FieldString; // true = text fits into button - - String aName; /// name of the control, used in Accessibility - ScDPLayoutDlg* pDlg; /// Parent dialog. - Rectangle aWndRect; /// Area rectangle in pixels. - FixedText* pFtCaption; /// FixedText containing the name of the control. - Point aTextPos; /// Position of the caption text. - std::vector< FieldString > aFieldArr; /// String array of the field names and flags, if text fits into button. - ScDPFieldType eType; /// Type of this area. - Color aFaceColor; /// Color for dialog background. - Color aWinColor; /// Color for window background. - Color aTextColor; /// Color for text in buttons. - Color aWinTextColor; /// Color for text in field windows. - size_t nFieldSize; /// Maximum count of fields. - size_t nFieldSelected; /// Currently selected field. - - com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xAccessible; - ScAccessibleDataPilotControl* pAccessible; - - /** Initilize the object. */ - void Init(); - - /** Reads all needed style settings. */ - void GetStyleSettings(); + /** A structure containing all data needed for a field in this window. */ + struct ScPivotWindowField + { + ScPivotFuncData maFuncData; /// Field data from source pivot table. + ::rtl::OUString maFieldName; /// Name displayed on the field button. + bool mbClipped; /// True = field text does not fit into button. + explicit ScPivotWindowField( const ScDPLabelData& rLabelData ); + explicit ScPivotWindowField( ScPivotLayoutDlg& rDialog, const ScPivotField& rField, bool bDataWindow ); + explicit ScPivotWindowField( ScPivotLayoutDlg& rDialog, const ScPivotFuncData& rFuncData, bool bDataWindow ); + void InitFieldName( ScPivotLayoutDlg& rDialog, bool bDataWindow ); + }; + + /** Specifies how the selection cursor can move in the window. */ + enum MoveType { PREV_FIELD, NEXT_FIELD, PREV_LINE, NEXT_LINE, PREV_PAGE, NEXT_PAGE, FIRST_FIELD, LAST_FIELD }; + + /** Calculates a scroll position to make the passed field visible. Tries to + stick to current scroll position if possible. */ + size_t RecalcVisibleIndex( size_t nSelectIndex ) const; + + /** Sets selection to the specified field and changes scrolling position. */ + void SetSelectionUnchecked( size_t nSelectIndex, size_t nFirstVisIndex ); + /** Selects a field and adjusts scrolling position to make the field visible. */ + void MoveSelection( size_t nSelectIndex ); + /** Sets selection to a new position relative to current. */ + void MoveSelection( MoveType eMoveType ); + /** Moves the selected field to a new position relative to current. */ + void MoveSelectedField( MoveType eMoveType ); + + /** Inserts the passed field into the vector and notifies accessibility object. */ + void InsertFieldUnchecked( size_t nInsertIndex, const ScPivotWindowField& rField ); + /** Removes the specified field from the vector and notifies accessibility object. */ + void RemoveFieldUnchecked( size_t nRemoveIndex ); /** Draws the background. */ - void DrawBackground( OutputDevice& rDev ); - /** Draws a field into the specified rectangle. */ - void DrawField( - OutputDevice& rDev, - const Rectangle& rRect, - FieldString& rText, - bool bFocus ); - - /** @return sal_True, if the field index is inside of the control area. */ - bool IsValidIndex( size_t nIndex ) const; - /** @return sal_True, if the field with the given index exists. */ - bool IsExistingIndex( size_t nIndex ) const; - /** @return sal_True, if the field with the given index exists and the text is - too long for the button control. */ - bool IsShortenedText( size_t nIndex ) const; - /** @return The new selection index after moving to the given direction. */ - size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const; - - /** Sets selection to the field with index nIndex. */ - void SetSelection( size_t nIndex ); - /** Sets selection to first field. */ - void SetSelectionHome(); - /** Sets selection to last field. */ - void SetSelectionEnd(); - /** Sets selection to new position relative to current. */ - void MoveSelection( sal_uInt16 nKeyCode, SCsCOL nDX, SCsROW nDY ); - - /** Moves the selected field to nDestIndex. */ - void MoveField( size_t nDestIndex ); - /** Moves the selected field to the given direction. */ - void MoveFieldRel( SCsCOL nDX, SCsROW nDY ); - - /** Updates the tab stop style bits. */ - void UpdateStyle(); + void DrawBackground( OutputDevice& rDev ); + /** Draws the specified field. */ + void DrawField( OutputDevice& rDev, size_t nFieldIndex ); + /** Draws the insertion cursor. */ + void DrawInsertionCursor( OutputDevice& rDev ); -protected: - virtual void Paint( const Rectangle& rRect ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void GetFocus(); - virtual void LoseFocus(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + /** Returns a reference to the accessiblity object, if still alive. */ + ::rtl::Reference< ScAccessibleDataPilotControl > GetAccessibleControl(); -public: - ScDPFieldWindow( - ScDPLayoutDlg* pDialog, - const ResId& rResId, - ScDPFieldType eFieldType, - FixedText* pFtFieldCaption ); - ScDPFieldWindow( - ScDPLayoutDlg* pDialog, - const ResId& rResId, - ScDPFieldType eFieldType, - const String& aName ); - virtual ~ScDPFieldWindow(); - - /** Reads the FixedText's text with mnemonic and hides the FixedText. */ - void UseMnemonic(); - - /** Draws the complete control. */ - void Redraw(); - - /** @return The pixel position of a field (without bound check). */ - Point GetFieldPosition( size_t nIndex ) const; - /** @return The pixel size of a field. */ - Size GetFieldSize() const; - - /** @return The index of the selected field. */ - inline bool IsEmpty() const { return aFieldArr.empty(); } - /** @return The index of the selected field. */ - inline size_t GetSelectedField() const { return nFieldSelected; } - /** @return The pixel position of the last possible field. */ - Point GetLastPosition() const; - - /** @return The count of existing fields. */ - inline size_t GetFieldCount() const { return aFieldArr.size(); } - /** Inserts a field to the specified index. */ - void AddField( const String& rText, size_t nNewIndex ); - /** Removes a field from the specified index. */ - void DelField( size_t nDelIndex ); - /** Removes all fields. */ - void ClearFields(); - /** Changes the text on an existing field. */ - void SetFieldText( const String& rText, size_t nIndex ); - /** Returns the text of an existing field. */ - const String& GetFieldText( size_t nIndex ) const; - - /** Inserts a field using the specified pixel position. - @param rPos The coordinates to insert the field. - @param rnIndex The new index of the field is returned here. - @return sal_True, if the field has been created. */ - bool AddField( const String& rText, const Point& rPos, size_t& rnIndex ); - /** Calculates the field index at a specific pixel position. - @param rnIndex The index of the field is returned here. - @return sal_True, if the index value is valid. */ - bool GetFieldIndex( const Point& rPos, size_t& rnIndex ) const; - /** Calculates a field index at a specific pixel position. Returns in every - case the index of an existing field. - @param rnIndex The index of the field is returned here. - @return sal_True, if the index value is valid. */ - void GetExistingIndex( const Point& rPos, size_t& rnIndex ); - - /** Notifies this control that the offset of the first field has been changed. - The control has to adjust the selection to keep the same field selected - on scrolling with scrollbar. */ - void ModifySelectionOffset( long nOffsetDiff ); - /** Selects the next field. Called i.e. after moving a field from SELECT area. */ - void SelectNext(); - - /** @return The name of the control without shortcut. */ - inline String GetName() const { return aName; } - - /** @return The description of the control which is used for the accessibility objects. */ - String GetDescription() const; - - /** Grabs focus and sets new selection. */ - void GrabFocusWithSel( size_t nIndex ); - - /** @return The type of the FieldWindow. */ - inline ScDPFieldType GetType() const { return eType; } + DECL_LINK( ScrollHdl, ScrollBar* ); + +private: + typedef ::std::vector< ScPivotWindowField > ScPivotWindowFieldVector; + + ScPivotLayoutDlg* mpDialog; /// Parent pivot table dialog. + ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > + mxAccessible; /// Weak reference to the accessible object. + ScAccessibleDataPilotControl* + mpAccessible; /// Pointer to the accessible implementation. + ScrollBar& mrScrollBar; /// Scrollbar of the select window. + FixedText* mpFtCaption; /// Associated fixedtext control with caption text and mnemonic. + ::rtl::OUString maName; /// Name of the control, used for accessibility. + ScPivotWindowFieldVector maFields; /// Vector with all fields contained in this window. + Size maFieldSize; /// Size of a single field in pixels. + Size maSpaceSize; /// Size between fields in pixels. + ScPivotFieldType meFieldType; /// Type of this field window. + PointerStyle meDropPointer; /// Mouse pointer style for tracking over this window. + size_t mnColCount; /// Number of field columns. + size_t mnRowCount; /// Number of field rows. + size_t mnLineSize; /// Number of fields per line (depending on scrolling orientation). + size_t mnPageSize; /// Number of visible fields. + size_t mnFirstVisIndex; /// Index of first visible field (scrolling offset). + size_t mnSelectIndex; /// Currently selected field. + size_t mnInsCursorIndex; /// Position of the insertion cursor. + size_t mnOldFirstVisIndex; /// Stores original scroll position during auto scrolling. + size_t mnAutoScrollDelay; /// Initial counter before auto scrolling starts on tracking. + bool mbVertical; /// True = sort fields vertically. + bool mbIsTrackingSource; /// True = this field window is the source while tracking. }; -//=================================================================== +// ============================================================================ -#endif // SC_FIELDWND_HXX +#endif diff --git a/sc/source/ui/inc/filldlg.hxx b/sc/source/ui/inc/filldlg.hxx index 2bdc42b90881..49173487ef56 100644 --- a/sc/source/ui/inc/filldlg.hxx +++ b/sc/source/ui/inc/filldlg.hxx @@ -79,6 +79,15 @@ public: void SetEdStartValEnabled(sal_Bool bFlag=sal_False); private: + FixedText aFtStartVal; + Edit aEdStartVal; + String aStartStrVal; + + FixedText aFtEndVal; + Edit aEdEndVal; + + FixedText aFtIncrement; + Edit aEdIncrement; FixedLine aFlDirection; RadioButton aBtnDown; RadioButton aBtnRight; @@ -98,17 +107,7 @@ private: RadioButton aBtnDayOfWeek; RadioButton aBtnMonth; RadioButton aBtnYear; - - sal_Bool bStartValFlag; - FixedText aFtStartVal; - Edit aEdStartVal; - String aStartStrVal; - - FixedText aFtEndVal; - Edit aEdEndVal; - - FixedText aFtIncrement; - Edit aEdIncrement; + sal_Bool bStartValFlag; OKButton aBtnOk; CancelButton aBtnCancel; diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index 885a5b68e7e2..16cad04b60b8 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -216,8 +216,8 @@ public: virtual sal_Bool Close(); private: - ListBox aLbFilterArea; FixedText aFtFilterArea; + ListBox aLbFilterArea; formula::RefEdit aEdFilterArea; formula::RefButton aRbFilterArea; diff --git a/sc/source/ui/inc/filter.hrc b/sc/source/ui/inc/filter.hrc index 508c5af9aab5..f62c4d5e015e 100644 --- a/sc/source/ui/inc/filter.hrc +++ b/sc/source/ui/inc/filter.hrc @@ -80,3 +80,10 @@ #define ED_CRITERIA_AREA 52 #define RB_CRITERIA_AREA 53 +//IAccessibility2 Implementation 2009----- +#define STR_COPY_AREA_TO 5054 +#define RID_FILTER_OPERATOR 5055 +#define RID_FILTER_FIELDNAME 5056 +#define RID_FILTER_CONDITION 5057 +#define RID_FILTER_VALUE 5058 +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx index eba954ee76ea..31a6569b9dd1 100644 --- a/sc/source/ui/inc/imoptdlg.hxx +++ b/sc/source/ui/inc/imoptdlg.hxx @@ -45,18 +45,18 @@ public: ScImportOptions() : nFieldSepCode(0), nTextSepCode(0), eCharSet(RTL_TEXTENCODING_DONTKNOW), bFixedWidth(sal_False), - bSaveAsShown(sal_False) + bSaveAsShown(sal_False), bQuoteAllText(sal_False) {} ScImportOptions( const String& rStr ); ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, const String& rStr ) : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep), aStrFont(rStr), - bFixedWidth(sal_False), bSaveAsShown(sal_False) + bFixedWidth(sal_False), bSaveAsShown(sal_False), bQuoteAllText(sal_False) { eCharSet = ScGlobal::GetCharsetValue(aStrFont); } ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc ) : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep), - bFixedWidth(sal_False), bSaveAsShown(sal_False) + bFixedWidth(sal_False), bSaveAsShown(sal_False), bQuoteAllText(sal_False) { SetTextEncoding( nEnc ); } ScImportOptions( const ScImportOptions& rCpy ) @@ -65,7 +65,8 @@ public: aStrFont (rCpy.aStrFont), eCharSet (rCpy.eCharSet), bFixedWidth (rCpy.bFixedWidth), - bSaveAsShown (rCpy.bSaveAsShown) + bSaveAsShown (rCpy.bSaveAsShown), + bQuoteAllText (rCpy.bQuoteAllText) {} ScImportOptions& operator=( const ScImportOptions& rCpy ) @@ -76,6 +77,7 @@ public: eCharSet = rCpy.eCharSet; bFixedWidth = rCpy.bFixedWidth; bSaveAsShown = rCpy.bSaveAsShown; + bQuoteAllText = rCpy.bQuoteAllText; return *this; } @@ -87,7 +89,8 @@ public: && eCharSet == rCmp.eCharSet && aStrFont == rCmp.aStrFont && bFixedWidth == rCmp.bFixedWidth - && bSaveAsShown == rCmp.bSaveAsShown; + && bSaveAsShown == rCmp.bSaveAsShown + && bQuoteAllText == rCmp.bQuoteAllText; } String BuildString() const; @@ -97,8 +100,9 @@ public: sal_Unicode nTextSepCode; String aStrFont; CharSet eCharSet; - sal_Bool bFixedWidth; - sal_Bool bSaveAsShown; + sal_Bool bFixedWidth; + sal_Bool bSaveAsShown; + sal_Bool bQuoteAllText; }; diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index 73e07f0d79fc..ba738b3eea86 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -83,9 +83,10 @@ public: SCTAB GetTableCount() { return nTableCount;} private: + FixedLine aFlPos; RadioButton aBtnBefore; RadioButton aBtnBehind; - FixedLine aFlPos; + FixedLine aFlTable; RadioButton aBtnNew; RadioButton aBtnFromFile; FixedText aFtCount; @@ -96,7 +97,6 @@ private: ScExpandedFixedText aFtPath; PushButton aBtnBrowse; CheckBox aBtnLink; - FixedLine aFlTable; OKButton aBtnOk; CancelButton aBtnCancel; HelpButton aBtnHelp; diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index cd691211dbfb..4e2b64f33f42 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -31,21 +31,11 @@ #include <com/sun/star/sheet/DataPilotFieldReference.hpp> #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> -#ifndef _FIXED_HXX #include <vcl/fixed.hxx> -#endif -#ifndef _LSTBOX_HXX #include <vcl/lstbox.hxx> -#endif -#ifndef _DIALOG_HXX #include <vcl/dialog.hxx> -#endif -#ifndef _BUTTON_HXX #include <vcl/button.hxx> -#endif -#ifndef _MOREBTN_HXX #include <vcl/morebtn.hxx> -#endif #include <vcl/field.hxx> #include <svtools/stdctrl.hxx> #include <svx/checklbx.hxx> @@ -79,14 +69,14 @@ private: class ScDPFunctionDlg : public ModalDialog { public: - explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVec& rLabelVec, - const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); + explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec, + const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); sal_uInt16 GetFuncMask() const; ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const; private: - void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); + void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); DECL_LINK( SelectHdl, ListBox* ); DECL_LINK( DblClickHdl, MultiListBox* ); @@ -110,7 +100,7 @@ private: ScDPListBoxWrapper maLbTypeWrp; /// Wrapper for direct usage of API constants. - const ScDPLabelDataVec& mrLabelVec; /// Data of all labels. + const ScDPLabelDataVector& mrLabelVec; /// Data of all labels. bool mbEmptyItem; /// true = Empty base item in listbox. }; @@ -120,7 +110,7 @@ class ScDPSubtotalDlg : public ModalDialog { public: explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj, - const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData, + const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ); sal_uInt16 GetFuncMask() const; @@ -128,7 +118,7 @@ public: void FillLabelData( ScDPLabelData& rLabelData ) const; private: - void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); + void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); DECL_LINK( DblClickHdl, MultiListBox* ); DECL_LINK( RadioClickHdl, RadioButton* ); diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx index 45eef2f364fb..d6f12e8c5d49 100644 --- a/sc/source/ui/inc/pvlaydlg.hxx +++ b/sc/source/ui/inc/pvlaydlg.hxx @@ -28,212 +28,135 @@ #ifndef SC_PVLAYDLG_HXX #define SC_PVLAYDLG_HXX -#include <vector> #include <memory> -#include <boost/shared_ptr.hpp> +#include <vector> -#ifndef _LSTBOX_HXX //autogen -#include <vcl/lstbox.hxx> -#endif -#ifndef _SCRBAR_HXX //autogen -#include <vcl/scrbar.hxx> -#endif +#include <formula/funcutl.hxx> #include <svtools/stdctrl.hxx> -#ifndef _MOREBTN_HXX //autogen +#include <vcl/lstbox.hxx> #include <vcl/morebtn.hxx> -#endif -#include "pivot.hxx" +#include <vcl/scrbar.hxx> + #include "anyrefdg.hxx" #include "fieldwnd.hxx" -#include "formula/funcutl.hxx" - -/*==========================================================================*\ - - Eine Instanz der Klasse ScPivotLayoutDlg ist ein (semi-)modaler - Dialog, in dem mit der Maus Felder mit Spaltenueberschriften den - drei Pivot-Kategorien "Spalte", "Zeile" und "Daten" zugeordnet - werden koennen. - Der Dialog erhaelt in der Struktur LabelData Informationen ueber - diese Ueberschriften (Name, Art (Zahl/String) und Funktionsmaske). - Weiterhin werden drei PivotFeld-Arrays uebergeben, mit denen die - drei Kategorie-Fenster initialisiert werden. Ein Kategorie-Fenster - wird durch eine Instanz der Klasse FieldWindow dargestellt. Ein - solches Fenster ist fuer die Darstellung der Datenstrukturen am - Schirm zustaendig. Es meldet Mausaktionen an den Dialog weiter und - bietet entsprechende Methoden zur Veraenderung der Darstellung. - Der Dialog sorgt fuer den Abgleich der interenen Datenstrukturen mit - der Bildschirmdarstellung. Ein weiteres FieldWindow (Select) bietet - alle Tabellenueberschriften zur Auswahl an, ist also "read-only". - -\*==========================================================================*/ - -//============================================================================ +// ============================================================================ class ScViewData; class ScDocument; class ScRangeData; -struct ScDPFuncData; class ScDPObject; -//============================================================================ - -#define FUNC_COUNT 11 +// ============================================================================ -class ScDPLayoutDlg : public ScAnyRefDlg +class ScPivotLayoutDlg : public ScAnyRefDlg { public: - ScDPLayoutDlg( - SfxBindings* pB, - SfxChildWindow* pCW, - Window* pParent, - const ScDPObject& rDPObject ); - virtual ~ScDPLayoutDlg(); - - virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); - virtual sal_Bool IsRefInputMode() const { return bRefInputMode; } - virtual void SetActive(); - virtual sal_Bool Close(); - virtual void StateChanged( StateChangedType nStateChange ); - - void NotifyDoubleClick ( ScDPFieldType eType, size_t nFieldIndex ); - PointerStyle NotifyMouseButtonDown( ScDPFieldType eType, size_t nFieldIndex ); - void NotifyMouseButtonUp ( const Point& rAt ); - PointerStyle NotifyMouseMove ( const Point& rAt ); - void NotifyFieldFocus ( ScDPFieldType eType, sal_Bool bGotFocus ); - void NotifyMoveField ( ScDPFieldType eToType ); - void NotifyRemoveField ( ScDPFieldType eType, size_t nFieldIndex ); - sal_Bool NotifyMoveSlider ( sal_uInt16 nKeyCode ); // return sal_True, if position changed + ScPivotLayoutDlg( + SfxBindings* pB, + SfxChildWindow* pCW, + Window* pParent, + const ScDPObject& rDPObject ); + virtual ~ScPivotLayoutDlg(); + + ScDPLabelData* GetLabelData( SCCOL nCol, size_t* pnIndex = 0 ); + String GetFuncString( sal_uInt16& rnFuncMask, bool bIsValue = true ); + + void NotifyStartTracking( ScPivotFieldWindow& rSourceWindow ); + void NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow ); + void NotifyFieldRemoved( ScPivotFieldWindow& rSourceWindow ); protected: - virtual void Deactivate(); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); + virtual sal_Bool IsRefInputMode() const; + virtual void SetActive(); + virtual sal_Bool Close(); private: - typedef boost::shared_ptr< ScDPFuncData > ScDPFuncDataRef; - typedef std::vector< ScDPFuncDataRef > ScDPFuncDataVec; - typedef std::auto_ptr< ScDPObject > ScDPObjectPtr; - - FixedLine aFlLayout; - FixedText aFtPage; - ScDPFieldWindow aWndPage; - FixedText aFtCol; - ScDPFieldWindow aWndCol; - FixedText aFtRow; - ScDPFieldWindow aWndRow; - FixedText aFtData; - ScDPFieldWindow aWndData; - ScDPFieldWindow aWndSelect; - ScrollBar aSlider; - FixedInfo aFtInfo; - - FixedLine aFlAreas; - - // DP source selection - FixedText aFtInArea; - ::formula::RefEdit aEdInPos; - ::formula::RefButton aRbInPos; - - // DP output location - ListBox aLbOutPos; - FixedText aFtOutArea; - formula::RefEdit aEdOutPos; - formula::RefButton aRbOutPos; - - CheckBox aBtnIgnEmptyRows; - CheckBox aBtnDetectCat; - CheckBox aBtnTotalCol; - CheckBox aBtnTotalRow; - CheckBox aBtnFilter; - CheckBox aBtnDrillDown; - - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - PushButton aBtnRemove; - PushButton aBtnOptions; - MoreButton aBtnMore; - - const String aStrUndefined; - const String aStrNewTable; - std::vector< String > aFuncNameArr; - - ScDPFieldType eDnDFromType; - size_t nDnDFromIndex; - sal_Bool bIsDrag; - - ::formula::RefEdit* pEditActive; - - Rectangle aRectPage; - Rectangle aRectRow; - Rectangle aRectCol; - Rectangle aRectData; - Rectangle aRectSelect; - - ScDPLabelDataVec aLabelDataArr; // (nCol, Feldname, Zahl/Text) - - ScDPFieldType eLastActiveType; /// Type of last active area. - size_t nOffset; /// Offset of first field in TYPE_SELECT area. - - ScDPFuncDataVec aSelectArr; - ScDPFuncDataVec aPageArr; - ScDPFuncDataVec aColArr; - ScDPFuncDataVec aRowArr; - ScDPFuncDataVec aDataArr; - - ScDPObjectPtr xDlgDPObject; - ScRange aOldRange; - ScPivotParam thePivotData; - ScViewData* pViewData; - ScDocument* pDoc; - sal_Bool bRefInputMode; + /** Returns the localized function name for the specified (1-based) resource index. */ + inline const String& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[ nFuncIdx - 1 ]; } + /** Returns the specified field window. */ + ScPivotFieldWindow& GetFieldWindow( ScPivotFieldType eFieldType ); -private: - ScDPFieldWindow& GetFieldWindow ( ScDPFieldType eType ); - void Init (); - void InitWndSelect ( const ::std::vector<ScDPLabelDataRef>& rLabels ); - void InitWnd ( PivotField* pArr, long nCount, ScDPFieldType eType ); - void InitFocus (); - void InitFields (); - void CalcWndSizes (); - Point DlgPos2WndPos ( const Point& rPt, Window& rWnd ); - ScDPLabelData* GetLabelData ( SCsCOL nCol, size_t* pPos = NULL ); - String GetLabelString ( SCsCOL nCol ); - bool IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType ); - String GetFuncString ( sal_uInt16& rFuncMask, sal_Bool bIsValue = sal_True ); - sal_Bool Contains ( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt ); - void Remove ( ScDPFuncDataVec* pArr, size_t nAt ); - void Insert ( ScDPFuncDataVec* pArr, const ScDPFuncData& rFData, size_t nAt ); - - void AddField ( size_t nFromIndex, - ScDPFieldType eToType, const Point& rAtPos ); - void MoveField ( ScDPFieldType eFromType, size_t nFromIndex, - ScDPFieldType eToType, const Point& rAtPos ); - void RemoveField ( ScDPFieldType eRemType, size_t nRemIndex ); - - sal_Bool GetPivotArrays ( PivotField* pPageArr, - PivotField* pColArr, - PivotField* pRowArr, - PivotField* pDataArr, - sal_uInt16& rPageCount, - sal_uInt16& rColCount, - sal_uInt16& rRowCount, - sal_uInt16& rDataCount ); - - void UpdateSrcRange(); + /** Fills the field windows from the current pivot table settings. */ + void InitFieldWindows(); + /** Sets focus to the specified field window, if it is not empty. */ + void GrabFieldFocus( ScPivotFieldWindow& rFieldWindow ); + + /** Returns true, if the specified field can be inserted into the specified field window. */ + bool IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow ); + /** Moves the selected field in the source window to the specified window. */ + bool MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting ); // Handler DECL_LINK( ClickHdl, PushButton * ); - DECL_LINK( ScrollHdl, ScrollBar * ); - DECL_LINK( SelAreaHdl, ListBox * ); - DECL_LINK( MoreClickHdl, MoreButton * ); - DECL_LINK( EdModifyHdl, Edit * ); - DECL_LINK( EdInModifyHdl, Edit * ); DECL_LINK( OkHdl, OKButton * ); DECL_LINK( CancelHdl, CancelButton * ); - DECL_LINK( GetFocusHdl, Control* ); -}; - + DECL_LINK( MoreClickHdl, MoreButton * ); + DECL_LINK( EdOutModifyHdl, Edit * ); + DECL_LINK( EdInModifyHdl, Edit * ); + DECL_LINK( SelAreaHdl, ListBox * ); + DECL_LINK( ChildEventListener, VclWindowEvent* ); +private: + typedef ::std::auto_ptr< ScDPObject > ScDPObjectPtr; + + FixedLine maFlLayout; + ScrollBar maScrPage; + FixedText maFtPage; + ScPivotFieldWindow maWndPage; + ScrollBar maScrCol; + FixedText maFtCol; + ScPivotFieldWindow maWndCol; + ScrollBar maScrRow; + FixedText maFtRow; + ScPivotFieldWindow maWndRow; + ScrollBar maScrData; + FixedText maFtData; + ScPivotFieldWindow maWndData; + FixedLine maFlSelect; + ScrollBar maScrSelect; + ScPivotFieldWindow maWndSelect; + FixedInfo maFtInfo; + + FixedLine maFlAreas; + FixedText maFtInArea; + ::formula::RefEdit maEdInPos; + ::formula::RefButton maRbInPos; + ListBox maLbOutPos; + FixedText maFtOutArea; + formula::RefEdit maEdOutPos; + formula::RefButton maRbOutPos; + CheckBox maBtnIgnEmptyRows; + CheckBox maBtnDetectCat; + CheckBox maBtnTotalCol; + CheckBox maBtnTotalRow; + CheckBox maBtnFilter; + CheckBox maBtnDrillDown; + + OKButton maBtnOk; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + PushButton maBtnRemove; + PushButton maBtnOptions; + MoreButton maBtnMore; + + ::std::vector< String > maFuncNames; /// Localized function names from resource. + + ScDPObjectPtr mxDlgDPObject; /// Clone of the pivot table object this dialog is based on. + ScPivotParam maPivotData; /// The pivot table field configuration. + ScDPLabelDataVector maLabelData; /// Information about all dimensions. + + ScViewData* mpViewData; + ScDocument* mpDoc; + ScPivotFieldWindow* mpFocusWindow; /// Pointer to the field window that currently has the focus. + ScPivotFieldWindow* mpTrackingWindow; /// Pointer to the field window that has started mouse tracking. + ScPivotFieldWindow* mpDropWindow; /// Pointer to the field window that shows an insertion cursor. + ::formula::RefEdit* mpActiveEdit; + bool mbRefInputMode; +}; -#endif // SC_PVLAYDLG_HXX +// ============================================================================ +#endif diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx index 5b92f31baa51..08215d99e98d 100644 --- a/sc/source/ui/inc/scuiimoptdlg.hxx +++ b/sc/source/ui/inc/scuiimoptdlg.hxx @@ -58,11 +58,12 @@ private: ComboBox aEdFieldSep; FixedText aFtTextSep; ComboBox aEdTextSep; + CheckBox aCbQuoteAll; + CheckBox aCbShown; CheckBox aCbFixed; OKButton aBtnOk; CancelButton aBtnCancel; HelpButton aBtnHelp; - CheckBox aCbShown; ScDelimiterTable* pFieldSepTab; ScDelimiterTable* pTextSepTab; diff --git a/sc/source/ui/inc/shtabdlg.hxx b/sc/source/ui/inc/shtabdlg.hxx index 6da486588cee..07801cb9bba6 100644 --- a/sc/source/ui/inc/shtabdlg.hxx +++ b/sc/source/ui/inc/shtabdlg.hxx @@ -44,11 +44,11 @@ class ScShowTabDlg : public ModalDialog { private: + FixedText aFtLbTitle; ::svtools::ToolTipMultiListBox aLb; OKButton aBtnOk; CancelButton aBtnCancel; HelpButton aBtnHelp; - FixedText aFtLbTitle; DECL_LINK( DblClkHdl, void * ); diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 1f8dab142c8f..2acd7003556a 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -114,6 +114,9 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB, xRowNameRanges = pDoc->GetRowNameRanges()->Clone(); Init(); FreeResource(); + + aRbAssign.SetAccessibleRelationMemberOf(&aEdAssign); + aRbAssign2.SetAccessibleRelationMemberOf(&aEdAssign); } diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index 67584198bce8..042dbc175f07 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -65,6 +65,16 @@ ScFillSeriesDlg::ScFillSeriesDlg( Window* pParent, : ModalDialog ( pParent, ScResId( RID_SCDLG_FILLSERIES ) ), + aFtStartVal ( this, ScResId( FT_START_VALUE ) ), + aEdStartVal ( this, ScResId( ED_START_VALUES ) ), + aStartStrVal ( aStartStr), + + aFtEndVal ( this, ScResId( FT_END_VALUE ) ), + aEdEndVal ( this, ScResId( ED_END_VALUES ) ), + + aFtIncrement ( this, ScResId( FT_INCREMENT ) ), + aEdIncrement ( this, ScResId( ED_INCREMENT ) ), + aFlDirection ( this, ScResId( FL_DIRECTION ) ), aBtnDown ( this, ScResId( BTN_BOTTOM ) ), aBtnRight ( this, ScResId( BTN_RIGHT ) ), @@ -83,14 +93,6 @@ ScFillSeriesDlg::ScFillSeriesDlg( Window* pParent, aBtnMonth ( this, ScResId( BTN_MONTH ) ), aBtnYear ( this, ScResId( BTN_YEAR ) ), - aFtStartVal ( this, ScResId( FT_START_VALUE ) ), - aEdStartVal ( this, ScResId( ED_START_VALUES ) ), - aStartStrVal ( aStartStr), - aFtEndVal ( this, ScResId( FT_END_VALUE ) ), - aEdEndVal ( this, ScResId( ED_END_VALUES ) ), - aFtIncrement ( this, ScResId( FT_INCREMENT ) ), - aEdIncrement ( this, ScResId( ED_INCREMENT ) ), - aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), aBtnHelp ( this, ScResId( BTN_HELP ) ), diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index 05c807b8e1f4..0b0a4de9f985 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -110,6 +110,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Wind Init(); } + ScHighlightChgDlg::~ScHighlightChgDlg() { SetDispatcherLock( sal_False ); diff --git a/sc/source/ui/miscdlgs/highred.src b/sc/source/ui/miscdlgs/highred.src index dd32eb9b4012..3fa4a62fcd17 100644 --- a/sc/source/ui/miscdlgs/highred.src +++ b/sc/source/ui/miscdlgs/highred.src @@ -100,7 +100,7 @@ ModelessDialog RID_SCDLG_HIGHLIGHT_CHANGES Hide = TRUE ; Pos = MAP_APPFONT ( 142 , 118 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; - TabStop = FALSE ; + TabStop = TRUE; QuickHelpText [ en-US ] = "Minimize/Maximize" ; }; Text [ en-US ] = "Show Changes" ; diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index a4dd2dea32bd..be425ee51bec 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -69,9 +69,10 @@ ScInsertTableDlg::ScInsertTableDlg( Window* pParent, ScViewData& rData, SCTAB nT : ModalDialog ( pParent, ScResId( RID_SCDLG_INSERT_TABLE ) ), // + aFlPos ( this, ScResId( FL_POSITION ) ), aBtnBefore ( this, ScResId( RB_BEFORE ) ), aBtnBehind ( this, ScResId( RB_BEHIND ) ), - aFlPos ( this, ScResId( FL_POSITION ) ), + aFlTable ( this, ScResId( FL_TABLE ) ), aBtnNew ( this, ScResId( RB_NEW ) ), aBtnFromFile ( this, ScResId( RB_FROMFILE ) ), aFtCount ( this, ScResId( FT_COUNT ) ), @@ -82,7 +83,6 @@ ScInsertTableDlg::ScInsertTableDlg( Window* pParent, ScViewData& rData, SCTAB nT aFtPath ( this, ScResId( FT_PATH ) ), aBtnBrowse ( this, ScResId( BTN_BROWSE ) ), aBtnLink ( this, ScResId( CB_LINK ) ), - aFlTable ( this, ScResId( FL_TABLE ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), aBtnHelp ( this, ScResId( BTN_HELP ) ), @@ -100,6 +100,7 @@ ScInsertTableDlg::ScInsertTableDlg( Window* pParent, ScViewData& rData, SCTAB nT #endif /* ENABLE_LAYOUT */ Init_Impl( bFromFile ); FreeResource(); + aLbTables.SetAccessibleName(aBtnFromFile.GetText()); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 9d629bec38e3..3ba5b2952cf1 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -82,6 +82,9 @@ ScLinkedAreaDlg::ScLinkedAreaDlg( Window* pParent ) : aLbRanges.SetSelectHdl( LINK( this, ScLinkedAreaDlg, RangeHdl ) ); aBtnReload.SetClickHdl( LINK( this, ScLinkedAreaDlg, ReloadHdl ) ); UpdateEnable(); + + aNfDelay.SetAccessibleName(aBtnReload.GetText()); + aNfDelay.SetAccessibleRelationLabeledBy(&aBtnReload); } ScLinkedAreaDlg::~ScLinkedAreaDlg() diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 2972395d1916..c158a7035691 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -269,6 +269,19 @@ ScOptSolverDlg::ScOptSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pP mpOperator[3] = &maLbOp4; mpDelButton[3] = &maBtnDel4; + maRbMax.SetAccessibleRelationMemberOf(&maFtDirection); + maRbMin.SetAccessibleRelationMemberOf(&maFtDirection); + maRbValue.SetAccessibleRelationMemberOf(&maFtDirection); + maEdLeft2.SetAccessibleName(maFtCellRef.GetText()); + maLbOp2.SetAccessibleName(maFtOperator.GetText()); + maEdRight2.SetAccessibleName(maFtConstraint.GetText()); + maEdLeft3.SetAccessibleName(maFtCellRef.GetText()); + maLbOp3.SetAccessibleName(maFtOperator.GetText()); + maEdRight3.SetAccessibleName(maFtConstraint.GetText()); + maEdLeft4.SetAccessibleName(maFtCellRef.GetText()); + maLbOp4.SetAccessibleName(maFtOperator.GetText()); + maEdRight4.SetAccessibleName(maFtConstraint.GetText()); + Init( aCursorPos ); FreeResource(); } diff --git a/sc/source/ui/miscdlgs/shtabdlg.cxx b/sc/source/ui/miscdlgs/shtabdlg.cxx index 62cdaad524f9..cf0059a12ceb 100644 --- a/sc/source/ui/miscdlgs/shtabdlg.cxx +++ b/sc/source/ui/miscdlgs/shtabdlg.cxx @@ -45,11 +45,11 @@ ScShowTabDlg::ScShowTabDlg( Window* pParent ) : ModalDialog ( pParent, ScResId( RID_SCDLG_SHOW_TAB ) ), + aFtLbTitle ( this, ScResId( FT_LABEL ) ), aLb ( this, ScResId( LB_ENTRYLIST ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aFtLbTitle ( this, ScResId( FT_LABEL ) ) + aBtnHelp ( this, ScResId( BTN_HELP ) ) { aLb.Clear(); aLb.SetDoubleClickHdl( LINK( this, ScShowTabDlg, DblClkHdl ) ); diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index 2e9751a8e4d6..e3e58b8f75ad 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -88,6 +88,9 @@ ScSolverDlg::ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, { Init(); FreeResource(); + + aRBFormulaCell.SetAccessibleRelationMemberOf(&aFlVariables); + aRBVariableCell.SetAccessibleRelationMemberOf(&aFlVariables); } //---------------------------------------------------------------------------- diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 1b1494269c06..0a3b0c4603a4 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -154,6 +154,8 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, pSaveObj = new SaveData; Init(); FreeResource(); + + aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 3576e5f3c877..a4dcaa801624 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -767,6 +767,10 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win aContentTimer.SetTimeout( SC_CONTENT_TIMEOUT ); FreeResource(); + + aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries); + aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd); + aLbDocuments.SetAccessibleName(aStrActiveWin); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index fc9933b49035..719f954ed594 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -112,18 +112,18 @@ static void printAddressFlags(sal_uInt16 nFlag) ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent ) : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_AREAS), // - aLbPrintArea ( this, ScResId( LB_PRINTAREA ) ), aFlPrintArea ( this, ScResId( FL_PRINTAREA ) ), + aLbPrintArea ( this, ScResId( LB_PRINTAREA ) ), aEdPrintArea ( this, this, ScResId( ED_PRINTAREA ) ), aRbPrintArea ( this, ScResId( RB_PRINTAREA ), &aEdPrintArea, this ), // - aLbRepeatRow ( this, ScResId( LB_REPEATROW ) ), aFlRepeatRow ( this, ScResId( FL_REPEATROW ) ), + aLbRepeatRow ( this, ScResId( LB_REPEATROW ) ), aEdRepeatRow ( this, this, ScResId( ED_REPEATROW ) ), aRbRepeatRow ( this, ScResId( RB_REPEATROW ), &aEdRepeatRow, this ), // - aLbRepeatCol ( this, ScResId( LB_REPEATCOL ) ), aFlRepeatCol ( this, ScResId( FL_REPEATCOL ) ), + aLbRepeatCol ( this, ScResId( LB_REPEATCOL ) ), aEdRepeatCol ( this, this, ScResId( ED_REPEATCOL ) ), aRbRepeatCol ( this, ScResId( RB_REPEATCOL ), &aEdRepeatCol, this ), // diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index c614c22651ec..e4a73d24aa01 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -101,6 +101,8 @@ ScHFPage::ScHFPage( Window* pParent, sal_uInt16 nResId, aBtnEdit.SetHelpId( HID_SC_HEADER_EDIT ); else aBtnEdit.SetHelpId( HID_SC_FOOTER_EDIT ); + + aBtnEdit.SetAccessibleRelationMemberOf(&aFrm); } //------------------------------------------------------------------ diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx index f1b20238d240..56f8dbaf4689 100644 --- a/sc/source/ui/pagedlg/tptable.cxx +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -162,6 +162,9 @@ ScTablePage::ScTablePage( Window* pParent, const SfxItemSet& rCoreAttrs ) : aBmpPageDir.SetOutputSizePixel( aBmpSize ); FreeResource(); + + aEdPageNo.SetAccessibleName(aBtnPageNo.GetText()); + aEdPageNo.SetAccessibleRelationLabeledBy(&aBtnPageNo); } // ----------------------------------------------------------------------- diff --git a/sc/source/ui/src/condfrmt.src b/sc/source/ui/src/condfrmt.src index 4cd79a2ffc3d..4adc735a7f2d 100644 --- a/sc/source/ui/src/condfrmt.src +++ b/sc/source/ui/src/condfrmt.src @@ -385,41 +385,16 @@ ModelessDialog RID_SCDLG_CONDFORMAT Text [ en-US ] = "Conditional Formatting" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +String LABEL_FORMARTTING_CONDITIONS +{ + Text [ en-US ] = "Formatting Conditions" ; +}; +String LABEL_CONDITIONS +{ + Text [ en-US ] = "Conditions" ; +}; +String LABEL_CONDITION_VALUE +{ + Text [ en-US ] = "Condition Value" ; +}; diff --git a/sc/source/ui/src/filter.src b/sc/source/ui/src/filter.src index eed896330b0e..ed501b782a8d 100644 --- a/sc/source/ui/src/filter.src +++ b/sc/source/ui/src/filter.src @@ -872,3 +872,23 @@ ModalDialog RID_SCDLG_PIVOTFILTER }; }; +String STR_COPY_AREA_TO +{ + Text [ en-US ] = "Copy results to" ; +}; +String RID_FILTER_OPERATOR +{ + Text [ en-US ] = "Operator" ; +}; +String RID_FILTER_FIELDNAME +{ + Text [ en-US ] = "Field Name" ; +}; +String RID_FILTER_CONDITION +{ + Text [ en-US ] = "Condition" ; +}; +String RID_FILTER_VALUE +{ + Text [ en-US ] = "Value" ; +}; diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 6c15762bda6a..30787b6e3b84 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -201,15 +201,15 @@ Resource RID_GLOBSTR }; String STR_UNDO_PIVOT_NEW { - Text [ en-US ] = "Create DataPilot Table" ; + Text [ en-US ] = "Create pivot table" ; }; String STR_UNDO_PIVOT_MODIFY { - Text [ en-US ] = "Edit DataPilot Table" ; + Text [ en-US ] = "Edit pivot table" ; }; String STR_UNDO_PIVOT_DELETE { - Text [ en-US ] = "Delete DataPilot Table" ; + Text [ en-US ] = "Delete pivot table" ; }; String STR_UNDO_CONSOLIDATE { @@ -525,7 +525,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_NODATA { - Text [ en-US ] = "The DataPilot table must contain at least one entry." ; + Text [ en-US ] = "The pivot table must contain at least one entry." ; }; String STR_PIVOT_MOVENOTALLOWED { @@ -533,11 +533,11 @@ Resource RID_GLOBSTR }; String STR_PIVOT_ERROR { - Text [ en-US ] = "Error creating the Data Pilot Table." ; + Text [ en-US ] = "Error creating the pivot table." ; }; String STR_PIVOT_OVERLAP { - Text [ en-US ] = "DataPilot tables can not overlap." ; + Text [ en-US ] = "Pivot tables can not overlap." ; }; String STR_PIVOT_NOTEMPTY { @@ -549,7 +549,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_PROGRESS { - Text [ en-US ] = "Create DataPilot Table" ; + Text [ en-US ] = "Create Pivot Table" ; }; String STR_PIVOT_TOTAL { @@ -693,7 +693,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_TABLE { - Text [ en-US ] = "DataPilot" ; + Text [ en-US ] = "Pivot Table" ; }; // Text strings for captions of subtotal functions. String STR_FUN_TEXT_SUM @@ -738,7 +738,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_NOTFOUND { - Text [ en-US ] = "No DataPilot table found at this position." ; + Text [ en-US ] = "No pivot table found at this position." ; }; String STR_EMPTYDATA { @@ -1037,7 +1037,7 @@ Resource RID_GLOBSTR }; String STR_EXPORT_ASCII { - Text [ en-US ] = "Export of text files" ; + Text [ en-US ] = "Export Text File" ; }; String STR_IMPORT_LOTUS { @@ -1470,27 +1470,27 @@ Resource RID_GLOBSTR // Templates for data pilot tables. String STR_PIVOT_STYLE_INNER { - Text [ en-US ] = "DataPilot Value" ; + Text [ en-US ] = "Pivot Table Value" ; }; String STR_PIVOT_STYLE_RESULT { - Text [ en-US ] = "DataPilot Result" ; + Text [ en-US ] = "Pivot Table Result" ; }; String STR_PIVOT_STYLE_CATEGORY { - Text [ en-US ] = "DataPilot Category" ; + Text [ en-US ] = "Pivot Table Category" ; }; String STR_PIVOT_STYLE_TITLE { - Text [ en-US ] = "DataPilot Title" ; + Text [ en-US ] = "Pivot Table Title" ; }; String STR_PIVOT_STYLE_FIELDNAME { - Text [ en-US ] = "DataPilot Field" ; + Text [ en-US ] = "Pivot Table Field" ; }; String STR_PIVOT_STYLE_TOP { - Text [ en-US ] = "DataPilot Corner" ; + Text [ en-US ] = "Pivot Table Corner" ; }; String STR_OPERATION_FILTER { @@ -1663,7 +1663,7 @@ Resource RID_GLOBSTR String STR_ERR_DATAPILOT_INPUT { - Text[ en-US ] = "You cannot change this part of the DataPilot table."; + Text[ en-US ] = "You cannot change this part of the pivot table."; }; String STR_RECALC_MANUAL @@ -1728,7 +1728,7 @@ Resource RID_GLOBSTR }; String STR_ERR_DATAPILOTSOURCE { - Text [ en-US ] = "DataPilot source data is invalid."; + Text [ en-US ] = "Pivot table source data is invalid."; }; String STR_PIVOT_FIRSTROWEMPTYERR { @@ -1736,7 +1736,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_ONLYONEROWERR { - Text [ en-US ] = "DataPilot table needs at least two rows of data to create or refresh." ; + Text [ en-US ] = "Pivot table needs at least two rows of data to create or refresh." ; }; }; diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src index a466823581bf..e16f60acd7fc 100644 --- a/sc/source/ui/src/popup.src +++ b/sc/source/ui/src/popup.src @@ -210,7 +210,7 @@ Menu RID_POPUP_TAB String RID_POPUP_PIVOT { - Text [ en-US ] = "DataPilot pop-up menu" ; + Text [ en-US ] = "Pivot table pop-up menu" ; }; Menu RID_POPUP_PIVOT @@ -221,7 +221,7 @@ Menu RID_POPUP_PIVOT { Identifier = SID_OPENDLG_PIVOTTABLE ; HelpId = CMD_SID_OPENDLG_PIVOTTABLE ; - Text [ en-US ] = "~Start..." ; + Text [ en-US ] = "~Edit Layout..." ; }; MenuItem { diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 129ed62a6c15..4f99f90b8437 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -7894,7 +7894,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { String 1 // Description { - Text [ en-US ] = "Extracts value(s) from a DataPilot table."; + Text [ en-US ] = "Extracts value(s) from a pivot table."; }; ExtraData = { @@ -7910,15 +7910,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The name of the data pilot field to extract."; + Text [ en-US ] = "The name of the pivot table field to extract."; }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "DataPilot"; + Text [ en-US ] = "Pivot Table"; }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "A reference to a cell or range in the DataPilot table."; + Text [ en-US ] = "A reference to a cell or range in the pivot table."; }; String 6 // Name of Parameter 3 { diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index 17b7b99b2e04..071eedf4a4a0 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -136,7 +136,7 @@ String SCSTR_PREVIEWSHELL String SCSTR_PIVOTSHELL { - Text [ en-US ] = "Data Pilot Tables" ; + Text [ en-US ] = "Pivot Tables" ; }; String SCSTR_AUDITSHELL @@ -700,17 +700,17 @@ String STR_ACC_EDITCELL_DESCR String STR_ACC_DATAPILOT_ROW_DESCR { - Text [ en-US ] = "Fields that you drop here will be displayed as rows in the final DataPilot table."; + Text [ en-US ] = "Fields that you drop here will be displayed as rows in the final pivot table."; }; String STR_ACC_DATAPILOT_COL_DESCR { - Text [ en-US ] = "Fields that you drop here will be displayed as columns in the final DataPilot table."; + Text [ en-US ] = "Fields that you drop here will be displayed as columns in the final pivot table."; }; String STR_ACC_DATAPILOT_DATA_DESCR { - Text [ en-US ] = "Fields that you drop here will be used for calculations in the final DataPilot table."; + Text [ en-US ] = "Fields that you drop here will be used for calculations in the final pivot table."; }; String STR_ACC_DATAPILOT_SEL_DESCR @@ -728,6 +728,23 @@ String RID_SCSTR_ONCLICK Text [ en-US ] = "Mouse button pressed"; }; +String STR_ACC_TOOLBAR_FORMULA +{ + Text [ en-US ] = "Formula Tool Bar"; +}; +String STR_ACC_DOC_SPREADSHEET +{ + Text [ en-US ] = "%PRODUCTNAME Spreadsheets"; +}; +String STR_ACC_DOC_SPREADSHEET_READONLY +{ + Text [ en-US ] = "(read-only)"; +}; +String STR_ACC_DOC_PREVIEW_SUFFIX +{ + Text [ en-US ] = "(Preview mode)"; +}; + String SCSTR_MOREBTN_MOREOPTIONS { Text [ en-US ] = "More ~Options"; diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 4a3689653ab6..67cc1d318fdb 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -471,10 +471,10 @@ void ScGridWindow::DPLaunchFieldPopupMenu( // out-of-bound dimension ID. This should never happen! return; - const ScDPLabelData& rLabelData = *pDPData->maDPParam.maLabelArray[pDPData->mnDim]; + const ScDPLabelData& rLabelData = pDPData->maDPParam.maLabelArray[pDPData->mnDim]; mpDPFieldPopup.reset(new ScDPFieldPopupWindow(this, pViewData->GetDocument())); - mpDPFieldPopup->setName(OUString::createFromAscii("DataPilot field member popup")); + mpDPFieldPopup->setName(OUString::createFromAscii("Pivot table field member popup")); mpDPFieldPopup->setExtendedData(pDPData.release()); mpDPFieldPopup->setOKAction(new DPFieldPopupOKAction(this)); { @@ -568,7 +568,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() return; // Build a map of layout names to original names. - const ScDPLabelData& rLabelData = *pDPData->maDPParam.maLabelArray[pDPData->mnDim]; + const ScDPLabelData& rLabelData = pDPData->maDPParam.maLabelArray[pDPData->mnDim]; MemNameMapType aMemNameMap; for (vector<ScDPLabelData::Member>::const_iterator itr = rLabelData.maMembers.begin(), itrEnd = rLabelData.maMembers.end(); itr != itrEnd; ++itr) diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 2e829d83e07d..972503656132 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -251,7 +251,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( if( pDialogDPObject ) { GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() ); - pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject ); + pResult = new ScPivotLayoutDlg( pB, pCW, pParent, *pDialogDPObject ); } } break; |