From d719bf21ac56f8d3ab69867ce5df5b2975ea9235 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 12 Nov 2010 19:03:43 +0100 Subject: dr78: #i115189# numerical accuracy of LINEST, LOGEST, TREND and GROWTH; patch from --- sc/source/core/inc/interpre.hxx | 15 +- sc/source/core/tool/interpr4.cxx | 2 +- sc/source/core/tool/interpr5.cxx | 1705 ++++++++++++++++++++++++-------------- 3 files changed, 1086 insertions(+), 636 deletions(-) diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index edecaadb39f0..93c4c23588d1 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -639,7 +639,6 @@ void ScLCM(); void ScMatValue(); void MEMat(ScMatrix* mM, SCSIZE n); -void MFastMult(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR, SCSIZE n, SCSIZE m, SCSIZE l); void ScMatDet(); void ScMatInv(); void ScMatMult(); @@ -652,13 +651,6 @@ void ScSumX2MY2(); void ScSumX2DY2(); void ScSumXMY2(); void ScGrowth(); -// multiple Regression: Varianzen der Koeffizienten -BOOL RGetVariances( ScMatrix* pV, ScMatrix* pX, SCSIZE nC, SCSIZE nR, - BOOL bSwapColRow, BOOL bZeroConstant ); -void Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef& pQ,ScMatrixRef& pV,ScMatrixRef& pMatX,BOOL bConstant,SCSIZE N,SCSIZE M,BYTE nCase); -ScMatrixRef Calculate2(const BOOL bConstant,const SCSIZE M ,const SCSIZE N,ScMatrixRef& pMatX,ScMatrixRef& pMatY,BYTE nCase); -bool Calculate3(const SCSIZE M ,ScMatrixRef& pQ); -bool Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,BOOL bConstant,SCSIZE N,SCSIZE M); bool CalculateSkew(double& fSum,double& fCount,double& vSum,std::vector& values); void CalculateSlopeIntercept(BOOL bSlope); void CalculateSmallLarge(BOOL bSmall); @@ -670,12 +662,11 @@ bool CalculateTest( BOOL _bTemplin void CalculateLookup(BOOL HLookup); bool FillEntry(ScQueryEntry& rEntry); void CalculateAddSub(BOOL _bSub); -void CalculateTrendGrowth(BOOL _bGrowth); -void CalulateRGPRKP(BOOL _bRKP); +void CalculateTrendGrowth(bool _bGrowth); +void CalulateRGPRKP(bool _bRKP); void CalculateSumX2MY2SumX2DY2(BOOL _bSumX2DY2); void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR); -bool CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY); - +bool CheckMatrix(bool _bLOG,BYTE& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY); void ScRGP(); void ScRKP(); void ScForecast(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 47cde7186067..f0a0e9fa495a 100755 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1445,7 +1445,7 @@ bool ScInterpreter::ConvertMatrixParameters() for ( USHORT i=1; i <= nParams && i <= sp; ++i ) { FormulaToken* p = pStack[ sp - i ]; - if ( p->GetOpCode() != ocPush ) + if ( p->GetOpCode() != ocPush && p->GetOpCode() != ocMissing ) { DBG_ERRORFILE( "ConvertMatrixParameters: not a push"); } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 73794cf15b2d..82d43884447e 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -656,25 +656,6 @@ void ScInterpreter::MEMat(ScMatrix* mM, SCSIZE n) mM->PutDouble(1.0, i, i); } -void ScInterpreter::MFastMult(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR, - SCSIZE n, SCSIZE m, SCSIZE l) - // Multipliziert n x m Mat a mit m x l Mat b nach Mat r -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MFastMult" ); - double sum; - for (SCSIZE i = 0; i < n; i++) - { - for (SCSIZE j = 0; j < l; j++) - { - sum = 0.0; - for (SCSIZE k = 0; k < m; k++) - sum += pA->GetDouble(i,k)*pB->GetDouble(k,j); - pR->PutDouble(sum, i, j); - } - } -} - - /* Matrix LUP decomposition according to the pseudocode of "Introduction to * Algorithms" by Cormen, Leiserson, Rivest, Stein. * @@ -779,6 +760,13 @@ static int lcl_LUP_decompose( ScMatrix* mA, const SCSIZE n, fprintf( stderr, "%5u ", (unsigned)P[j]); fprintf( stderr, "\n%s\n", ""); #endif + + bool bSingular=false; + for (SCSIZE i=0; i < n && !bSingular; i++) + bSingular = (mA->GetDouble(i,i) == 0.0); + if (bSingular) + nSign = 0; + return nSign; } @@ -946,7 +934,7 @@ void ScInterpreter::ScMatInv() if (xR) { ScMatrix* pR = xR; - MFastMult( pMat, pY, pR, nR, nR, nR); + lcl_MFastMult( pMat, pY, pR, nR, nR, nR); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "\n%s\n", "ScMatInv(): mult-identity"); #endif @@ -1852,212 +1840,397 @@ void ScInterpreter::ScFrequency() PushMatrix(pResMat); } -BOOL ScInterpreter::RGetVariances( ScMatrix* pV, ScMatrix* pX, - SCSIZE nC, SCSIZE nR, BOOL bSwapColRow, BOOL bZeroConstant ) -{ // multiple Regression: Varianzen der Koeffizienten - // bSwapColRow==TRUE : Koeffizienten in Zeilen statt Spalten angeordnet - SCSIZE i, j, k; +// ----------------------------------------------------------------------------- +// Helper methods for LINEST/LOGEST and TREND/GROWTH +// All matrices must already exist and have the needed size, no control tests +// done. Those methodes, which names start with lcl_T, are adapted to case 3, +// where Y (=observed values) is given as row. +// Remember, ScMatrix matrices are zero based, index access (column,row). +// ----------------------------------------------------------------------------- + +// Multiply n x m Mat A with m x l Mat B to n x l Mat R +void lcl_MFastMult( ScMatrixRef pA, ScMatrixRef pB, ScMatrixRef pR, SCSIZE n, SCSIZE m, SCSIZE l ) +{ double sum; - ScMatrixRef pC = GetNewMat(nC, nC); - if ( !pC ) - return FALSE; - // X transformiert mit X multipziert, X'X Matrix - if ( !bZeroConstant ) - { // in der X-Designmatrix existiert ein gedachtes X0j==1 - if ( bSwapColRow ) - { - for ( i=0; iGetDouble(k,j-1)) - * (i==0 ? 1 : pX->GetDouble(k,i-1)); - } - pC->PutDouble(sum, i, j); - } - } - } - else - { - for ( i=0; iGetDouble(j-1,k)) - * (i==0 ? 1 : pX->GetDouble(i-1,k)); - } - pC->PutDouble(sum, i, j); - } - } + for (SCSIZE row = 0; row < n; row++) + { + for (SCSIZE col = 0; col < l; col++) + { // result element(col, row) =sum[ (row of A) * (column of B)] + sum = 0.0; + for (SCSIZE k = 0; k < m; k++) + sum += pA->GetDouble(k,row) * pB->GetDouble(col,k); + pR->PutDouble(sum, col, row); } } +} + +// over all elements; uses the matrices as vectors of length M +double lcl_GetSumProduct( ScMatrixRef pMatA, ScMatrixRef pMatB, SCSIZE nM ) +{ + double fSum = 0.0; + for (SCSIZE i=0; iGetDouble(i) * pMatB->GetDouble(i); + return fSum; +} + +// Special version for use within QR decomposition. +// Euclidean norm of column index C starting in row index R; +// matrix A has count N rows. +double lcl_GetColumnEuclideanNorm( ScMatrixRef pMatA, SCSIZE nC, SCSIZE nR, SCSIZE nN ) +{ + double fNorm = 0.0; + for (SCSIZE row=nR; rowGetDouble(nC,row)) * (pMatA->GetDouble(nC,row)); + return sqrt(fNorm); +} + +// Euclidean norm of row index R starting in column index C; +// matrix A has count N columns. +double lcl_TGetColumnEuclideanNorm( ScMatrixRef pMatA, SCSIZE nR, SCSIZE nC, SCSIZE nN ) +{ + double fNorm = 0.0; + for (SCSIZE col=nC; colGetDouble(col,nR)) * (pMatA->GetDouble(col,nR)); + return sqrt(fNorm); + } + +// Special version for use within QR decomposition. +// Maximum norm of column index C starting in row index R; +// matrix A has count N rows. +double lcl_GetColumnMaximumNorm( ScMatrixRef pMatA, SCSIZE nC, SCSIZE nR, SCSIZE nN ) +{ + double fNorm = 0.0; + for (SCSIZE row=nR; rowGetDouble(nC,row))) + fNorm = fabs(pMatA->GetDouble(nC,row)); + return fNorm; +} + +// Maximum norm of row index R starting in col index C; +// matrix A has count N columns. +double lcl_TGetColumnMaximumNorm( ScMatrixRef pMatA, SCSIZE nR, SCSIZE nC, SCSIZE nN ) +{ + double fNorm = 0.0; + for (SCSIZE col=nC; colGetDouble(col,nR))) + fNorm = fabs(pMatA->GetDouble(col,nR)); + return fNorm; +} + +// Special version for use within QR decomposition. +// starting in row index R; +// Ca and Cb are indices of columns, matrices A and B have count N rows. +double lcl_GetColumnSumProduct( ScMatrixRef pMatA, SCSIZE nCa, ScMatrixRef pMatB, + SCSIZE nCb, SCSIZE nR, SCSIZE nN ) +{ + double fResult = 0.0; + for (SCSIZE row=nR; rowGetDouble(nCa,row) * pMatB->GetDouble(nCb,row); + return fResult; +} + +// starting in column index C; +// Ra and Rb are indices of rows, matrices A and B have count N columns. +double lcl_TGetColumnSumProduct( ScMatrixRef pMatA, SCSIZE nRa, + ScMatrixRef pMatB, SCSIZE nRb, SCSIZE nC, SCSIZE nN ) +{ + double fResult = 0.0; + for (SCSIZE col=nC; colGetDouble(col,nRa) * pMatB->GetDouble(col,nRb); + return fResult; +} + +double lcl_GetSign(double fValue) +{ + if (fValue < 0.0) + return -1.0; + else if (fValue > 0.0) + return 1.0; else - { - if ( bSwapColRow ) + return 0.0; +} + +/* Calculates a QR decomposition with Householder reflection. + * For each NxK matrix A exists a decomposition A=Q*R with an orthogonal + * NxN matrix Q and a NxK matrix R. + * Q=H1*H2*...*Hk with Householder matrices H. Such a householder matrix can + * be build from a vector u by H=I-(2/u'u)*(u u'). This vectors u are returned + * in the columns of matrix A, overwriting the old content. + * The matrix R has a quadric upper part KxK with values in the upper right + * triangle and zeros in all other elements. Here the diagonal elements of R + * are stored in the vector R and the other upper right elements in the upper + * right of the matrix A. + * The function returns false, if calculation breaks. But because of round-off + * errors singularity is often not detected. + */ +bool lcl_CalculateQRdecomposition(ScMatrixRef pMatA, + ::std::vector< double>& pVecR, SCSIZE nK, SCSIZE nN) +{ + double fScale ; + double fEuclid ; + double fFactor ; + double fSignum ; + double fSum ; + // ScMatrix matrices are zero based, index access (column,row) + for (SCSIZE col = 0; col PutDouble( pMatA->GetDouble(col,row)/fScale, col, row); + + fEuclid = lcl_GetColumnEuclideanNorm(pMatA, col, col, nN); + fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(col,col))); + fSignum = lcl_GetSign(pMatA->GetDouble(col,col)); + pMatA->PutDouble( pMatA->GetDouble(col,col) + fSignum*fEuclid, col,col); + pVecR[col] = -fSignum * fScale * fEuclid; + + // apply Householder transformation to A + for (SCSIZE c=col+1; cGetDouble(k,j) * pX->GetDouble(k,i); - } - pC->PutDouble(sum, i, j); - } - } + fSum =lcl_GetColumnSumProduct(pMatA, col, pMatA, c, col, nN); + for (SCSIZE row = col; row PutDouble( pMatA->GetDouble(c,row) + - fSum * fFactor * pMatA->GetDouble(col,row), c, row); } - else + } + return true; +} + +// same with transposed matrix A, N is count of columns, K count of rows +bool lcl_TCalculateQRdecomposition(ScMatrixRef pMatA, + ::std::vector< double>& pVecR, SCSIZE nK, SCSIZE nN) +{ + double fScale ; + double fEuclid ; + double fFactor ; + double fSignum ; + double fSum ; + // ScMatrix matrices are zero based, index access (column,row) + for (SCSIZE row = 0; row PutDouble( pMatA->GetDouble(col,row)/fScale, col, row); + + fEuclid = lcl_TGetColumnEuclideanNorm(pMatA, row, row, nN); + fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(row,row))); + fSignum = lcl_GetSign(pMatA->GetDouble(row,row)); + pMatA->PutDouble( pMatA->GetDouble(row,row) + fSignum*fEuclid, row,row); + pVecR[row] = -fSignum * fScale * fEuclid; + + // apply Householder transformation to A + for (SCSIZE r=row+1; rGetDouble(j,k) * pX->GetDouble(i,k); - } - pC->PutDouble(sum, i, j); - } - } + fSum =lcl_TGetColumnSumProduct(pMatA, row, pMatA, r, row, nN); + for (SCSIZE col = row; col PutDouble( pMatA->GetDouble(col,r) + - fSum * fFactor * pMatA->GetDouble(col,row), col, r); } } - // X'X Inverse - BOOL bOk = TRUE; - USHORT nErr = nGlobalError; - PushMatrix(pC); - BYTE nTmp = cPar; - cPar = 1; - ScMatInv(); - cPar = nTmp; - if ( nGlobalError ) - { - nGlobalError = nErr; - bOk = FALSE; + return true; +} + + +/* Applies a Householder transformation to a column vector Y with is given as + * Nx1 Matrix. The Vektor u, from which the Householder transformation is build, + * is the column part in matrix A, with column index C, starting with row + * index C. A is the result of the QR decomposition as obtained from + * lcl_CaluclateQRdecomposition. + */ +void lcl_ApplyHouseholderTransformation(ScMatrixRef pMatA, SCSIZE nC, + ScMatrixRef pMatY, SCSIZE nN) +{ + // ScMatrix matrices are zero based, index access (column,row) + double fDenominator = lcl_GetColumnSumProduct(pMatA, nC, pMatA, nC, nC, nN); + double fNumerator = lcl_GetColumnSumProduct(pMatA, nC, pMatY, 0, nC, nN); + double fFactor = 2.0 * (fNumerator/fDenominator); + for (SCSIZE row = nC; row < nN; row++) + pMatY->PutDouble( + pMatY->GetDouble(row) - fFactor * pMatA->GetDouble(nC,row), row); +} + +// Same with transposed matrices A and Y. +void lcl_TApplyHouseholderTransformation(ScMatrixRef pMatA, SCSIZE nR, + ScMatrixRef pMatY, SCSIZE nN) +{ + // ScMatrix matrices are zero based, index access (column,row) + double fDenominator = lcl_TGetColumnSumProduct(pMatA, nR, pMatA, nR, nR, nN); + double fNumerator = lcl_TGetColumnSumProduct(pMatA, nR, pMatY, 0, nR, nN); + double fFactor = 2.0 * (fNumerator/fDenominator); + for (SCSIZE col = nR; col < nN; col++) + pMatY->PutDouble( + pMatY->GetDouble(col) - fFactor * pMatA->GetDouble(col,nR), col); +} + +/* Solve for X in R*X=S using back substitution. The solution X overwrites S. + * Uses R from the result of the QR decomposition of a NxK matrix A. + * S is a column vector given as matrix, with at least elements on index + * 0 to K-1; elements on index>=K are ignored. Vector R must not have zero + * elements, no check is done. + */ +void lcl_SolveWithUpperRightTriangle(ScMatrixRef pMatA, + ::std::vector< double>& pVecR, ScMatrixRef pMatS, + SCSIZE nK, bool bIsTransposed) +{ + // ScMatrix matrices are zero based, index access (column,row) + double fSum; + SCSIZE row; + // SCSIZE is never negative, therefore test with rowp1=row+1 + for (SCSIZE rowp1 = nK; rowp1>0; rowp1--) + { + row = rowp1-1; + fSum = pMatS->GetDouble(row); + for (SCSIZE col = rowp1; colGetDouble(row,col) * pMatS->GetDouble(col); + else + fSum -= pMatA->GetDouble(col,row) * pMatS->GetDouble(col); + pMatS->PutDouble( fSum / pVecR[row] , row); } - else +} + +/* Solve for X in R' * X= T using forward substitution. The solution X + * overwrites T. Uses R from the result of the QR decomposition of a NxK + * matrix A. T is a column vectors given as matrix, with at least elements on + * index 0 to K-1; elements on index>=K are ignored. Vector R must not have + * zero elements, no check is done. + */ +void lcl_SolveWithLowerLeftTriangle(ScMatrixRef pMatA, + ::std::vector< double>& pVecR, ScMatrixRef pMatT, + SCSIZE nK, bool bIsTransposed) +{ + // ScMatrix matrices are zero based, index access (column,row) + double fSum; + for (SCSIZE row = 0; row < nK; row++) { - // #i61216# ScMatInv no longer modifies the original matrix, so just calling Pop() doesn't work - pC = PopMatrix(); - if ( pC.Is() ) + fSum = pMatT -> GetDouble(row); + for (SCSIZE col=0; col < row; col++) { - // Varianzen auf der Diagonalen, andere sind Kovarianzen - for (i = 0; i < nC; i++) - pV->PutDouble(pC->GetDouble(i, i), i); + if (bIsTransposed) + fSum -= pMatA->GetDouble(col,row) * pMatT->GetDouble(col); + else + fSum -= pMatA->GetDouble(row,col) * pMatT->GetDouble(col); } + pMatT->PutDouble( fSum / pVecR[row] , row); } - return bOk; } -// ----------------------------------------------------------------------------- -void ScInterpreter::Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef& pQ,ScMatrixRef& pV,ScMatrixRef& pMatX,BOOL bConstant,SCSIZE N,SCSIZE M,BYTE nCase) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RGetVariances" ); - // pE[0] := Sigma i=1...n (Yi) - // pE[k] := Sigma i=1...n (Xki*Yi) - // pE[M+1] := Sigma i=1...n (Yi**2) - // pQ[0,M+1]:= B - // pQ[k,M+1]:= Mk - double fSQR, fSQT, fSQE; - fSQT = pE->GetDouble(M+1) - - pE->GetDouble(0) * pE->GetDouble(0) / (double)N; - fSQR = pE->GetDouble(M+1); - SCSIZE i, j; - for (i = 0; i < M+1; i++) - fSQR -= pQ->GetDouble(i, M+1) * pE->GetDouble(i); - fSQE = fSQT-fSQR; - // r2 (Bestimmtheitsmass, 0...1) - if (fSQT == 0.0) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 2); - else - pResMat->PutDouble (fSQE/fSQT, 0, 2); - // ssReg (Regressions-Quadratsumme) - pResMat->PutDouble(fSQE, 0, 4); - // ssResid (Residual-Quadratsumme, Summe der Abweichungsquadrate) - pResMat->PutDouble(fSQR, 1, 4); - for (i = 2; i < 5; i++) - for (j = 2; j < M+1; j++) - pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), j, i); - if (bConstant) - { - if (N-M-1 == 0) - { - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 1, 2); - for (i = 0; i < M+1; i++) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), i, 1); - } - else - { - double fSE2 = fSQR/(N-M-1); - // sey (Standardfehler des Schaetzwertes y) - pResMat->PutDouble(sqrt(fSE2), 1, 2); - // sen...se1 (Standardfehler der Koeffizienten mn...m1) - // seb (Standardfehler der Konstanten b) - if ( RGetVariances( pV, pMatX, M+1, N, nCase != 2, FALSE ) ) - { - for (i = 0; i < M+1; i++) - pResMat->PutDouble( sqrt(fSE2 * pV->GetDouble(i)), M-i, 1 ); - } + +/* Calculates Z = R * B + * R is given in matrix A and vector VecR as obtained from the QR + * decompostion in lcl_CalculateQRdecomposition. B and Z are column vectors + * given as matrix with at least index 0 to K-1; elements on index>=K are + * not used. + */ +void lcl_ApplyUpperRightTriangle(ScMatrixRef pMatA, + ::std::vector< double>& pVecR, ScMatrixRef pMatB, + ScMatrixRef pMatZ, SCSIZE nK, bool bIsTransposed) +{ + // ScMatrix matrices are zero based, index access (column,row) + double fSum; + for (SCSIZE row = 0; row < nK; row++) + { + fSum = pVecR[row] * pMatB->GetDouble(row); + for (SCSIZE col = row+1; col < nK; col++) + if (bIsTransposed) + fSum += pMatA->GetDouble(row,col) * pMatB->GetDouble(col); else - { - for (i = 0; i < M+1; i++) - pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), i, 1); - } - } - // F (F-Statistik) - if (fSQR == 0.0) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 3); - else - pResMat->PutDouble(((double)(N-M-1))*fSQE/fSQR/((double)M),0, 3); - // df (Freiheitsgrad) - pResMat->PutDouble(((double)(N-M-1)), 1, 3); + fSum += pMatA->GetDouble(col,row) * pMatB->GetDouble(col); + pMatZ->PutDouble( fSum, row); } - else +} + + + +double lcl_GetMeanOverAll(ScMatrixRef pMat, SCSIZE nN) +{ + double fSum = 0.0; + for (SCSIZE i=0 ; iGetDouble(i); + return fSum/static_cast(nN); +} + +// Calculates means of the columns of matrix X. X is a RxC matrix; +// ResMat is a 1xC matrix (=row). +void lcl_CalculateColumnMeans(ScMatrixRef pX, ScMatrixRef pResMat, + SCSIZE nC, SCSIZE nR) +{ + double fSum = 0.0; + for (SCSIZE i=0; i < nC; i++) { - if (N-M == 0) - { - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 1, 2); - for (i = 0; i < M+1; i++) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), i, 1); - } - else - { - double fSE2 = fSQR/(N-M); - pResMat->PutDouble(sqrt(fSE2), 1, 2); - if ( RGetVariances( pV, pMatX, M, N, nCase != 2, TRUE ) ) - { - for (i = 0; i < M; i++) - pResMat->PutDouble( sqrt(fSE2 * pV->GetDouble(i)), M-i-1, 1 ); - pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), M, 1); - } - else - { - for (i = 0; i < M+1; i++) - pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), i, 1); - } - } - if (fSQR == 0.0) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 3); - else - pResMat->PutDouble(((double)(N-M))*fSQE/fSQR/((double)M),0, 3); - pResMat->PutDouble(((double)(N-M)), 1, 3); + fSum =0.0; + for (SCSIZE k=0; k < nR; k++) + fSum += pX->GetDouble(i,k); // GetDouble(Column,Row) + pResMat ->PutDouble( fSum/static_cast(nR),i); } } -void ScInterpreter::ScRGP() +// Calculates means of the rows of matrix X. X is a RxC matrix; +// ResMat is a Rx1 matrix (=column). +void lcl_CalculateRowMeans(ScMatrixRef pX, ScMatrixRef pResMat, + SCSIZE nC, SCSIZE nR) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRGP" ); - CalulateRGPRKP(FALSE); + double fSum = 0.0; + for (SCSIZE k=0; k < nR; k++) + { + fSum =0.0; + for (SCSIZE i=0; i < nC; i++) + fSum += pX->GetDouble(i,k); // GetDouble(Column,Row) + pResMat ->PutDouble( fSum/static_cast(nC),k); + } +} + +void lcl_CalculateColumnsDelta(ScMatrixRef pMat, ScMatrixRef pColumnMeans, + SCSIZE nC, SCSIZE nR) +{ + for (SCSIZE i = 0; i < nC; i++) + for (SCSIZE k = 0; k < nR; k++) + pMat->PutDouble( ::rtl::math::approxSub + (pMat->GetDouble(i,k) , pColumnMeans->GetDouble(i) ) , i, k); +} + +void lcl_CalculateRowsDelta(ScMatrixRef pMat, ScMatrixRef pRowMeans, + SCSIZE nC, SCSIZE nR) +{ + for (SCSIZE k = 0; k < nR; k++) + for (SCSIZE i = 0; i < nC; i++) + pMat->PutDouble( ::rtl::math::approxSub + ( pMat->GetDouble(i,k) , pRowMeans->GetDouble(k) ) , i, k); +} + +// Case1 = simple regression +// MatX = X - MeanX, MatY = Y - MeanY, y - haty = (y - MeanY) - (haty - MeanY) +// = (y-MeanY)-((slope*x+a)-(slope*MeanX+a)) = (y-MeanY)-slope*(x-MeanX) +double lcl_GetSSresid(ScMatrixRef pMatX, ScMatrixRef pMatY, double fSlope, + SCSIZE nN) +{ + double fSum = 0.0; + double fTemp = 0.0; + for (SCSIZE i=0; iGetDouble(i) - fSlope * pMatX->GetDouble(i); + fSum += fTemp * fTemp; + } + return fSum; } -bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY) + +// Fill default values in matrix X, transform Y to log(Y) in case LOGEST|GROWTH, +// determine sizes of matrices X and Y, determine kind of regression, clone +// Y in case LOGEST|GROWTH, if constant. +bool ScInterpreter::CheckMatrix(bool _bLOG, BYTE& nCase, SCSIZE& nCX, + SCSIZE& nCY, SCSIZE& nRX, SCSIZE& nRY, SCSIZE& M, + SCSIZE& N, ScMatrixRef& pMatX, ScMatrixRef& pMatY) { + nCX = 0; nCY = 0; nRX = 0; @@ -2103,7 +2276,11 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE return false; } if (nCX == nCY && nRX == nRY) - nCase = 1; // einfache Regression + { + nCase = 1; // simple regression + M = 1; + N = nCountY; + } else if (nCY != 1 && nRY != 1) { PushIllegalArgument(); @@ -2118,7 +2295,7 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE } else { - nCase = 2; // zeilenweise + nCase = 2; // Y is column N = nRY; M = nCX; } @@ -2130,7 +2307,7 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE } else { - nCase = 3; // spaltenweise + nCase = 3; // Y is row N = nCY; M = nRX; } @@ -2138,460 +2315,645 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE else { pMatX = GetNewMat(nCY, nRY); - if ( _bTrendGrowth ) - { - nCX = nCY; - nRX = nRY; - } + nCX = nCY; + nRX = nRY; if (!pMatX) { PushIllegalArgument(); return false; } for ( SCSIZE i = 1; i <= nCountY; i++ ) - pMatX->PutDouble((double)i, i-1); + pMatX->PutDouble(static_cast(i), i-1); nCase = 1; + N = nCountY; + M = 1; } return true; } -void ScInterpreter::CalulateRGPRKP(BOOL _bRKP) +// ----------------------------------------------------------------------------- + +// LINEST +void ScInterpreter::ScRGP() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRGP" ); + CalulateRGPRKP(false); +} + +// LOGEST +void ScInterpreter::ScRKP() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRKP" ); + CalulateRGPRKP(true); +} + +void ScInterpreter::CalulateRGPRKP(bool _bRKP) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CheckMatrix" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; - BOOL bConstant, bStats; + bool bConstant, bStats; + + // optional forth parameter if (nParamCount == 4) bStats = GetBool(); else - bStats = FALSE; + bStats = false; + + // The third parameter may not be missing in ODF, if the forth parameter + // is present. But Excel allows it with default true, we too. if (nParamCount >= 3) - bConstant = GetBool(); + { + if (IsMissing()) + { + Pop(); + bConstant = true; + // PushIllegalParameter(); if ODF behavior is desired + // return; + } + else + bConstant = GetBool(); + } else - bConstant = TRUE; + bConstant = true; + ScMatrixRef pMatX; - ScMatrixRef pMatY; if (nParamCount >= 2) - pMatX = GetMatrix(); + { + if (IsMissing()) + { + // In ODF1.2 empty second parameter (which is two ;; ) is allowed + Pop(); + pMatX = NULL; + } + else + { + pMatX = GetMatrix(); + } + } else pMatX = NULL; + + ScMatrixRef pMatY; pMatY = GetMatrix(); if (!pMatY) { PushIllegalParameter(); return; - } // if (!pMatY) - BYTE nCase; // 1 = normal, 2,3 = mehrfach - SCSIZE nCX, nCY; - SCSIZE nRX, nRY; - SCSIZE M = 0, N = 0; - if ( !CheckMatrix(_bRKP,FALSE,nCase,nCX,nCY,nRX,nRY,M,N,pMatX,pMatY) ) + } + + // 1 = simple; 2 = multiple with Y as column; 3 = multiple with Y as row + BYTE nCase; + + SCSIZE nCX, nCY; // number of columns + SCSIZE nRX, nRY; // number of rows + SCSIZE K = 0, N = 0; // K=number of variables X, N=number of data samples + if ( !CheckMatrix(_bRKP,nCase,nCX,nCY,nRX,nRY,K,N,pMatX,pMatY) ) + { + PushIllegalParameter(); + return; + } + + // Enough data samples? + if ( (bConstant && (NPutString(ScGlobal::GetRscString(STR_NV_STR), i, 2 ); + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), i, 3 ); + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), i, 4 ); + } + } + + // Uses sum(x-MeanX)^2 and not [sum x^2]-N * MeanX^2 in case bConstant. + // Clone constant matrices, so that Mat = Mat - Mean is possible. + double fMeanY = 0.0; + if (bConstant) + { + ScMatrixRef pNewX = pMatX->CloneIfConst(); + ScMatrixRef pNewY = pMatY->CloneIfConst(); + if (!pNewX || !pNewY) + { + PushError(errCodeOverflow); return; } - double fCount = 0.0; - double fSumX = 0.0; - double fSumSqrX = 0.0; - double fSumY = 0.0; - double fSumSqrY = 0.0; - double fSumXY = 0.0; - double fValX, fValY; - for (SCSIZE i = 0; i < nCY; i++) - for (SCSIZE j = 0; j < nRY; j++) - { - fValX = pMatX->GetDouble(i,j); - fValY = pMatY->GetDouble(i,j); - fSumX += fValX; - fSumSqrX += fValX * fValX; - fSumY += fValY; - fSumSqrY += fValY * fValY; - fSumXY += fValX*fValY; - fCount++; - } - if (fCount < 1.0) - PushNoValue(); - else + pMatX = pNewX; + pMatY = pNewY; + // DeltaY is possible here; DeltaX depends on nCase, so later + fMeanY = lcl_GetMeanOverAll(pMatY, N); + for (SCSIZE i=0; iPutDouble( ::rtl::math::approxSub(pMatY->GetDouble(i),fMeanY), i ); + } + } + + if (nCase==1) + { + // calculate simple regression + double fMeanX = 0.0; + if (bConstant) + { // Mat = Mat - Mean + fMeanX = lcl_GetMeanOverAll(pMatX, N); + for (SCSIZE i=0; iPutDouble( ::rtl::math::approxSub(pMatX->GetDouble(i),fMeanX), i ); + } + } + double fSumXY = lcl_GetSumProduct(pMatX,pMatY,N); + double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,N); + if (fSumX2==0.0) + { + PushNoValue(); // all x-values are identical + return; + } + double fSlope = fSumXY / fSumX2; + double fIntercept = 0.0; + if (bConstant) + fIntercept = fMeanY - fSlope * fMeanX; + pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, 1, 0); //order (column,row) + pResMat->PutDouble(_bRKP ? exp(fSlope) : fSlope, 0, 0); + + if (bStats) + { + double fSSreg = fSlope * fSlope * fSumX2; + pResMat->PutDouble(fSSreg, 0, 4); + + double fDegreesFreedom =static_cast( (bConstant) ? N-2 : N-1 ); + pResMat->PutDouble(fDegreesFreedom, 1, 3); + + double fSSresid = lcl_GetSSresid(pMatX,pMatY,fSlope,N); + pResMat->PutDouble(fSSresid, 1, 4); + + if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0) + { // exact fit; test SSreg too, because SSresid might be + // unequal zero due to round of errors + pResMat->PutDouble(0.0, 1, 4); // SSresid + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), 0, 3); // F + pResMat->PutDouble(0.0, 1, 2); // RMSE + pResMat->PutDouble(0.0, 0, 1); // SigmaSlope + if (bConstant) + pResMat->PutDouble(0.0, 1, 1); //SigmaIntercept + else + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), 1, 1); + pResMat->PutDouble(1.0, 0, 2); // R^2 } else { - b = 0.0; - m = fSumXY/fSumSqrX; - } - pResMat->PutDouble(_bRKP ? exp(m) : m, 0, 0); - pResMat->PutDouble(_bRKP ? exp(b) : b, 1, 0); - if (bStats) - { - double fY = fCount*fSumSqrY-fSumY*fSumY; - double fSyx = fSumSqrY-b*fSumY-m*fSumXY; - double fR2 = f1*f1/(fX*fY); - pResMat->PutDouble (fR2, 0, 2); - if (fCount < 3.0) + double fFstatistic = (fSSreg / static_cast(K)) + / (fSSresid / fDegreesFreedom); + pResMat->PutDouble(fFstatistic, 0, 3); + + // standard error of estimate + double fRMSE = sqrt(fSSresid / fDegreesFreedom); + pResMat->PutDouble(fRMSE, 1, 2); + + double fSigmaSlope = fRMSE / sqrt(fSumX2); + pResMat->PutDouble(fSigmaSlope, 0, 1); + + if (bConstant) { - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 1 ); - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 1, 1 ); - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 1, 2 ); - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 3 ); + double fSigmaIntercept = fRMSE + * sqrt(fMeanX*fMeanX/fSumX2 + 1.0/static_cast(N)); + pResMat->PutDouble(fSigmaIntercept, 1, 1); } else { - pResMat->PutDouble(sqrt(fSyx*fCount/(fX*(fCount-2.0))), 0, 1); - pResMat->PutDouble(sqrt(fSyx*fSumSqrX/fX/(fCount-2.0)), 1, 1); - pResMat->PutDouble( - sqrt((fCount*fSumSqrY - fSumY*fSumY - f1*f1/fX)/ - (fCount*(fCount-2.0))), 1, 2); - if (fR2 == 1.0) - pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), 0, 3 ); - else - pResMat->PutDouble(fR2*(fCount-2.0)/(1.0-fR2), 0, 3); + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), 1, 1); } - pResMat->PutDouble(((double)(nCY*nRY))-2.0, 1, 3); - pResMat->PutDouble(fY/fCount-fSyx, 0, 4); - pResMat->PutDouble(fSyx, 1, 4); + + double fR2 = fSSreg / (fSSreg + fSSresid); + pResMat->PutDouble(fR2, 0, 2); } } - } // if (nCase == 1) - if ( nCase != 1 ) + PushMatrix(pResMat); + } + else // calculate multiple regression; { - SCSIZE i, j, k; - if (!bStats) - pResMat = GetNewMat(M+1,1); - else - pResMat = GetNewMat(M+1,5); - if (!pResMat) + // Uses a QR decomposition X = QR. The solution B = (X'X)^(-1) * X' * Y + // becomes B = R^(-1) * Q' * Y + if (nCase ==2) // Y is column { - PushIllegalArgument(); - return; - } - ScMatrixRef pQ = GetNewMat(M+1, M+2); - ScMatrixRef pE = GetNewMat(M+2, 1); - ScMatrixRef pV = GetNewMat(M+1, 1); - pE->PutDouble(0.0, M+1); - pQ->FillDouble(0.0, 0, 0, M, M+1); - if (nCase == 2) - { - for (k = 0; k < N; k++) - { - double Yk = pMatY->GetDouble(k); - pE->PutDouble( pE->GetDouble(M+1)+Yk*Yk, M+1 ); - double sumYk = pQ->GetDouble(0, M+1) + Yk; - pQ->PutDouble( sumYk, 0, M+1 ); - pE->PutDouble( sumYk, 0 ); - for (i = 0; i < M; i++) - { - double Xik = pMatX->GetDouble(i,k); - double sumXik = pQ->GetDouble(0, i+1) + Xik; - pQ->PutDouble( sumXik, 0, i+1); - pQ->PutDouble( sumXik, i+1, 0); - double sumXikYk = pQ->GetDouble(i+1, M+1) + Xik * Yk; - pQ->PutDouble( sumXikYk, i+1, M+1); - pE->PutDouble( sumXikYk, i+1); - for (j = i; j < M; j++) - { - const double fVal = pMatX->GetDouble(j,k); - double sumXikXjk = pQ->GetDouble(j+1, i+1) + - Xik * fVal; - pQ->PutDouble( sumXikXjk, j+1, i+1); - pQ->PutDouble( sumXikXjk, i+1, j+1); - } - } + ::std::vector< double> aVecR(N); // for QR decomposition + // Enough memory for needed matrices? + ScMatrixRef pMeans = GetNewMat(K, 1); // mean of each column + ScMatrixRef pMatZ; // for Q' * Y , inter alia + if (bStats) + pMatZ = pMatY->Clone(); // Y is used in statistic, keep it + else + pMatZ = pMatY; // Y can be overwritten + ScMatrixRef pSlopes = GetNewMat(1,K); // from b1 to bK + if (!pMeans || !pMatZ || !pSlopes) + { + PushError(errCodeOverflow); + return; } - } - else - { - for (k = 0; k < N; k++) + if (bConstant) { - double Yk = pMatY->GetDouble(k); - pE->PutDouble( pE->GetDouble(M+1)+Yk*Yk, M+1 ); - double sumYk = pQ->GetDouble(0, M+1) + Yk; - pQ->PutDouble( sumYk, 0, M+1 ); - pE->PutDouble( sumYk, 0 ); - for (i = 0; i < M; i++) - { - double Xki = pMatX->GetDouble(k,i); - double sumXki = pQ->GetDouble(0, i+1) + Xki; - pQ->PutDouble( sumXki, 0, i+1); - pQ->PutDouble( sumXki, i+1, 0); - double sumXkiYk = pQ->GetDouble(i+1, M+1) + Xki * Yk; - pQ->PutDouble( sumXkiYk, i+1, M+1); - pE->PutDouble( sumXkiYk, i+1); - for (j = i; j < M; j++) - { - const double fVal = pMatX->GetDouble(k,j); - double sumXkiXkj = pQ->GetDouble(j+1, i+1) + - Xki * fVal; - pQ->PutDouble( sumXkiXkj, j+1, i+1); - pQ->PutDouble( sumXkiXkj, i+1, j+1); - } - } + lcl_CalculateColumnMeans(pMatX, pMeans, K, N); + lcl_CalculateColumnsDelta(pMatX, pMeans, K, N); } - } - if ( !Calculate4(_bRKP,pResMat,pQ,bConstant,N,M) ) - return; - - if (bStats) - Calculate(pResMat,pE,pQ,pV,pMatX,bConstant,N,M,nCase); - } - PushMatrix(pResMat); -} - -void ScInterpreter::ScRKP() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRKP" ); - CalulateRGPRKP(TRUE); -} -// ----------------------------------------------------------------------------- -bool ScInterpreter::Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,BOOL bConstant,SCSIZE N,SCSIZE M) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate4" ); - pQ->PutDouble((double)N, 0, 0); - if (bConstant) - { - SCSIZE S, L; - for (S = 0; S < M+1; S++) - { - SCSIZE i = S; - while (i < M+1 && pQ->GetDouble(i, S) == 0.0) - i++; - if (i >= M+1) + if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K, N)) { PushNoValue(); - return false; + return; } - double fVal; - for (L = 0; L < M+2; L++) + // Later on we will divide by elements of aVecR, so make sure + // that they aren't zero. + bool bIsSingular=false; + for (SCSIZE row=0; row < K && !bIsSingular; row++) + bIsSingular = bIsSingular || aVecR[row]==0.0; + if (bIsSingular) { - fVal = pQ->GetDouble(S, L); - pQ->PutDouble(pQ->GetDouble(i, L), S, L); - pQ->PutDouble(fVal, i, L); + PushNoValue(); + return; } - fVal = 1.0/pQ->GetDouble(S, S); - for (L = 0; L < M+2; L++) - pQ->PutDouble(pQ->GetDouble(S, L)*fVal, S, L); - for (i = 0; i < M+1; i++) + // Z = Q' Y; + for (SCSIZE col = 0; col < K; col++) { - if (i != S) - { - fVal = -pQ->GetDouble(i, S); - for (L = 0; L < M+2; L++) - pQ->PutDouble( - pQ->GetDouble(i,L)+fVal*pQ->GetDouble(S,L),i,L); - } + lcl_ApplyHouseholderTransformation(pMatX, col, pMatZ, N); } - } - } - else - { - if ( !Calculate3(M,pQ) ) - return false; + // B = R^(-1) * Q' * Y <=> B = R^(-1) * Z <=> R * B = Z + // result Z should have zeros for index>=K; if not, ignore values + for (SCSIZE col = 0; col < K ; col++) + { + pSlopes->PutDouble( pMatZ->GetDouble(col), col); + } + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K, false); + double fIntercept = 0.0; + if (bConstant) + fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K); + // Fill first line in result matrix + pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 ); + for (SCSIZE i = 0; i < K; i++) + pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(i)) + : pSlopes->GetDouble(i) , K-1-i, 0); - } - for (SCSIZE i = 0; i < M+1; i++) - { - const double d = pQ->GetDouble(M-i,M+1); - pResMat->PutDouble(_bExp ? exp(d) : d, i, 0); - } // for (SCSIZE i = 0; i < M+1; i++) - return true; -} -ScMatrixRef ScInterpreter::Calculate2(const BOOL bConstant,const SCSIZE M ,const SCSIZE N,ScMatrixRef& pMatX,ScMatrixRef& pMatY,BYTE nCase) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate2" ); - SCSIZE i, j, k; - ScMatrixRef pQ = GetNewMat(M+1, M+2); - ScMatrixRef pE = GetNewMat(M+2, 1); - pE->PutDouble(0.0, M+1); - pQ->FillDouble(0.0, 0, 0, M, M+1); - if (nCase == 2) - { - for (k = 0; k < N; k++) - { - pE->PutDouble( - pE->GetDouble(M+1)+pMatY->GetDouble(k)*pMatY->GetDouble(k), M+1); - pQ->PutDouble(pQ->GetDouble(0, M+1) + pMatY->GetDouble(k), 0, M+1); - pE->PutDouble(pQ->GetDouble(0, M+1), 0); - for (i = 0; i < M; i++) + if (bStats) { - pQ->PutDouble(pQ->GetDouble(0, i+1)+pMatX->GetDouble(i,k), 0, i+1); - pQ->PutDouble(pQ->GetDouble(0, i+1), i+1, 0); - pQ->PutDouble(pQ->GetDouble(i+1, M+1) + - pMatX->GetDouble(i,k)*pMatY->GetDouble(k), i+1, M+1); - pE->PutDouble(pQ->GetDouble(i+1, M+1), i+1); - for (j = i; j < M; j++) + double fSSreg = 0.0; + double fSSresid = 0.0; + // re-use memory of Z; + pMatZ->FillDouble(0.0, 0, 0, 0, N-1); + // Z = R * Slopes + lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K, false); + // Z = Q * Z, that is Q * R * Slopes = X * Slopes + for (SCSIZE colp1 = K; colp1 > 0; colp1--) { - pQ->PutDouble(pQ->GetDouble(j+1, i+1) + - pMatX->GetDouble(i,k)*pMatX->GetDouble(j,k), j+1, i+1); - pQ->PutDouble(pQ->GetDouble(j+1, i+1), i+1, j+1); + lcl_ApplyHouseholderTransformation(pMatX, colp1-1, pMatZ,N); } - } - } - } - else - { - for (k = 0; k < N; k++) - { - pE->PutDouble( - pE->GetDouble(M+1)+pMatY->GetDouble(k)*pMatY->GetDouble(k), M+1); - pQ->PutDouble(pQ->GetDouble(0, M+1) + pMatY->GetDouble(k), 0, M+1); - pE->PutDouble(pQ->GetDouble(0, M+1), 0); - for (i = 0; i < M; i++) - { - pQ->PutDouble(pQ->GetDouble(0, i+1)+pMatX->GetDouble(k,i), 0, i+1); - pQ->PutDouble(pQ->GetDouble(0, i+1), i+1, 0); - pQ->PutDouble(pQ->GetDouble(i+1, M+1) + - pMatX->GetDouble(k,i)*pMatY->GetDouble(k), i+1, M+1); - pE->PutDouble(pQ->GetDouble(i+1, M+1), i+1); - for (j = i; j < M; j++) + fSSreg =lcl_GetSumProduct(pMatZ, pMatZ, N); + // re-use Y for residuals, Y = Y-Z + for (SCSIZE row = 0; row < N; row++) + pMatY->PutDouble(pMatY->GetDouble(row) - pMatZ->GetDouble(row), row); + fSSresid = lcl_GetSumProduct(pMatY, pMatY, N); + pResMat->PutDouble(fSSreg, 0, 4); + pResMat->PutDouble(fSSresid, 1, 4); + + double fDegreesFreedom =static_cast( (bConstant) ? N-K-1 : N-K ); + pResMat->PutDouble(fDegreesFreedom, 1, 3); + + if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0) + { // exact fit; incl. observed values Y are identical + pResMat->PutDouble(0.0, 1, 4); // SSresid + // F = (SSreg/K) / (SSresid/df) = #DIV/0! + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), 0, 3); // F + // RMSE = sqrt(SSresid / df) = sqrt(0 / df) = 0 + pResMat->PutDouble(0.0, 1, 2); // RMSE + // SigmaSlope[i] = RMSE * sqrt(matrix[i,i]) = 0 * sqrt(...) = 0 + for (SCSIZE i=0; iPutDouble(0.0, K-1-i, 1); + + // SigmaIntercept = RMSE * sqrt(...) = 0 + if (bConstant) + pResMat->PutDouble(0.0, K, 1); //SigmaIntercept + else + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), K, 1); + + // R^2 = SSreg / (SSreg + SSresid) = 1.0 + pResMat->PutDouble(1.0, 0, 2); // R^2 + } + else { - pQ->PutDouble(pQ->GetDouble(j+1, i+1) + - pMatX->GetDouble(k, i)*pMatX->GetDouble(k, j), j+1, i+1); - pQ->PutDouble(pQ->GetDouble(j+1, i+1), i+1, j+1); + double fFstatistic = (fSSreg / static_cast(K)) + / (fSSresid / fDegreesFreedom); + pResMat->PutDouble(fFstatistic, 0, 3); + + // standard error of estimate = root mean SSE + double fRMSE = sqrt(fSSresid / fDegreesFreedom); + pResMat->PutDouble(fRMSE, 1, 2); + + // standard error of slopes + // = RMSE * sqrt(diagonal element of (R' R)^(-1) ) + // standard error of intercept + // = RMSE * sqrt( Xmean * (R' R)^(-1) * Xmean' + 1/N) + // (R' R)^(-1) = R^(-1) * (R')^(-1). Do not calculate it as + // a whole matrix, but iterate over unit vectors. + double fSigmaSlope = 0.0; + double fSigmaIntercept = 0.0; + double fPart; // for Xmean * single column of (R' R)^(-1) + for (SCSIZE col = 0; col < K; col++) + { + //re-use memory of MatZ + pMatZ->FillDouble(0.0,0,0,0,K-1); // Z = unit vector e + pMatZ->PutDouble(1.0, col); + //Solve R' * Z = e + lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K, false); + // Solve R * Znew = Zold + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K, false); + // now Z is column col in (R' R)^(-1) + fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(col)); + pResMat->PutDouble(fSigmaSlope, K-1-col, 1); + // (R' R) ^(-1) is symmetric + if (bConstant) + { + fPart = lcl_GetSumProduct(pMeans, pMatZ, K); + fSigmaIntercept += fPart * pMeans->GetDouble(col); + } + } + if (bConstant) + { + fSigmaIntercept = fRMSE + * sqrt(fSigmaIntercept + 1.0 / static_cast(N)); + pResMat->PutDouble(fSigmaIntercept, K, 1); + } + else + { + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), K, 1); + } + + double fR2 = fSSreg / (fSSreg + fSSresid); + pResMat->PutDouble(fR2, 0, 2); } } + PushMatrix(pResMat); } - } - pQ->PutDouble((double)N, 0, 0); - if (bConstant) - { - SCSIZE S, L; - for (S = 0; S < M+1; S++) + else // nCase == 3, Y is row, all matrices are transposed { - i = S; - while (i < M+1 && pQ->GetDouble(i, S) == 0.0) - i++; - if (i >= M+1) + ::std::vector< double> aVecR(N); // for QR decomposition + // Enough memory for needed matrices? + ScMatrixRef pMeans = GetNewMat(1, K); // mean of each row + ScMatrixRef pMatZ; // for Q' * Y , inter alia + if (bStats) + pMatZ = pMatY->Clone(); // Y is used in statistic, keep it + else + pMatZ = pMatY; // Y can be overwritten + ScMatrixRef pSlopes = GetNewMat(K,1); // from b1 to bK + if (!pMeans || !pMatZ || !pSlopes) + { + PushError(errCodeOverflow); + return; + } + if (bConstant) + { + lcl_CalculateRowMeans(pMatX, pMeans, N, K); + lcl_CalculateRowsDelta(pMatX, pMeans, N, K); + } + + if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K, N)) + { + PushNoValue(); + return; + } + + // Later on we will divide by elements of aVecR, so make sure + // that they aren't zero. + bool bIsSingular=false; + for (SCSIZE row=0; row < K && !bIsSingular; row++) + bIsSingular = bIsSingular || aVecR[row]==0.0; + if (bIsSingular) { PushNoValue(); - return ScMatrixRef(); + return; + } + // Z = Q' Y + for (SCSIZE row = 0; row < K; row++) + { + lcl_TApplyHouseholderTransformation(pMatX, row, pMatZ, N); } - double fVal; - for (L = 0; L < M+2; L++) + // B = R^(-1) * Q' * Y <=> B = R^(-1) * Z <=> R * B = Z + // result Z should have zeros for index>=K; if not, ignore values + for (SCSIZE col = 0; col < K ; col++) { - fVal = pQ->GetDouble(S, L); - pQ->PutDouble(pQ->GetDouble(i, L), S, L); - pQ->PutDouble(fVal, i, L); + pSlopes->PutDouble( pMatZ->GetDouble(col), col); } - fVal = 1.0/pQ->GetDouble(S, S); - for (L = 0; L < M+2; L++) - pQ->PutDouble(pQ->GetDouble(S, L)*fVal, S, L); - for (i = 0; i < M+1; i++) + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K, true); + double fIntercept = 0.0; + if (bConstant) + fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K); + // Fill first line in result matrix + pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 ); + for (SCSIZE i = 0; i < K; i++) + pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(i)) + : pSlopes->GetDouble(i) , K-1-i, 0); + + + if (bStats) { - if (i != S) + double fSSreg = 0.0; + double fSSresid = 0.0; + // re-use memory of Z; + pMatZ->FillDouble(0.0, 0, 0, N-1, 0); + // Z = R * Slopes + lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K, true); + // Z = Q * Z, that is Q * R * Slopes = X * Slopes + for (SCSIZE rowp1 = K; rowp1 > 0; rowp1--) + { + lcl_TApplyHouseholderTransformation(pMatX, rowp1-1, pMatZ,N); + } + fSSreg =lcl_GetSumProduct(pMatZ, pMatZ, N); + // re-use Y for residuals, Y = Y-Z + for (SCSIZE col = 0; col < N; col++) + pMatY->PutDouble(pMatY->GetDouble(col) - pMatZ->GetDouble(col), col); + fSSresid = lcl_GetSumProduct(pMatY, pMatY, N); + pResMat->PutDouble(fSSreg, 0, 4); + pResMat->PutDouble(fSSresid, 1, 4); + + double fDegreesFreedom =static_cast( (bConstant) ? N-K-1 : N-K ); + pResMat->PutDouble(fDegreesFreedom, 1, 3); + + if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0) + { // exact fit; incl. case observed values Y are identical + pResMat->PutDouble(0.0, 1, 4); // SSresid + // F = (SSreg/K) / (SSresid/df) = #DIV/0! + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), 0, 3); // F + // RMSE = sqrt(SSresid / df) = sqrt(0 / df) = 0 + pResMat->PutDouble(0.0, 1, 2); // RMSE + // SigmaSlope[i] = RMSE * sqrt(matrix[i,i]) = 0 * sqrt(...) = 0 + for (SCSIZE i=0; iPutDouble(0.0, K-1-i, 1); + + // SigmaIntercept = RMSE * sqrt(...) = 0 + if (bConstant) + pResMat->PutDouble(0.0, K, 1); //SigmaIntercept + else + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), K, 1); + + // R^2 = SSreg / (SSreg + SSresid) = 1.0 + pResMat->PutDouble(1.0, 0, 2); // R^2 + } + else { - fVal = -pQ->GetDouble(i, S); - for (L = 0; L < M+2; L++) - pQ->PutDouble( - pQ->GetDouble(i,L)+fVal*pQ->GetDouble(S,L),i,L); + double fFstatistic = (fSSreg / static_cast(K)) + / (fSSresid / fDegreesFreedom); + pResMat->PutDouble(fFstatistic, 0, 3); + + // standard error of estimate = root mean SSE + double fRMSE = sqrt(fSSresid / fDegreesFreedom); + pResMat->PutDouble(fRMSE, 1, 2); + + // standard error of slopes + // = RMSE * sqrt(diagonal element of (R' R)^(-1) ) + // standard error of intercept + // = RMSE * sqrt( Xmean * (R' R)^(-1) * Xmean' + 1/N) + // (R' R)^(-1) = R^(-1) * (R')^(-1). Do not calculate it as + // a whole matrix, but iterate over unit vectors. + // (R' R) ^(-1) is symmetric + double fSigmaSlope = 0.0; + double fSigmaIntercept = 0.0; + double fPart; // for Xmean * single col of (R' R)^(-1) + for (SCSIZE row = 0; row < K; row++) + { + //re-use memory of MatZ + pMatZ->FillDouble(0.0,0,0,K-1,0); // Z = unit vector e + pMatZ->PutDouble(1.0, row); + //Solve R' * Z = e + lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K, true); + // Solve R * Znew = Zold + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K, true); + // now Z is column col in (R' R)^(-1) + fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(row)); + pResMat->PutDouble(fSigmaSlope, K-1-row, 1); + if (bConstant) + { + fPart = lcl_GetSumProduct(pMeans, pMatZ, K); + fSigmaIntercept += fPart * pMeans->GetDouble(row); + } + } + if (bConstant) + { + fSigmaIntercept = fRMSE + * sqrt(fSigmaIntercept + 1.0 / static_cast(N)); + pResMat->PutDouble(fSigmaIntercept, K, 1); + } + else + { + pResMat->PutString(ScGlobal::GetRscString(STR_NV_STR), K, 1); + } + + double fR2 = fSSreg / (fSSreg + fSSresid); + pResMat->PutDouble(fR2, 0, 2); } } + PushMatrix(pResMat); } } - else - { - if ( !Calculate3(M,pQ) ) - return ScMatrixRef(); - } - return pQ; -} -bool ScInterpreter::Calculate3(const SCSIZE M ,ScMatrixRef& pQ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate3" ); - SCSIZE S, L; - for (S = 1; S < M+1; S++) - { - SCSIZE i = S; - while (i < M+1 && pQ->GetDouble(i, S) == 0.0) - i++; - if (i >= M+1) - { - PushNoValue(); - return ScMatrixRef(); - } - double fVal; - for (L = 1; L < M+2; L++) - { - fVal = pQ->GetDouble(S, L); - pQ->PutDouble(pQ->GetDouble(i, L), S, L); - pQ->PutDouble(fVal, i, L); - } - fVal = 1.0/pQ->GetDouble(S, S); - for (L = 1; L < M+2; L++) - pQ->PutDouble(pQ->GetDouble(S, L)*fVal, S, L); - for (i = 1; i < M+1; i++) - { - if (i != S) - { - fVal = -pQ->GetDouble(i, S); - for (L = 1; L < M+2; L++) - pQ->PutDouble( - pQ->GetDouble(i,L)+fVal*pQ->GetDouble(S,L),i,L); - } - } - pQ->PutDouble(0.0, 0, M+1); - } // for (S = 1; S < M+1; S++) - return true; + return; } void ScInterpreter::ScTrend() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrend" ); - CalculateTrendGrowth(FALSE); + CalculateTrendGrowth(false); } -void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth) + +void ScInterpreter::ScGrowth() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGrowth" ); + CalculateTrendGrowth(true); +} + +void ScInterpreter::CalculateTrendGrowth(bool _bGrowth) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateTrendGrowth" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; - BOOL bConstant; + + // optional fourth parameter + bool bConstant; if (nParamCount == 4) bConstant = GetBool(); else - bConstant = TRUE; - ScMatrixRef pMatX; - ScMatrixRef pMatY; + bConstant = true; + + // The third parameter may be missing in ODF, although the fourth parameter + // is present. Default values depend on data not yet read. ScMatrixRef pMatNewX; if (nParamCount >= 3) - pMatNewX = GetMatrix(); + { + if (IsMissing()) + { + Pop(); + pMatNewX = NULL; + } + else + pMatNewX = GetMatrix(); + } else pMatNewX = NULL; + + // In ODF1.2 empty second parameter (which is two ;; ) is allowed. + // Defaults will be set in CheckMatrix. + ScMatrixRef pMatX; if (nParamCount >= 2) - pMatX = GetMatrix(); + { + if (IsMissing()) + { + Pop(); + pMatX = NULL; + } + else + { + pMatX = GetMatrix(); + } + } else pMatX = NULL; + + ScMatrixRef pMatY; pMatY = GetMatrix(); if (!pMatY) { PushIllegalParameter(); return; - } // if (!pMatY) + } + + // 1 = simple; 2 = multiple with Y as column; 3 = multiple with Y as row + BYTE nCase; - BYTE nCase; // 1 = normal, 2,3 = mehrfach - SCSIZE nCX, nCY; - SCSIZE nRX, nRY; - SCSIZE M = 0, N = 0; - if ( !CheckMatrix(_bGrowth,TRUE,nCase,nCX,nCY,nRX,nRY,M,N,pMatX,pMatY) ) + SCSIZE nCX, nCY; // number of columns + SCSIZE nRX, nRY; // number of rows + SCSIZE K = 0, N = 0; // K=number of variables X, N=number of data samples + if ( !CheckMatrix(_bGrowth,nCase,nCX,nCY,nRX,nRY,K,N,pMatX,pMatY) ) + { + PushIllegalParameter(); return; + } + // Enough data samples? + if ( (bConstant && (NClone(); // pMatX will be changed to X-meanX } else { pMatNewX->GetDimensions(nCXN, nRXN); - if ((nCase == 2 && nCX != nCXN) || (nCase == 3 && nRX != nRXN)) + if ((nCase == 2 && K != nCXN) || (nCase == 3 && K != nRXN)) { PushIllegalArgument(); return; @@ -2617,110 +2979,207 @@ void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth) return; } } - ScMatrixRef pResMat; + ScMatrixRef pResMat; // size depends on nCase if (nCase == 1) + pResMat = GetNewMat(nCXN,nRXN); + else + { + if (nCase==2) + pResMat = GetNewMat(1,nRXN); + else + pResMat = GetNewMat(nCXN,1); + } + if (!pResMat) + { + PushError(errCodeOverflow); + return; + } + // Uses sum(x-MeanX)^2 and not [sum x^2]-N * MeanX^2 in case bConstant. + // Clone constant matrices, so that Mat = Mat - Mean is possible. + double fMeanY = 0.0; + if (bConstant) { - double fCount = 0.0; - double fSumX = 0.0; - double fSumSqrX = 0.0; - double fSumY = 0.0; - double fSumSqrY = 0.0; - double fSumXY = 0.0; - double fValX, fValY; - SCSIZE i; - for (i = 0; i < nCY; i++) - for (SCSIZE j = 0; j < nRY; j++) - { - fValX = pMatX->GetDouble(i,j); - fValY = pMatY->GetDouble(i,j); - fSumX += fValX; - fSumSqrX += fValX * fValX; - fSumY += fValY; - fSumSqrY += fValY * fValY; - fSumXY += fValX*fValY; - fCount++; - } - if (fCount < 1.0) + ScMatrixRef pCopyX = pMatX->CloneIfConst(); + ScMatrixRef pCopyY = pMatY->CloneIfConst(); + if (!pCopyX || !pCopyY) { - PushNoValue(); + PushError(errStackOverflow); return; } - else + pMatX = pCopyX; + pMatY = pCopyY; + // DeltaY is possible here; DeltaX depends on nCase, so later + fMeanY = lcl_GetMeanOverAll(pMatY, N); + for (SCSIZE i=0; iPutDouble( ::rtl::math::approxSub(pMatY->GetDouble(i),fMeanY), i ); + } + } + + if (nCase==1) + { + // calculate simple regression + double fMeanX = 0.0; + if (bConstant) + { // Mat = Mat - Mean + fMeanX = lcl_GetMeanOverAll(pMatX, N); + for (SCSIZE i=0; iPutDouble( ::rtl::math::approxSub(pMatX->GetDouble(i),fMeanX), i ); } - pResMat = GetNewMat(nCXN, nRXN); - if (!pResMat) + } + double fSumXY = lcl_GetSumProduct(pMatX,pMatY,N); + double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,N); + if (fSumX2==0.0) + { + PushNoValue(); // all x-values are identical + return; + } + double fSlope = fSumXY / fSumX2; + double fIntercept = 0.0; + double fHelp; + if (bConstant) + { + fIntercept = fMeanY - fSlope * fMeanX; + for (SCSIZE i = 0; i < nCountXN; i++) { - PushIllegalArgument(); - return; + fHelp = pMatNewX->GetDouble(i)*fSlope + fIntercept; + pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp, i); } - for (i = 0; i < nCountXN; i++) + } + else + { + for (SCSIZE i = 0; i < nCountXN; i++) { - const double d = pMatNewX->GetDouble(i)*m+b; - pResMat->PutDouble(_bGrowth ? exp(d) : d, i); + fHelp = pMatNewX->GetDouble(i)*fSlope; + pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp, i); } } } - else + else // calculate multiple regression; { - ScMatrixRef pQ = Calculate2(bConstant,M ,N,pMatX,pMatY,nCase); - if ( !pQ.Is() ) - return; - if (nCase == 2) + if (nCase ==2) // Y is column { - pResMat = GetNewMat(1, nRXN); - if (!pResMat) + ::std::vector< double> aVecR(N); // for QR decomposition + // Enough memory for needed matrices? + ScMatrixRef pMeans = GetNewMat(K, 1); // mean of each column + ScMatrixRef pSlopes = GetNewMat(1,K); // from b1 to bK + if (!pMeans || !pSlopes) { - PushIllegalArgument(); + PushError(errCodeOverflow); + return; + } + if (bConstant) + { + lcl_CalculateColumnMeans(pMatX, pMeans, K, N); + lcl_CalculateColumnsDelta(pMatX, pMeans, K, N); + } + if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K, N)) + { + PushNoValue(); + return; + } + // Later on we will divide by elements of aVecR, so make sure + // that they aren't zero. + bool bIsSingular=false; + for (SCSIZE row=0; row < K && !bIsSingular; row++) + bIsSingular = bIsSingular || aVecR[row]==0.0; + if (bIsSingular) + { + PushNoValue(); return; } - double fVal; - for (SCSIZE i = 0; i < nRXN; i++) + // Z := Q' Y; Y is overwritten with result Z + for (SCSIZE col = 0; col < K; col++) + { + lcl_ApplyHouseholderTransformation(pMatX, col, pMatY, N); + } + // B = R^(-1) * Q' * Y <=> B = R^(-1) * Z <=> R * B = Z + // result Z should have zeros for index>=K; if not, ignore values + for (SCSIZE col = 0; col < K ; col++) { - fVal = pQ->GetDouble(0, M+1); - for (SCSIZE j = 0; j < M; j++) - fVal += pQ->GetDouble(j+1, M+1)*pMatNewX->GetDouble(j, i); - pResMat->PutDouble(_bGrowth ? exp(fVal) : fVal, i); + pSlopes->PutDouble( pMatY->GetDouble(col), col); + } + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K, false); + + // Fill result matrix + lcl_MFastMult(pMatNewX,pSlopes,pResMat,nRXN,K,1); + if (bConstant) + { + double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K); + for (SCSIZE row = 0; row < nRXN; row++) + pResMat->PutDouble(pResMat->GetDouble(row)+fIntercept, row); + } + if (_bGrowth) + { + for (SCSIZE i = 0; i < nRXN; i++) + pResMat->PutDouble(exp(pResMat->GetDouble(i)), i); } } else - { - pResMat = GetNewMat(nCXN, 1); - if (!pResMat) + { // nCase == 3, Y is row, all matrices are transposed + + ::std::vector< double> aVecR(N); // for QR decomposition + // Enough memory for needed matrices? + ScMatrixRef pMeans = GetNewMat(1, K); // mean of each row + ScMatrixRef pSlopes = GetNewMat(K,1); // row from b1 to bK + if (!pMeans || !pSlopes) { - PushIllegalArgument(); + PushError(errCodeOverflow); + return; + } + if (bConstant) + { + lcl_CalculateRowMeans(pMatX, pMeans, N, K); + lcl_CalculateRowsDelta(pMatX, pMeans, N, K); + } + if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K, N)) + { + PushNoValue(); return; } - double fVal; - for (SCSIZE i = 0; i < nCXN; i++) + // Later on we will divide by elements of aVecR, so make sure + // that they aren't zero. + bool bIsSingular=false; + for (SCSIZE row=0; row < K && !bIsSingular; row++) + bIsSingular = bIsSingular || aVecR[row]==0.0; + if (bIsSingular) { - fVal = pQ->GetDouble(0, M+1); - for (SCSIZE j = 0; j < M; j++) - fVal += pQ->GetDouble(j+1, M+1)*pMatNewX->GetDouble(i, j); - pResMat->PutDouble(_bGrowth ? exp(fVal) : fVal, i); + PushNoValue(); + return; + } + // Z := Q' Y; Y is overwritten with result Z + for (SCSIZE row = 0; row < K; row++) + { + lcl_TApplyHouseholderTransformation(pMatX, row, pMatY, N); + } + // B = R^(-1) * Q' * Y <=> B = R^(-1) * Z <=> R * B = Z + // result Z should have zeros for index>=K; if not, ignore values + for (SCSIZE col = 0; col < K ; col++) + { + pSlopes->PutDouble( pMatY->GetDouble(col), col); + } + lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K, true); + + // Fill result matrix + lcl_MFastMult(pSlopes,pMatNewX,pResMat,1,K,nCXN); + if (bConstant) + { + double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K); + for (SCSIZE col = 0; col < nCXN; col++) + pResMat->PutDouble(pResMat->GetDouble(col)+fIntercept, col); + } + if (_bGrowth) + { + for (SCSIZE i = 0; i < nCXN; i++) + pResMat->PutDouble(exp(pResMat->GetDouble(i)), i); } } } PushMatrix(pResMat); + return; } -void ScInterpreter::ScGrowth() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGrowth" ); - CalculateTrendGrowth(TRUE); -} void ScInterpreter::ScMatRef() { -- cgit From 3b74479c65ba8de20eadbb532d99eedd6850e96c Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 17 Nov 2010 14:00:39 +0100 Subject: dr78: #i26822# remove draw shell if selected object is removed by undo --- sc/source/ui/drawfunc/drawsh5.cxx | 9 +-- sc/source/ui/drawfunc/drtxtob2.cxx | 3 +- sc/source/ui/inc/tabvwsh.hxx | 2 +- sc/source/ui/inc/undodraw.hxx | 2 + sc/source/ui/undo/undodraw.cxx | 140 +++---------------------------------- sc/source/ui/view/tabvwsh4.cxx | 27 +++---- 6 files changed, 27 insertions(+), 156 deletions(-) diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index e79097ef8874..3ae97a37b109 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -299,8 +299,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) rBindings.Invalidate(SID_OBJECT_HEAVEN); rBindings.Invalidate(SID_OBJECT_HELL); // leave draw shell if nothing selected (layer may be locked) - if ( pView->GetMarkedObjectList().GetMarkCount() == 0 ) - pViewData->GetViewShell()->SetDrawShell( FALSE ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_FRAME_TO_TOP: @@ -370,14 +369,12 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) case SID_DELETE: case SID_DELETE_CONTENTS: pView->DeleteMarked(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( FALSE ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_CUT: pView->DoCut(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( FALSE ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_COPY: diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index 27f1a3dbb77f..414bd9a5041d 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -83,8 +83,7 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq ) case SID_CUT: pView->DoCut(); - if (!pTabView->IsDrawSelMode()) - pViewData->GetViewShell()->SetDrawShell( FALSE ); + pViewData->GetViewShell()->UpdateDrawShell(); break; case SID_PASTE: diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 28cc2a823928..dd164a6185d7 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -309,7 +309,7 @@ public: void ExecDrawOpt(SfxRequest& rReq); void GetDrawOptState(SfxItemSet &rSet); - + void UpdateDrawShell(); void SetDrawShell( BOOL bActive ); void SetDrawTextShell( BOOL bActive ); diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx index a2647985af9f..2fef359e2ddc 100644 --- a/sc/source/ui/inc/undodraw.hxx +++ b/sc/source/ui/inc/undodraw.hxx @@ -37,6 +37,8 @@ class ScUndoDraw: public SfxUndoAction SfxUndoAction* pDrawUndo; ScDocShell* pDocShell; + void UpdateSubShell(); + public: TYPEINFO(); ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ); diff --git a/sc/source/ui/undo/undodraw.cxx b/sc/source/ui/undo/undodraw.cxx index a10a7381d808..aed6654cec52 100644 --- a/sc/source/ui/undo/undodraw.cxx +++ b/sc/source/ui/undo/undodraw.cxx @@ -28,141 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -//------------------------------------------------------------------ - -// TOOLS -#define _BIGINT_HXX -#define _SFXMULTISEL_HXX -#define _STACK_HXX -#define _QUEUE_HXX -#define _DYNARR_HXX -#define _TREELIST_HXX -#define _CACHESTR_HXX -#define _NEW_HXX -//#define _SHL_HXX -//#define _LINK_HXX -//#define _ERRCODE_HXX -//#define _GEN_HXX -//#define _FRACT_HXX -//#define _STRING_HXX -//#define _MTF_HXX -//#define _CONTNR_HXX -//#define _LIST_HXX -//#define _TABLE_HXX -#define _DYNARY_HXX -//#define _UNQIDX_HXX -#define _SVMEMPOOL_HXX -//#define _UNQID_HXX -//#define _DEBUG_HXX -//#define _DATE_HXX -//#define _TIME_HXX -//#define _DATETIME_HXX -//#define _INTN_HXX -//#define _WLDCRD_HXX -//#define _FSYS_HXX -//#define _STREAM_HXX -#define _CACHESTR_HXX -#define _SV_MULTISEL_HXX - -//SV -//#define _CLIP_HXX -#define _CONFIG_HXX -#define _CURSOR_HXX -#define _FONTDLG_HXX -#define _PRVWIN_HXX -//#define _COLOR_HXX -//#define _PAL_HXX -//#define _BITMAP_HXX -//#define _GDIOBJ_HXX -//#define _POINTR_HXX -//#define _ICON_HXX -//#define _IMAGE_HXX -//#define _KEYCOD_HXX -//#define _EVENT_HXX -#define _HELP_HXX -//#define _APP_HXX -//#define _MDIAPP_HXX -//#define _TIMER_HXX -//#define _METRIC_HXX -//#define _REGION_HXX -//#define _OUTDEV_HXX -//#define _SYSTEM_HXX -//#define _VIRDEV_HXX -//#define _JOBSET_HXX -//#define _PRINT_HXX -//#define _WINDOW_HXX -//#define _SYSWIN_HXX -//#define _WRKWIN_HXX -#define _MDIWIN_HXX -//#define _FLOATWIN_HXX -//#define _DOCKWIN_HXX -//#define _CTRL_HXX -//#define _SCRBAR_HXX -//#define _BUTTON_HXX -//#define _IMAGEBTN_HXX -//#define _FIXED_HXX -//#define _GROUP_HXX -//#define _EDIT_HXX -//#define _COMBOBOX_HXX -//#define _LSTBOX_HXX -//#define _SELENG_HXX -//#define _SPLIT_HXX -#define _SPIN_HXX -//#define _FIELD_HXX -//#define _MOREBTN_HXX -//#define _TOOLBOX_HXX -//#define _STATUS_HXX -//#define _DIALOG_HXX -//#define _MSGBOX_HXX -//#define _SYSDLG_HXX -#define _FILDLG_HXX -//#define _PRNDLG_HXX -#define _COLDLG_HXX -//#define _TABDLG_HXX -//#define _MENU_HXX -//#define _GDIMTF_HXX -//#define _POLY_HXX -//#define _ACCEL_HXX -//#define _GRAPH_HXX -#define _SOUND_HXX - - -#define SI_NOITEMS -//#define SI_NODRW -#define _SI_NOSBXCONTROLS -#define _SI_NOOTHERFORMS -#define _SI_NOCONTROL -#define _SI_NOSBXCONTROLS -#define _SIDLL_HXX - -// SFX -#define _SFXAPPWIN_HXX -#define _SFX_SAVEOPT_HXX -//#define _SFX_CHILDWIN_HXX -//#define _SFXCTRLITEM_HXX -#define _SFXPRNMON_HXX -#define _INTRO_HXX -#define _SFXMSGDESCR_HXX -#define _SFXMSGPOOL_HXX -#define _SFXFILEDLG_HXX -#define _PASSWD_HXX -#define _SFXTBXCTRL_HXX -#define _SFXSTBITEM_HXX -#define _SFXMNUITEM_HXX -#define _SFXIMGMGR_HXX -#define _SFXTBXMGR_HXX -#define _SFXSTBMGR_HXX -#define _SFX_MINFITEM_HXX -#define _SFXEVENT_HXX - // INCLUDE --------------------------------------------------------------- #include #include "undodraw.hxx" #include "docsh.hxx" +#include "tabvwsh.hxx" // ----------------------------------------------------------------------- @@ -233,12 +105,21 @@ BOOL __EXPORT ScUndoDraw::Merge( SfxUndoAction* pNextAction ) return FALSE; } +void ScUndoDraw::UpdateSubShell() +{ + // #i26822# remove the draw shell if the selected object has been removed + ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(); + if (pViewShell) + pViewShell->UpdateDrawShell(); +} + void __EXPORT ScUndoDraw::Undo() { if (pDrawUndo) { pDrawUndo->Undo(); pDocShell->SetDrawModified(); + UpdateSubShell(); } } @@ -248,6 +129,7 @@ void __EXPORT ScUndoDraw::Redo() { pDrawUndo->Redo(); pDocShell->SetDrawModified(); + UpdateSubShell(); } } diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 0835d08de9fd..329bbeef9e78 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -639,24 +639,15 @@ void ScTabViewShell::DoReadUserData( const String& rData ) //------------------------------------------------------------------ -//UNUSED2008-05 void ScTabViewShell::ExecuteShowNIY( SfxRequest& /* rReq */ ) -//UNUSED2008-05 { -//UNUSED2008-05 ErrorMessage(STR_BOX_YNI); -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 //------------------------------------------------------------------ -//UNUSED2008-05 -//UNUSED2008-05 void ScTabViewShell::StateDisabled( SfxItemSet& rSet ) -//UNUSED2008-05 { -//UNUSED2008-05 SfxWhichIter aIter( rSet ); -//UNUSED2008-05 USHORT nWhich = aIter.FirstWhich(); -//UNUSED2008-05 -//UNUSED2008-05 while ( nWhich ) -//UNUSED2008-05 { -//UNUSED2008-05 rSet.DisableItem( nWhich ); -//UNUSED2008-05 nWhich = aIter.NextWhich(); -//UNUSED2008-05 } -//UNUSED2008-05 } +void ScTabViewShell::UpdateDrawShell() +{ + // Called after user interaction that may delete the selected drawing object. + // Remove DrawShell if nothing is selected. + + SdrView* pDrView = GetSdrView(); + if ( pDrView && !pDrView->AreObjectsMarked() && !IsDrawSelMode() ) + SetDrawShell( FALSE ); +} void ScTabViewShell::SetDrawShellOrSub() { -- cgit From a5000e84730cd45ee5db287670a7256171f75675 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 18 Nov 2010 12:54:00 +0100 Subject: dr78: #i114072# don't broadcast from SetNewRangeNames while loading a file --- sc/source/ui/docshell/docfunc.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index fc8ba28a217e..86fe528701c3 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4477,7 +4477,11 @@ BOOL ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, BOOL /* bApi */ ) pDoc->CompileNameFormula( FALSE ); // CompileFormulaString aModificator.SetDocumentModified(); - SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + + // #i114072# don't broadcast while loading a file + // (navigator and input line for other open documents would be notified) + if ( bCompile ) + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); return TRUE; } -- cgit From eea6d1135ec236baf418a007045f3064ace86a3b Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 18 Nov 2010 15:24:00 +0100 Subject: dr78: #i115641# don't increment progress for empty repeated cells --- sc/source/filter/xml/xmlexprt.cxx | 20 +++++++++++--------- sc/source/filter/xml/xmlexprt.hxx | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index bfd9b2b69dae..eebcdce45ca9 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1814,16 +1814,14 @@ void ScXMLExport::_ExportContent() ++nEqualCells; else { - SetRepeatAttribute(nEqualCells); - WriteCell(aPrevCell); + WriteCell(aPrevCell, nEqualCells); nEqualCells = 0; aPrevCell = aCell; } } else { - SetRepeatAttribute(nEqualCells); - WriteCell(aPrevCell); + WriteCell(aPrevCell, nEqualCells); ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); nEqualCells = 0; @@ -1833,8 +1831,7 @@ void ScXMLExport::_ExportContent() } if (!bIsFirst) { - SetRepeatAttribute(nEqualCells); - WriteCell(aPrevCell); + WriteCell(aPrevCell, nEqualCells); ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); } @@ -2898,8 +2895,11 @@ sal_Bool ScXMLExport::GetCellText (ScMyCell& rMyCell, const ScAddress& aPos) con } } -void ScXMLExport::WriteCell (ScMyCell& aCell) +void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { + // nEqualCellCount is the number of additional cells + SetRepeatAttribute(nEqualCellCount, (aCell.nType != table::CellContentType_EMPTY)); + ScAddress aCellPos; ScUnoConversion::FillScAddress( aCellPos, aCell.aCellAddress ); if (aCell.nStyleIndex != -1) @@ -3470,14 +3470,16 @@ void ScXMLExport::WriteDetective( const ScMyCell& rMyCell ) } } -void ScXMLExport::SetRepeatAttribute (const sal_Int32 nEqualCellCount) +void ScXMLExport::SetRepeatAttribute(sal_Int32 nEqualCellCount, bool bIncProgress) { + // nEqualCellCount is additional cells, so the attribute value is nEqualCellCount+1 if (nEqualCellCount > 0) { sal_Int32 nTemp(nEqualCellCount + 1); OUString sOUEqualCellCount(OUString::valueOf(nTemp)); AddAttribute(sAttrColumnsRepeated, sOUEqualCellCount); - IncrementProgressBar(sal_False, nEqualCellCount); + if (bIncProgress) + IncrementProgressBar(sal_False, nEqualCellCount); } } diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx index e024fc6a0de0..ec273dea8db1 100644 --- a/sc/source/filter/xml/xmlexprt.hxx +++ b/sc/source/filter/xml/xmlexprt.hxx @@ -182,14 +182,14 @@ class ScXMLExport : public SvXMLExport sal_Bool GetCellText (ScMyCell& rMyCell, const ScAddress& aPos) const; - void WriteCell (ScMyCell& aCell); + void WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount); void WriteAreaLink(const ScMyCell& rMyCell); void WriteAnnotation(ScMyCell& rMyCell); void WriteDetective(const ScMyCell& rMyCell); void ExportShape(const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, com::sun::star::awt::Point* pPoint); void WriteShapes(const ScMyCell& rMyCell); void WriteTableShapes(); - void SetRepeatAttribute (const sal_Int32 nEqualCellCount); + void SetRepeatAttribute(sal_Int32 nEqualCellCount, bool bIncProgress); sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const; sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell = NULL) const; -- cgit From 53ac4281d9b85023fc88c6735e0cb796d933ba2c Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 18 Nov 2010 20:05:11 +0100 Subject: dr78: remove unused member in ScDocument --- sc/inc/document.hxx | 4 +--- sc/source/core/data/dpglobal.cxx | 1 + sc/source/core/data/dptablecache.cxx | 1 + sc/source/ui/docshell/docsh.cxx | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) mode change 100755 => 100644 sc/source/core/data/dpglobal.cxx mode change 100755 => 100644 sc/source/core/data/dptablecache.cxx diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 5c4685223281..2318f32fa2ff 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -49,8 +49,7 @@ // Wang Xu Ming -- 2009-8-17 // DataPilot Migration - Cache&&Performance #include -#include "dpobject.hxx" -#include "dptabdat.hxx" +class ScDPTableDataCache; // End Comments class KeyEvent; @@ -273,7 +272,6 @@ private: ScDPCollection* pDPCollection; // Wang Xu Ming -- 2009-8-17 // DataPilot Migration - Cache&&Performance - std::list m_listDPObjectsInClip; std::list m_listDPObjectsCaches; // End Comments ScChartCollection* pChartCollection; diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx old mode 100755 new mode 100644 index 6b84d37d8d0f..9a427d61a2d1 --- a/sc/source/core/data/dpglobal.cxx +++ b/sc/source/core/data/dpglobal.cxx @@ -33,6 +33,7 @@ #include "precompiled_sc.hxx" #include "dpglobal.hxx" +#include "dpobject.hxx" #include "document.hxx" #include diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx old mode 100755 new mode 100644 index 8f25b70e41b6..b1f7ab44bbb2 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -32,6 +32,7 @@ #include "precompiled_sc.hxx" // INCLUDE --------------------------------------------------------------- #include "dptablecache.hxx" +#include "dptabdat.hxx" #include "document.hxx" #include "cell.hxx" #include "globstr.hrc" diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d5d7f6e09292..480528782e0f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -121,6 +121,7 @@ #include "optsolver.hxx" #include "sheetdata.hxx" #include "tabprotection.hxx" +#include "dpobject.hxx" #include "docsh.hxx" #include "docshimp.hxx" -- cgit From 29ed69246f467fd54cf430e1a0b1490d7ce00bbd Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 19 Nov 2010 16:06:05 +0100 Subject: dr78: #i114518# don't resize/invalidate in DataChanged if called from Paint --- sc/source/ui/inc/preview.hxx | 3 ++- sc/source/ui/view/preview.cxx | 39 +++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx index 87d15dcdaf86..d180e07e9805 100644 --- a/sc/source/ui/inc/preview.hxx +++ b/sc/source/ui/inc/preview.hxx @@ -64,7 +64,8 @@ private: FmFormView* pDrawView; // intern: - BOOL bInPaint; + bool bInPaint; + bool bInSetZoom; BOOL bInGetState; ScDocShell* pDocShell; ScPreviewShell* pViewShell; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 83fdab9000e6..223e5da61033 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -109,7 +109,8 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView bLocationValid( FALSE ), pLocationData( NULL ), pDrawView( NULL ), - bInPaint( FALSE ), + bInPaint( false ), + bInSetZoom( false ), bInGetState( FALSE ), pDocShell( pDocSh ), pViewShell( pViewSh ), @@ -482,6 +483,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) //Issue51656 Add resizeable margin on page preview from maoyg void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ ) { + bool bWasInPaint = bInPaint; // nested calls shouldn't be necessary, but allow for now + bInPaint = true; + if (!bValid) { CalcPages(0); @@ -665,6 +669,8 @@ void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ ) } } pViewShell->UpdateScrollBars(); + + bInPaint = bWasInPaint; } //Issue51656 Add resizeable margin on page preview from maoyg @@ -783,9 +789,9 @@ void ScPreview::SetZoom(USHORT nNewZoom) MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); - bInPaint = TRUE; // don't scroll during SetYOffset in UpdateScrollBars + bInSetZoom = true; // don't scroll during SetYOffset in UpdateScrollBars pViewShell->UpdateScrollBars(); - bInPaint = FALSE; + bInSetZoom = false; bStateValid = FALSE; InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -892,7 +898,7 @@ void ScPreview::SetXOffset( long nX ) { long nDif = LogicToPixel(aOffset).X() - LogicToPixel(Point(nX,0)).X(); aOffset.X() = nX; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( nDif, 0 ); @@ -902,7 +908,7 @@ void ScPreview::SetXOffset( long nX ) else { aOffset.X() = nX; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -919,7 +925,7 @@ void ScPreview::SetYOffset( long nY ) { long nDif = LogicToPixel(aOffset).Y() - LogicToPixel(Point(0,nY)).Y(); aOffset.Y() = nY; - if (nDif && !bInPaint) + if (nDif && !bInSetZoom) { MapMode aOldMode = GetMapMode(); SetMapMode(MAP_PIXEL); Scroll( 0, nDif ); @@ -929,7 +935,7 @@ void ScPreview::SetYOffset( long nY ) else { aOffset.Y() = nY; - if (!bInPaint) + if (!bInSetZoom) Invalidate(); } InvalidateLocationData( SC_HINT_ACC_VISAREACHANGED ); @@ -993,15 +999,20 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) if ( rDCEvt.GetType() == DATACHANGED_FONTS ) pDocShell->UpdateFontList(); - if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + // #i114518# Paint of form controls may modify the window's settings. + // Ignore the event if it is called from within Paint. + if ( !bInPaint ) { - // scroll bar size may have changed - pViewShell->InvalidateBorder(); // calls OuterResizePixel - } + if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + // scroll bar size may have changed + pViewShell->InvalidateBorder(); // calls OuterResizePixel + } - Invalidate(); - InvalidateLocationData( SC_HINT_DATACHANGED ); + Invalidate(); + InvalidateLocationData( SC_HINT_DATACHANGED ); + } } } -- cgit From 6eb12fd797e84788ce0471dd646c4015d4ffbb28 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 19 Nov 2010 19:48:40 +0100 Subject: dr78: #i88468# merge page margin display back into DoPrint --- sc/source/ui/inc/printfun.hxx | 14 +- sc/source/ui/view/preview.cxx | 289 ++++++++++++++--------------------------- sc/source/ui/view/printfun.cxx | 48 ------- 3 files changed, 103 insertions(+), 248 deletions(-) mode change 100755 => 100644 sc/source/ui/view/printfun.cxx diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index e3966bdc3d37..fccee3812bba 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -247,14 +247,6 @@ public: const ScPrintState& rState, const ScPrintOptions* pOptions ); - ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab, - long nPage = 0, long nDocP = 0, - const ScRange* pArea = NULL, - const ScPrintOptions* pOptions = NULL ); - - ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState, - const ScPrintOptions* pOptions ); ~ScPrintFunc(); static void DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double nPrintFactor, @@ -276,10 +268,8 @@ public: void ApplyPrintSettings(); // aus DoPrint() schon gerufen long DoPrint( const MultiSelection& rPageRanges, - /*long nStartPage, long nDisplayStart, BOOL bDoPrint, - SfxProgress* pProgress, ScPreviewLocationData* pLocationData );*/ - long nStartPage, long nDisplayStart, BOOL bDoPrint = TRUE, - SfxProgress* pProgress = NULL, ScPreviewLocationData* pLocationData = NULL); + long nStartPage, long nDisplayStart, BOOL bDoPrint, + SfxProgress* pProgress, ScPreviewLocationData* pLocationData ); // Werte abfragen - sofort diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 223e5da61033..ede1e2dc81a7 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -140,6 +140,9 @@ ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pView SetUniqueId( HID_SC_WIN_PREVIEW ); SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); + + for (SCCOL i=0; i<=MAXCOL; i++) + nRight[i] = 0; // initialized with actual positions when markers are drawn } @@ -368,6 +371,16 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) DrawRect(Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); } + long nLeftMargin = 0; + long nRightMargin = 0; + long nTopMargin = 0; + long nBottomMargin = 0; + BOOL bHeaderOn = FALSE; + BOOL bFooterOn = FALSE; + + ScDocument* pDoc = pDocShell->GetDocument(); + BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + Size aLocalPageSize; if ( bValidPage ) { @@ -397,13 +410,61 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) DBG_ASSERT(nPrinted<=1, "was'n nu los?"); SetMapMode(aMMMode); -// USHORT nPrintZoom = pPrintFunc->GetZoom(); + + //init nLeftMargin ... in the ScPrintFunc::InitParam!!! + nLeftMargin = pPrintFunc->GetLeftMargin(); + nRightMargin = pPrintFunc->GetRightMargin(); + nTopMargin = pPrintFunc->GetTopMargin(); + nBottomMargin = pPrintFunc->GetBottomMargin(); + nHeaderHeight = pPrintFunc->GetHeader().nHeight; + nFooterHeight = pPrintFunc->GetFooter().nHeight; + bHeaderOn = pPrintFunc->GetHeader().bEnable; + bFooterOn = pPrintFunc->GetFooter().bEnable; + mnScale = pPrintFunc->GetZoom(); + + if ( bDoPrint && bPageMargin && pLocationData ) // don't make use of pLocationData while filling it + { + Rectangle aPixRect; + Rectangle aRectCellPosition; + Rectangle aRectPosition; + pLocationData->GetMainCellRange( aPageArea, aPixRect ); + if( !bLayoutRTL ) + { + pLocationData->GetCellPosition( aPageArea.aStart, aRectPosition ); + nLeftPosition = aRectPosition.Left(); + for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ ) + { + pLocationData->GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition ); + nRight[i] = aRectCellPosition.Right(); + } + } + else + { + pLocationData->GetCellPosition( aPageArea.aEnd, aRectPosition ); + nLeftPosition = aRectPosition.Right()+1; + + pLocationData->GetCellPosition( aPageArea.aStart,aRectCellPosition ); + nRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left(); + for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- ) + { + pLocationData->GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition ); + nRight[ i-1 ] = nRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1; + } + } + } if (nPrinted) // wenn nichts, alles grau zeichnen { aLocalPageSize = pPrintFunc->GetPageSize(); aLocalPageSize.Width() = (long) (aLocalPageSize.Width() * HMM_PER_TWIPS ); aLocalPageSize.Height() = (long) (aLocalPageSize.Height() * HMM_PER_TWIPS ); + + nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS ); + nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS ); + nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS ); + nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS ); + nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); + nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); } if (!bStateValid) @@ -426,8 +487,39 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) Point aWinEnd( aWinSize.Width(), aWinSize.Height() ); BOOL bRight = nPageEndX <= aWinEnd.X(); BOOL bBottom = nPageEndY <= aWinEnd.Y(); + + if( bPageMargin && bValidPage ) + { + SetMapMode(aMMMode); + SetLineColor( COL_BLACK ); + DrawInvert( (long)( nTopMargin - aOffset.Y() ), POINTER_VSIZEBAR ); + DrawInvert( (long)(nPageEndY - nBottomMargin ), POINTER_VSIZEBAR ); + DrawInvert( (long)( nLeftMargin - aOffset.X() ), POINTER_HSIZEBAR ); + DrawInvert( (long)( nPageEndX - nRightMargin ) , POINTER_HSIZEBAR ); + if( bHeaderOn ) + { + DrawInvert( nHeaderHeight - aOffset.Y(), POINTER_VSIZEBAR ); + } + if( bFooterOn ) + { + DrawInvert( nPageEndY - nFooterHeight, POINTER_VSIZEBAR ); + } + + SetMapMode( MapMode( MAP_PIXEL ) ); + for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) + { + Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); + SetLineColor( COL_BLACK ); + SetFillColor( COL_BLACK ); + DrawRect( Rectangle( Point( nRight[i] - 2, aColumnTop.Y() ),Point( nRight[i] + 2 , 4 + aColumnTop.Y()) )); + DrawLine( Point( nRight[i], aColumnTop.Y() ), Point( nRight[i], 10 + aColumnTop.Y()) ); + } + SetMapMode( aMMMode ); + } + if (bRight || bBottom) { + SetMapMode(aMMMode); SetLineColor(); SetFillColor(aBackColor); if (bRight) @@ -486,188 +578,9 @@ void __EXPORT ScPreview::Paint( const Rectangle& /* rRect */ ) bool bWasInPaint = bInPaint; // nested calls shouldn't be necessary, but allow for now bInPaint = true; - if (!bValid) - { - CalcPages(0); - RecalcPages(); - UpdateDrawView(); // Table possibly amended - } - - Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); - MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); - - ScModule* pScMod = SC_MOD(); - const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig(); - Color aBackColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor ); - - if ( aOffset.X() < 0 || aOffset.Y() < 0 ) - { - SetMapMode( aMMMode ); - SetLineColor(); - SetFillColor(aBackColor); - - Size aWinSize = GetOutputSize(); - if ( aOffset.X() < 0 ) - DrawRect(Rectangle( 0, 0, -aOffset.X(), aWinSize.Height() )); - if ( aOffset.Y() < 0 ) - DrawRect(Rectangle( 0, 0, aWinSize.Width(), -aOffset.Y() )); - } - - long nLeftMargin = 0; - long nRightMargin = 0; - long nTopMargin = 0; - long nBottomMargin = 0; - BOOL bHeaderOn = FALSE; - BOOL bFooterOn = FALSE; - - ScDocument* pDoc = pDocShell->GetDocument(); - BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - - Size aPaintPageSize; - if ( nPageNo < nTotalPages ) - { - ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); - - ScPrintFunc* pPrintFunc; - if ( bStateValid ) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); - else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); - - pPrintFunc->SetOffset(aOffset); - pPrintFunc->SetManualZoom(nZoom); - pPrintFunc->SetDateTime(aDate,aTime); - pPrintFunc->SetClearFlag(TRUE); - pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() ); - pPrintFunc->SetDrawView( pDrawView ); - - // Multi Selection for one side must be something umstaendlich generated ... - Range aPageRange( nPageNo+1, nPageNo+1 ); - MultiSelection aPage( aPageRange ); - aPage.SetTotalRange( Range(0,RANGE_MAX) ); - aPage.Select( aPageRange ); - - long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart ); - DBG_ASSERT(nPrinted<=1, "was'n nu los?"); - - SetMapMode(aMMMode); - - //init nLeftMargin ... in the ScPrintFunc::InitParam!!! - nLeftMargin = pPrintFunc->GetLeftMargin(); - nRightMargin = pPrintFunc->GetRightMargin(); - nTopMargin = pPrintFunc->GetTopMargin(); - nBottomMargin = pPrintFunc->GetBottomMargin(); - nHeaderHeight = pPrintFunc->GetHeader().nHeight; - nFooterHeight = pPrintFunc->GetFooter().nHeight; - bHeaderOn = pPrintFunc->GetHeader().bEnable; - bFooterOn = pPrintFunc->GetFooter().bEnable; - mnScale = pPrintFunc->GetZoom(); - - Rectangle aPixRect; - Rectangle aRectCellPosition; - Rectangle aRectPosition; - GetLocationData().GetMainCellRange( aPageArea, aPixRect ); - if( !bLayoutRTL ) - { - GetLocationData().GetCellPosition( aPageArea.aStart, aRectPosition ); - nLeftPosition = aRectPosition.Left(); - for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ ) - { - GetLocationData().GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition ); - nRight[i] = aRectCellPosition.Right(); - } - } - else - { - GetLocationData().GetCellPosition( aPageArea.aEnd, aRectPosition ); - nLeftPosition = aRectPosition.Right()+1; - - GetLocationData().GetCellPosition( aPageArea.aStart,aRectCellPosition ); - nRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left(); - for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- ) - { - GetLocationData().GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition ); - nRight[ i-1 ] = nRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1; - } - } - - if ( nPrinted ) // If nothing, all gray draw - { - aPaintPageSize = pPrintFunc->GetPageSize(); - aPaintPageSize.Width() = (long) (aPaintPageSize.Width() * HMM_PER_TWIPS ); - aPaintPageSize.Height() = (long) (aPaintPageSize.Height() * HMM_PER_TWIPS ); - - nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS ); - nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS ); - nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS ); - nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS ); - nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); - nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); - } - - if ( !bStateValid ) - { - pPrintFunc->GetPrintState( aState ); - aState.nDocPages = nTotalPages; - bStateValid = TRUE; - } - - delete pPrintFunc; - } - - - long nPageEndX = aPaintPageSize.Width() - aOffset.X(); - long nPageEndY = aPaintPageSize.Height() - aOffset.Y(); - Size aWinSize = GetOutputSize(); - Point aWinEnd( aWinSize.Width(), aWinSize.Height() ); - BOOL bRight = nPageEndX <= aWinEnd.X(); - BOOL bBottom = nPageEndY <= aWinEnd.Y(); - - if( bPageMargin ) - { - SetMapMode(aMMMode); - SetLineColor( COL_BLACK ); - DrawInvert( (long)( nTopMargin - aOffset.Y() ), POINTER_VSIZEBAR ); - DrawInvert( (long)(nPageEndY - nBottomMargin ), POINTER_VSIZEBAR ); - DrawInvert( (long)( nLeftMargin - aOffset.X() ), POINTER_HSIZEBAR ); - DrawInvert( (long)( nPageEndX - nRightMargin ) , POINTER_HSIZEBAR ); - if( bHeaderOn ) - { - DrawInvert( nHeaderHeight - aOffset.Y(), POINTER_VSIZEBAR ); - } - if( bFooterOn ) - { - DrawInvert( nPageEndY - nFooterHeight, POINTER_VSIZEBAR ); - } - - SetMapMode( MapMode( MAP_PIXEL ) ); - for( int i= aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) - { - Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); - SetLineColor( COL_BLACK ); - SetFillColor( COL_BLACK ); - DrawRect( Rectangle( Point( nRight[i] - 2, aColumnTop.Y() ),Point( nRight[i] + 2 , 4 + aColumnTop.Y()) )); - DrawLine( Point( nRight[i], aColumnTop.Y() ), Point( nRight[i], 10 + aColumnTop.Y()) ); - } - SetMapMode( aMMMode ); - } - - if (bRight || bBottom) - { - SetMapMode(aMMMode); - SetLineColor(); - SetFillColor(aBackColor); - if (bRight) - DrawRect(Rectangle(nPageEndX,0, aWinEnd.X(),aWinEnd.Y())); - if (bBottom) - { - if (bRight) - DrawRect(Rectangle(0,nPageEndY, nPageEndX,aWinEnd.Y())); // Ecke nicht doppelt - else - DrawRect(Rectangle(0,nPageEndY, aWinEnd.X(),aWinEnd.Y())); - } - } + if (bPageMargin) + GetLocationData(); // fill location data for column positions + DoPrint( NULL ); pViewShell->UpdateScrollBars(); bInPaint = bWasInPaint; @@ -1177,7 +1090,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } @@ -1273,7 +1186,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } @@ -1329,7 +1242,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if ( ValidTab( nTab ) ) { - ScPrintFunc aPrintFunc( pDocShell, this, nTab ); + ScPrintFunc aPrintFunc( this, pDocShell, nTab ); aPrintFunc.UpdatePages(); } Rectangle nRect(0,0,10000,10000); @@ -1363,9 +1276,9 @@ void __EXPORT ScPreview::MouseMove( const MouseEvent& rMEvt ) ScPrintFunc* pPrintFunc; if (bStateValid) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, aState, &aOptions ); else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); nLeftMargin = (long)( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() ); nRightMargin = (long)( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS ); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx old mode 100755 new mode 100644 index 378ea1233cf9..fa962a589b77 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -304,54 +304,6 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, Construct( pOptions ); } -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, SCTAB nTab, - long nPage, long nDocP, const ScRange* pArea, - const ScPrintOptions* pOptions ) - : pDocShell ( pShell ), - pPrinter ( NULL ), - pDrawView ( NULL ), - nPrintTab ( nTab ), - nPageStart ( nPage ), - nDocPages ( nDocP ), - pUserArea ( pArea ), - bState ( FALSE ), - bPrintCurrentTable ( FALSE ), - bMultiArea ( FALSE ), - nTabPages ( 0 ), - nTotalPages ( 0 ), - pPageData ( NULL ) -{ - pDev = pWindow; - Construct( pOptions ); -} -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState, const ScPrintOptions* pOptions ) - : pDocShell ( pShell ), - pPrinter ( NULL ), - pDrawView ( NULL ), - pUserArea ( NULL ), - bPrintCurrentTable ( FALSE ), - bMultiArea ( FALSE ), - pPageData ( NULL ) -{ - pDev = pWindow; - - nPrintTab = rState.nPrintTab; - nStartCol = rState.nStartCol; - nStartRow = rState.nStartRow; - nEndCol = rState.nEndCol; - nEndRow = rState.nEndRow; - nZoom = rState.nZoom; - nPagesX = rState.nPagesX; - nPagesY = rState.nPagesY; - nTabPages = rState.nTabPages; - nTotalPages = rState.nTotalPages; - nPageStart = rState.nPageStart; - nDocPages = rState.nDocPages; - bState = TRUE; - - Construct( pOptions ); -} void ScPrintFunc::GetPrintState( ScPrintState& rState ) { -- cgit From 681c5b71e215d1b6c57dd50c394f8053b58aad18 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 24 Nov 2010 18:44:06 +0100 Subject: dr78: #i115015# proper handling of add-in parameter arrays, merged with database functions QueryParam --- sc/inc/document.hxx | 1 + sc/source/core/data/dociter.cxx | 3 ++- sc/source/core/data/document.cxx | 54 +++++++++++++++++++++++++++++++++++++++ sc/source/core/inc/doubleref.hxx | 3 --- sc/source/core/tool/doubleref.cxx | 52 ++----------------------------------- sc/source/core/tool/rangeseq.cxx | 30 +++++++++++++++++----- 6 files changed, 83 insertions(+), 60 deletions(-) mode change 100644 => 100755 sc/source/core/data/dociter.cxx diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 2318f32fa2ff..bd4770177ae4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -787,6 +787,7 @@ public: SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); + sal_uInt16 GetStringForFormula( const ScAddress& rPos, rtl::OUString& rString ); SC_DLLPUBLIC double GetValue( const ScAddress& ); SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ); SC_DLLPUBLIC double RoundValueAsShown( double fVal, ULONG nFormat ); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx old mode 100644 new mode 100755 index aa5b011da93b..83a502422e2e --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -541,7 +541,8 @@ SCSIZE ScDBQueryDataIterator::SearchColEntryIndex(ScDocument& rDoc, SCTAB nTab, ScDBQueryDataIterator::DataAccessInternal::DataAccessInternal(const ScDBQueryDataIterator* pParent, ScDBQueryParamInternal* pParam, ScDocument* pDoc) : DataAccess(pParent), mpParam(pParam), - mpDoc(pDoc) + mpDoc(pDoc), + bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() ) { nCol = mpParam->mnField; nRow = mpParam->nRow1; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 192e6f69bc67..92a195c1f364 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2693,6 +2693,60 @@ void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rSt } +sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, rtl::OUString& rString ) +{ + // Used in formulas (add-in parameters etc), so it must use the same semantics as + // ScInterpreter::GetCellString: always format values as numbers. + // The return value is the error code. + + sal_uInt16 nErr = 0; + String aStr; + ScBaseCell* pCell = GetCell( rPos ); + if (pCell) + { + SvNumberFormatter* pFormatter = GetFormatTable(); + switch (pCell->GetCellType()) + { + case CELLTYPE_STRING: + static_cast(pCell)->GetString(aStr); + break; + case CELLTYPE_EDIT: + static_cast(pCell)->GetString(aStr); + break; + case CELLTYPE_FORMULA: + { + ScFormulaCell* pFCell = static_cast(pCell); + nErr = pFCell->GetErrCode(); + if (pFCell->IsValue()) + { + double fVal = pFCell->GetValue(); + ULONG nIndex = pFormatter->GetStandardFormat( + NUMBERFORMAT_NUMBER, + ScGlobal::eLnge); + pFormatter->GetInputLineString(fVal, nIndex, aStr); + } + else + pFCell->GetString(aStr); + } + break; + case CELLTYPE_VALUE: + { + double fVal = static_cast(pCell)->GetValue(); + ULONG nIndex = pFormatter->GetStandardFormat( + NUMBERFORMAT_NUMBER, + ScGlobal::eLnge); + pFormatter->GetInputLineString(fVal, nIndex, aStr); + } + break; + default: + ; + } + } + rString = aStr; + return nErr; +} + + void ScDocument::GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) { if ( VALIDTAB(nTab) && pTab[nTab] ) diff --git a/sc/source/core/inc/doubleref.hxx b/sc/source/core/inc/doubleref.hxx index 10221d942c9c..52f437e327f5 100644 --- a/sc/source/core/inc/doubleref.hxx +++ b/sc/source/core/inc/doubleref.hxx @@ -139,9 +139,6 @@ public: virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const; virtual bool isRangeEqual(const ScRange& rRange) const; -private: - sal_uInt16 getCellString(::rtl::OUString& rStr, ScBaseCell* pCell) const; - private: ScRange maRange; }; diff --git a/sc/source/core/tool/doubleref.cxx b/sc/source/core/tool/doubleref.cxx index 740413ea8533..9e9ad4a97923 100644 --- a/sc/source/core/tool/doubleref.cxx +++ b/sc/source/core/tool/doubleref.cxx @@ -334,6 +334,7 @@ OUString ScDBInternalRange::getString(SCCOL nCol, SCROW nRow) const const ScAddress& s = maRange.aStart; // #i109200# this is used in formula calculation, use GetInputString, not GetString // (consistent with ScDBInternalRange::getCellString) + // GetStringForFormula is not used here, to allow querying for date values. getDoc()->GetInputString(s.Col() + nCol, s.Row() + nRow, maRange.aStart.Tab(), aStr); return aStr; } @@ -358,54 +359,6 @@ SCCOL ScDBInternalRange::findFieldColumn(SCCOL nIndex) const return Min(nDBCol2, static_cast(nDBCol1 + nIndex - 1)); } -sal_uInt16 ScDBInternalRange::getCellString(OUString& rStr, ScBaseCell* pCell) const -{ - sal_uInt16 nErr = 0; - String aStr; - if (pCell) - { - SvNumberFormatter* pFormatter = getDoc()->GetFormatTable(); - switch (pCell->GetCellType()) - { - case CELLTYPE_STRING: - ((ScStringCell*) pCell)->GetString(aStr); - break; - case CELLTYPE_EDIT: - ((ScEditCell*) pCell)->GetString(aStr); - break; - case CELLTYPE_FORMULA: - { - ScFormulaCell* pFCell = (ScFormulaCell*) pCell; - nErr = pFCell->GetErrCode(); - if (pFCell->IsValue()) - { - double fVal = pFCell->GetValue(); - ULONG nIndex = pFormatter->GetStandardFormat( - NUMBERFORMAT_NUMBER, - ScGlobal::eLnge); - pFormatter->GetInputLineString(fVal, nIndex, aStr); - } - else - pFCell->GetString(aStr); - } - break; - case CELLTYPE_VALUE: - { - double fVal = ((ScValueCell*) pCell)->GetValue(); - ULONG nIndex = pFormatter->GetStandardFormat( - NUMBERFORMAT_NUMBER, - ScGlobal::eLnge); - pFormatter->GetInputLineString(fVal, nIndex, aStr); - } - break; - default: - ; - } - } - rStr = aStr; - return nErr; -} - SCCOL ScDBInternalRange::findFieldColumn(const OUString& rStr, sal_uInt16* pErr) const { const ScAddress& s = maRange.aStart; @@ -426,8 +379,7 @@ SCCOL ScDBInternalRange::findFieldColumn(const OUString& rStr, sal_uInt16* pErr) ScAddress aLook( nDBCol1, nDBRow1, nDBTab1 ); while (!bFound && (aLook.Col() <= nDBCol2)) { - ScBaseCell* pCell = getDoc()->GetCell( aLook ); - sal_uInt16 nErr = getCellString( aCellStr, pCell ); + sal_uInt16 nErr = getDoc()->GetStringForFormula( aLook, aCellStr ); if (pErr) *pErr = nErr; lcl_toUpper(aCellStr); diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index 5584fb1c37e2..2bb6c58cffa2 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -39,6 +39,7 @@ #include "rangeseq.hxx" #include "document.hxx" +#include "dociter.hxx" #include "scmatrix.hxx" #include "cell.hxx" @@ -46,6 +47,20 @@ using namespace com::sun::star; //------------------------------------------------------------------------ +bool lcl_HasErrors( ScDocument* pDoc, const ScRange& rRange ) +{ + // no need to look at empty cells - just use ScCellIterator + ScCellIterator aIter( pDoc, rRange ); + ScBaseCell* pCell = aIter.GetFirst(); + while (pCell) + { + if ( pCell->GetCellType() == CELLTYPE_FORMULA && static_cast(pCell)->GetErrCode() != 0 ) + return true; + pCell = aIter.GetNext(); + } + return false; // no error found +} + long lcl_DoubleToLong( double fVal ) { double fInt = (fVal >= 0.0) ? ::rtl::math::approxFloor( fVal ) : @@ -78,7 +93,7 @@ BOOL ScRangeToSequence::FillLongArray( uno::Any& rAny, ScDocument* pDoc, const S } rAny <<= aRowSeq; - return TRUE; //! check for errors + return !lcl_HasErrors( pDoc, rRange ); } @@ -134,7 +149,7 @@ BOOL ScRangeToSequence::FillDoubleArray( uno::Any& rAny, ScDocument* pDoc, const } rAny <<= aRowSeq; - return TRUE; //! check for errors + return !lcl_HasErrors( pDoc, rRange ); } @@ -176,7 +191,7 @@ BOOL ScRangeToSequence::FillStringArray( uno::Any& rAny, ScDocument* pDoc, const long nColCount = rRange.aEnd.Col() + 1 - rRange.aStart.Col(); long nRowCount = rRange.aEnd.Row() + 1 - rRange.aStart.Row(); - String aDocStr; + bool bHasErrors = false; uno::Sequence< uno::Sequence > aRowSeq( nRowCount ); uno::Sequence* pRowAry = aRowSeq.getArray(); @@ -186,14 +201,17 @@ BOOL ScRangeToSequence::FillStringArray( uno::Any& rAny, ScDocument* pDoc, const rtl::OUString* pColAry = aColSeq.getArray(); for (long nCol = 0; nCol < nColCount; nCol++) { - pDoc->GetString( (SCCOL)(nStartCol+nCol), (SCROW)(nStartRow+nRow), nTab, aDocStr ); - pColAry[nCol] = rtl::OUString( aDocStr ); + sal_uInt16 nErrCode = pDoc->GetStringForFormula( + ScAddress((SCCOL)(nStartCol+nCol), (SCROW)(nStartRow+nRow), nTab), + pColAry[nCol] ); + if ( nErrCode != 0 ) + bHasErrors = true; } pRowAry[nRow] = aColSeq; } rAny <<= aRowSeq; - return TRUE; //! check for errors + return !bHasErrors; } -- cgit From 7f91c62abdc52c812929bb323e6bbce80958d2b9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 26 Nov 2010 15:08:17 +0100 Subject: dba34c: #i115779# DatabaseObjectView: don#t deliver an empty frame to the caller --- dbaccess/source/ui/app/AppController.cxx | 8 ++++---- dbaccess/source/ui/app/AppControllerGen.cxx | 1 - dbaccess/source/ui/misc/databaseobjectview.cxx | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 595d9b412851..d75272e796a4 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1304,8 +1304,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa ::comphelper::NamedValueCollection aCreationArgs; aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); + const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL ); } } @@ -1356,8 +1356,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() ); - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); + const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL ); } } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 9965f00dbd21..6e31a23ec997 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -670,7 +670,6 @@ void OApplicationController::askToReconnect() void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nType, const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition ) { - OSL_PRECOND( _xDocument.is(), "OApplicationController::onDocumentOpened: illegal document!" ); if ( !_xDocument.is() ) return; diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 68f702b11d75..bcbfd019e48d 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -162,9 +162,6 @@ namespace dbaui 0, i_rDispatchArgs.getPropertyValues() ); - - if ( !xReturn.is() ) - xReturn.set( m_xFrameLoader, UNO_QUERY ); } catch( const Exception& ) { -- cgit From c0ec842414bb213c7124a2c4d9745231d508fe6d Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Fri, 26 Nov 2010 15:22:57 +0100 Subject: dba34c: #i94053# remove lastvalue --- forms/source/component/Edit.cxx | 58 ++++++++++++++++++----------------------- forms/source/component/Edit.hxx | 1 - 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index 3a36078a7fed..f409e154096c 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -675,7 +675,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType ) void OEditModel::resetNoBroadcast() { OEditBaseModel::resetNoBroadcast(); - m_aLastKnownValue.clear(); } //------------------------------------------------------------------------------ @@ -683,38 +682,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); - if ( aNewValue != m_aLastKnownValue ) - { - ::rtl::OUString sNewValue; - aNewValue >>= sNewValue; + ::rtl::OUString sNewValue; + aNewValue >>= sNewValue; - if ( !aNewValue.hasValue() - || ( !sNewValue.getLength() // an empty string - && m_bEmptyIsNull // which should be interpreted as NULL - ) + if ( !aNewValue.hasValue() + || ( !sNewValue.getLength() // an empty string + && m_bEmptyIsNull // which should be interpreted as NULL ) + ) + { + m_xColumnUpdate->updateNull(); + } + else + { + OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); + try { - m_xColumnUpdate->updateNull(); - } - else - { - OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); - try + if ( m_pValueFormatter.get() ) { - if ( m_pValueFormatter.get() ) - { - if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) - return sal_False; - } - else - m_xColumnUpdate->updateString( sNewValue ); - } - catch ( const Exception& ) - { - return sal_False; + if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) + return sal_False; } + else + m_xColumnUpdate->updateString( sNewValue ); + } + catch ( const Exception& ) + { + return sal_False; } - m_aLastKnownValue = aNewValue; } return sal_True; @@ -724,6 +719,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) Any OEditModel::translateDbColumnToControlValue() { OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" ); + Any aRet; if ( m_pValueFormatter.get() ) { ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() ); @@ -732,7 +728,6 @@ Any OEditModel::translateDbColumnToControlValue() && m_pValueFormatter->getColumn()->wasNull() ) { - m_aLastKnownValue.clear(); } else { @@ -744,14 +739,11 @@ Any OEditModel::translateDbColumnToControlValue() sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() ); } - m_aLastKnownValue <<= sValue; + aRet <<= sValue; } } - else - m_aLastKnownValue.clear(); - return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() ); - // (m_aLastKnownValue is alllowed to be VOID, the control value isn't) + return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() ); } //------------------------------------------------------------------------------ diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx index 5b4146b82d06..3b4c7c55a436 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -44,7 +44,6 @@ namespace frm class OEditModel :public OEditBaseModel { - ::com::sun::star::uno::Any m_aLastKnownValue; ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter; sal_Bool m_bMaxTextLenModified : 1; // set to when we change the MaxTextLen of the aggregate -- cgit From 048dfa981e9ab2b8b701d90020552f399affcbfe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 26 Nov 2010 15:24:56 +0100 Subject: dba34c: #i112884# isClosed: don't crash if we're already closed ... --- dbaccess/source/core/dataaccess/SharedConnection.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx index d2b9f4d5196a..58625fe15170 100644 --- a/dbaccess/source/core/dataaccess/SharedConnection.cxx +++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx @@ -129,6 +129,8 @@ void SAL_CALL OSharedConnection::rollback( ) throw(SQLException, RuntimeExcepti sal_Bool SAL_CALL OSharedConnection::isClosed( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xConnection.is() ) + return sal_True; return m_xConnection->isClosed(); } -- cgit From 4c0a725a5eb3c818043db92f031bd3564d3d508d Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Tue, 30 Nov 2010 08:38:50 +0100 Subject: dba34c: code refactoring --- .../star/wizards/agenda/AgendaWizardDialog.java | 2 +- .../com/sun/star/wizards/common/PropertyNames.java | 1 + wizards/com/sun/star/wizards/common/UCB.java | 2 +- .../com/sun/star/wizards/db/SQLQueryComposer.java | 2 +- .../com/sun/star/wizards/fax/FaxWizardDialog.java | 2 +- .../sun/star/wizards/form/FormControlArranger.java | 348 ++++++++++----------- .../com/sun/star/wizards/form/FormDocument.java | 22 +- wizards/com/sun/star/wizards/form/FormWizard.java | 50 ++- .../com/sun/star/wizards/form/StyleApplier.java | 4 +- .../sun/star/wizards/form/UIControlArranger.java | 10 +- .../star/wizards/letter/LetterWizardDialog.java | 2 +- .../com/sun/star/wizards/query/QueryWizard.java | 2 +- .../com/sun/star/wizards/report/Dataimport.java | 2 +- .../com/sun/star/wizards/report/ReportWizard.java | 2 +- .../com/sun/star/wizards/table/TableWizard.java | 2 +- wizards/com/sun/star/wizards/web/FTPDialog.java | 6 +- .../com/sun/star/wizards/web/ImageListDialog.java | 2 +- wizards/com/sun/star/wizards/web/StatusDialog.java | 4 +- .../com/sun/star/wizards/web/WebWizardDialog.java | 2 +- 19 files changed, 225 insertions(+), 242 deletions(-) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java index 219125b64bd2..0a6b82f4a9fb 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java @@ -134,7 +134,7 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda //set dialog properties... Helper.setUnoPropertyValues(xDialogModel, - new String[] { "Closeable",PropertyNames.PROPERTY_HEIGHT,"Moveable",PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,"Title",PropertyNames.PROPERTY_WIDTH}, + new String[] { "Closeable",PropertyNames.PROPERTY_HEIGHT,"Moveable",PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,PropertyNames.PROPERTY_TITLE,PropertyNames.PROPERTY_WIDTH}, new Object[] { Boolean.TRUE,new Integer(210),Boolean.TRUE,new Integer(200),new Integer(52),INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,new Integer(310)} ); diff --git a/wizards/com/sun/star/wizards/common/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java index 791f1da3a2fe..ff0e0717895d 100644 --- a/wizards/com/sun/star/wizards/common/PropertyNames.java +++ b/wizards/com/sun/star/wizards/common/PropertyNames.java @@ -46,4 +46,5 @@ public class PropertyNames public static String PROPERTY_TABINDEX = "TabIndex"; public static String PROPERTY_STATE = "State"; public static String PROPERTY_IMAGEURL = "ImageURL"; + public static String PROPERTY_TITLE = "Title"; } diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java index 5e3ad00698df..d49f006a0ca8 100644 --- a/wizards/com/sun/star/wizards/common/UCB.java +++ b/wizards/com/sun/star/wizards/common/UCB.java @@ -169,7 +169,7 @@ public class UCB // Fill info for the properties wanted. aArg.Properties = new Property[] {new Property()}; - aArg.Properties[0].Name = "Title"; + aArg.Properties[0].Name = PropertyNames.PROPERTY_TITLE; aArg.Properties[0].Handle = -1; XDynamicResultSet xSet; diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 461a256ce1c3..038f00a58bd7 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -415,7 +415,7 @@ public class SQLQueryComposer XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oErrorDialog); XExecutableDialog xExecute = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oErrorDialog); PropertyValue[] rDispatchArguments = new PropertyValue[3]; - rDispatchArguments[0] = Properties.createProperty("Title", Configuration.getProductName(CurDBMetaData.xMSF) + " Base"); + rDispatchArguments[0] = Properties.createProperty(PropertyNames.PROPERTY_TITLE, Configuration.getProductName(CurDBMetaData.xMSF) + " Base"); rDispatchArguments[1] = Properties.createProperty("ParentWindow", _xParentWindow); rDispatchArguments[2] = Properties.createProperty("SQLException", _exception); xInitialize.initialize(rDispatchArguments); diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java index fc095af0d337..d85f5a1180d9 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java @@ -112,7 +112,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index f5478525eab1..8cbc0242b3ba 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -47,8 +47,8 @@ import com.sun.star.wizards.document.TimeStampControl; public class FormControlArranger { + public static final String LABELCONTROL = "LabelControl"; protected DatabaseControl[] DBControlList = null; - private XNameContainer xFormName; private XMultiServiceFactory xMSF; private Control[] LabelControlList = null; @@ -68,23 +68,23 @@ public class FormControlArranger private static final double CMAXREDUCTION = 0.7; private FormHandler oFormHandler; private int iReduceWidth; - private int nXTCPos; - private int nYTCPos; - private int nXDBPos; - private int nYDBPos; - private int nTCHeight; - private int nTCWidth; - private int nDBHeight; - private int nDBWidth; - private int nMaxTCWidth; + private int m_currentLabelPosX; + private int m_currentLabelPosY; + private int m_currentControlPosX; + private int m_currentControlPosY; + private int m_LabelHeight; + private int m_LabelWidth; + private int m_dbControlHeight; + private int m_dbControlWidth; + private int m_MaxLabelWidth; private int nFormWidth; private int nFormHeight; - private int nMaxRowY; + private int m_currentMaxRowHeight; private int nSecMaxRowY; private int nMaxColRightX; private int a; private int StartA; - private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form + private int m_controlMaxPosY = 0; //the maximum YPosition of a DBControl in the form private Short NBorderType = new Short((short) 1); //3-D Border public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize) @@ -102,14 +102,12 @@ public class FormControlArranger } // Note: on all Controls except for the checkbox the Label has to be set // a bit under the DBControl because its Height is also smaller + private int getLabelDiffHeight(int _index) { - if (curDBControl != null) + if (curDBControl != null && curDBControl.getControlType() == FormHandler.SOCHECKBOX) { - if (curDBControl.getControlType() == FormHandler.SOCHECKBOX) - { - return getCheckBoxDiffHeight(_index); - } + return getCheckBoxDiffHeight(_index); } return oFormHandler.getBasicLabelDiffHeight(); } @@ -126,12 +124,9 @@ public class FormControlArranger private int getCheckBoxDiffHeight(int LastIndex) { - if ((LastIndex < DBControlList.length)) + if (LastIndex < DBControlList.length && DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX) { - if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX) - { - return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2); - } + return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2); } return 0; } @@ -139,7 +134,7 @@ public class FormControlArranger private boolean isReducable(int _index) { boolean bisreducable = false; - int ntype = this.FieldColumns[_index].getFieldType(); + int ntype = FieldColumns[_index].getFieldType(); switch (ntype) { case DataType.TINYINT: @@ -178,7 +173,7 @@ public class FormControlArranger default: bisreducable = true; } - if (nTCWidth > 0.9 * CMAXREDUCTION * nDBWidth) + if (m_LabelWidth > 0.9 * CMAXREDUCTION * m_dbControlWidth) { bisreducable = false; } @@ -187,13 +182,13 @@ public class FormControlArranger private int getControlGroupWidth() { - if (nDBWidth > nTCWidth) + if (m_dbControlWidth > m_LabelWidth) { - return nDBWidth; + return m_dbControlWidth; } else { - return nTCWidth; + return m_LabelWidth; } } @@ -201,48 +196,40 @@ public class FormControlArranger { int nBaseWidth = nFormWidth + cXOffset; int nLeftDist = nMaxColRightX - nBaseWidth; - int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - this.cHoriDistance); + int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - cHoriDistance); if (nLeftDist < 0.5 * nRightDist) { // Fieldwidths in the line can be made smaller.. adjustLineWidth(StartA, a, nLeftDist, -1); - nYTCPos = nMaxRowY + cVertDistance; - nYDBPos = nYTCPos + nTCHeight; -// if ((nYDBPos + nDBHeight) > nMaxDBYPos) -// nMaxDBYPos = nYDBPos + nDBHeight; - nXTCPos = cXOffset; - nXDBPos = cXOffset; + m_currentLabelPosY = m_currentMaxRowHeight + cVertDistance; + m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; + m_currentLabelPosX = cXOffset; + m_currentControlPosX = cXOffset; bIsFirstRun = true; StartA = a + 1; } else { // FieldWidths in the line can be made wider... - if (nYDBPos + nDBHeight == nMaxRowY) + if (m_currentControlPosY + m_dbControlHeight == m_currentMaxRowHeight) { // The last Control was the highest in the row - nYTCPos = nSecMaxRowY + cVertDistance; + m_currentLabelPosY = nSecMaxRowY; } else { - nYTCPos = nMaxRowY + cVertDistance; + m_currentLabelPosY = m_currentMaxRowHeight; } - nYDBPos = nYTCPos + nTCHeight; - nXDBPos = cXOffset; - nXTCPos = cXOffset; - this.LabelControlList[a].setPosition(new Point(cXOffset, nYTCPos)); - this.DBControlList[a].setPosition(new Point(cXOffset, nYDBPos)); + m_currentLabelPosY += cVertDistance; + m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; + m_currentControlPosX = cXOffset; + m_currentLabelPosX = cXOffset; + LabelControlList[a].setPosition(new Point(cXOffset, m_currentLabelPosY)); + DBControlList[a].setPosition(new Point(cXOffset, m_currentControlPosY)); bIsFirstRun = true; - if (nDBWidth > nTCWidth) - { - checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true); - } - else - { - checkOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, true); - } - nXTCPos = nMaxColRightX + cHoriDistance; - nXDBPos = nXTCPos; + checkOuterPoints(m_currentControlPosX, m_dbControlWidth > m_LabelWidth ? m_dbControlWidth : m_LabelWidth, m_currentControlPosY, m_dbControlHeight, true); + m_currentLabelPosX = nMaxColRightX + cHoriDistance; + m_currentControlPosX = m_currentLabelPosX; adjustLineWidth(StartA, a - 1, nRightDist, 1); StartA = a; } @@ -278,42 +265,42 @@ public class FormControlArranger for (int i = StartIndex; i <= EndIndex; i++) { int nControlBaseWidth = 0; - curDBControl = this.DBControlList[i]; - Control curLabelControl = this.LabelControlList[i]; + curDBControl = DBControlList[i]; + Control curLabelControl = LabelControlList[i]; if (i != StartIndex) { curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y)); - curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + nTCHeight)); + curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight)); } - if (((curLabelControl.getSize().Width > curDBControl.getSize().Width)) && (WidthFactor > 0)) + final Size labelSize = curLabelControl.getSize(); + final Size controlSize = curDBControl.getSize(); + if (((labelSize.Width > controlSize.Width)) && (WidthFactor > 0)) { - nControlBaseWidth = curLabelControl.getSize().Width; + nControlBaseWidth = labelSize.Width; } else { - nControlBaseWidth = curDBControl.getSize().Width; + nControlBaseWidth = controlSize.Width; } if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) { TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl; nControlBaseWidth = oDBTimeStampControl.getSize().Width; - if (this.isReducable(i) || WidthFactor > 0) - { - oDBTimeStampControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, oDBTimeStampControl.getSize().Height)); - } } - else + if (isReducable(i) || WidthFactor > 0) { - if (this.isReducable(i) || WidthFactor > 0) - { - curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, curDBControl.getSize().Height)); - } + curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, controlSize.Height)); } - iLocTCPosX = curDBControl.getPosition().X + curDBControl.getSize().Width + cHoriDistance; - if (curLabelControl.getSize().Width > curDBControl.getSize().Width) + + if (labelSize.Width > controlSize.Width) { - iLocTCPosX = curLabelControl.getPosition().X + curLabelControl.getSize().Width + cHoriDistance; + iLocTCPosX = curLabelControl.getPosition().X + labelSize.Width; } + else + { + iLocTCPosX = curDBControl.getPosition().X + controlSize.Width; + } + iLocTCPosX += cHoriDistance; } if (WidthFactor > 0) { @@ -325,40 +312,36 @@ public class FormControlArranger } } - private void checkOuterPoints(int nXPos, int nWidth, int nYPos, int nHeight, boolean bIsDBField) + private void checkOuterPoints(int i_nXPos, int i_nWidth, int i_nYPos, int i_nHeight, boolean i_bIsDBField) { int nColRightX; - if (icurArrangement == FormWizard.SOTOPJUSTIFIED) + if (icurArrangement == FormWizard.IN_BLOCK_TOP && i_bIsDBField) { - if (bIsDBField) + // Only at DBControls you can measure the Value of nMaxRowY + if (bIsFirstRun) { - // Only at DBControls you can measure the Value of nMaxRowY - if (bIsFirstRun) - { - nMaxRowY = nYPos + nHeight; - nSecMaxRowY = nMaxRowY; - } - else + m_currentMaxRowHeight = i_nYPos + i_nHeight; + nSecMaxRowY = m_currentMaxRowHeight; + } + else + { + int nRowY = i_nYPos + i_nHeight; + if (nRowY >= m_currentMaxRowHeight) { - int nRowY = nYPos + nHeight; - if (nRowY >= nMaxRowY) - { - int nOldMaxRowY = nMaxRowY; - nSecMaxRowY = nOldMaxRowY; - nMaxRowY = nRowY; - } + nSecMaxRowY = m_currentMaxRowHeight; + m_currentMaxRowHeight = nRowY; } } } // Find the outer right point if (bIsFirstRun) { - nMaxColRightX = nXPos + nWidth; + nMaxColRightX = i_nXPos + i_nWidth; bIsFirstRun = false; } else { - nColRightX = nXPos + nWidth; + nColRightX = i_nXPos + i_nWidth; if (nColRightX > nMaxColRightX) { nMaxColRightX = nColRightX; @@ -370,15 +353,15 @@ public class FormControlArranger { try { - this.NBorderType = _NBorderType; - this.setStartPoint(_aStartPoint); + NBorderType = _NBorderType; + setStartPoint(_aStartPoint); icurArrangement = _icurArrangement; initializePosSizes(); initializeControlColumn(-1); bIsVeryFirstRun = true; - nMaxRowY = 0; + m_currentMaxRowHeight = 0; nSecMaxRowY = 0; - this.nMaxColRightX = 0; + nMaxColRightX = 0; xProgressBar.start("", FieldColumns.length); for (int i = 0; i < FieldColumns.length; i++) { @@ -387,13 +370,12 @@ public class FormControlArranger insertLabel(i, _iAlign); insertDBControl(i); bIsVeryFirstRun = false; - DBControlList[i].setPropertyValue("LabelControl", LabelControlList[i].xPropertySet); + DBControlList[i].setPropertyValue(LABELCONTROL, LabelControlList[i].xPropertySet); resetPosSizes(i); xProgressBar.setValue(i + 1); } catch (RuntimeException e) { - int dummy = 0; } } xProgressBar.end(); @@ -426,19 +408,19 @@ public class FormControlArranger private void resetPosSizes(int LastIndex) { - int nYRefPos = nYDBPos; + int nYRefPos = m_currentControlPosY; switch (icurArrangement) { - case FormWizard.SOCOLUMNARLEFT: - nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex); - nYRefPos = nYDBPos; - if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) + case FormWizard.COLUMNAR_LEFT: + m_currentControlPosY = m_currentControlPosY + m_dbControlHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex); + nYRefPos = m_currentControlPosY; + if ((m_currentControlPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) { repositionColumnarLeftControls(LastIndex); - nXTCPos = nMaxColRightX + 2 * cHoriDistance; - nXDBPos = nXTCPos + this.cLabelGap + nMaxTCWidth; - nYDBPos = cYOffset; - nYRefPos = nYDBPos; + m_currentLabelPosX = nMaxColRightX + 2 * cHoriDistance; + m_currentControlPosX = m_currentLabelPosX + cLabelGap + m_MaxLabelWidth; + m_currentControlPosY = cYOffset; + nYRefPos = m_currentControlPosY; initializeControlColumn(LastIndex); } else @@ -447,54 +429,54 @@ public class FormControlArranger /* a += 1;*/ ++a; } - nYTCPos = nYDBPos + this.getLabelDiffHeight(LastIndex); - if ((nYRefPos + nDBHeight) > nMaxDBYPos) + m_currentLabelPosY = m_currentControlPosY + getLabelDiffHeight(LastIndex); + if ((nYRefPos + m_dbControlHeight) > m_controlMaxPosY) { - nMaxDBYPos = nYRefPos + nDBHeight; + m_controlMaxPosY = nYRefPos + m_dbControlHeight; } break; - case FormWizard.SOCOLUMNARTOP: - nYTCPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex); - ; - if ((nYTCPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) + case FormWizard.COLUMNAR_TOP: + m_currentLabelPosY = m_currentControlPosY + m_dbControlHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex); + + if ((m_currentLabelPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) { - nXDBPos = nMaxColRightX + cHoriDistance; - nXTCPos = nXDBPos; - nYRefPos = nYDBPos; - nYDBPos = cYOffset + nTCHeight + cVertDistance; - nYTCPos = cYOffset; + m_currentControlPosX = nMaxColRightX + cHoriDistance; + m_currentLabelPosX = m_currentControlPosX; + nYRefPos = m_currentControlPosY; + m_currentControlPosY = cYOffset + m_LabelHeight + cVertDistance; + m_currentLabelPosY = cYOffset; initializeControlColumn(LastIndex); } else { - a = a + 1; + ++a; } - if ((nYRefPos + nDBHeight + cVertDistance) > nMaxDBYPos) + if ((nYRefPos + m_dbControlHeight + cVertDistance) > m_controlMaxPosY) { - nMaxDBYPos = nYRefPos + nDBHeight + cVertDistance; + m_controlMaxPosY = nYRefPos + m_dbControlHeight + cVertDistance; } break; - case FormWizard.SOTOPJUSTIFIED: - if (this.isReducable(a)) + case FormWizard.IN_BLOCK_TOP: + if (isReducable(a)) { iReduceWidth = iReduceWidth + 1; } if (nMaxColRightX > cXOffset + nFormWidth) { - int nOldYTCPos = nYTCPos; + int nOldYTCPos = m_currentLabelPosY; checkJustifiedPosition(a); - nYRefPos = nYDBPos; + nYRefPos = m_currentControlPosY; } else { - nXTCPos = nMaxColRightX + cHoriDistance; + m_currentLabelPosX = nMaxColRightX + cHoriDistance; } - a = a + 1; - if ((nYRefPos + nDBHeight) > nMaxDBYPos) + ++a; + if ((nYRefPos + m_dbControlHeight) > m_controlMaxPosY) { - nMaxDBYPos = nYRefPos + nDBHeight; + m_controlMaxPosY = nYRefPos + m_dbControlHeight; } break; } @@ -509,42 +491,41 @@ public class FormControlArranger { if (i == StartA) { - nXTCPos = LabelControlList[i].getPosition().X; - nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance; + m_currentLabelPosX = LabelControlList[i].getPosition().X; + m_currentControlPosX = m_currentLabelPosX + m_MaxLabelWidth + cHoriDistance; } - LabelControlList[i].setSize(new Size(nMaxTCWidth, nTCHeight)); - resetDBShape(DBControlList[i], nXDBPos); - checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true); + LabelControlList[i].setSize(new Size(m_MaxLabelWidth, m_LabelHeight)); + resetDBShape(DBControlList[i], m_currentControlPosX); + checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true); } } private void resetDBShape(Shape _curDBControl, int iXPos) { - int nYDBPos = _curDBControl.getPosition().Y; - nDBWidth = _curDBControl.getSize().Width; - nDBHeight = _curDBControl.getSize().Height; - _curDBControl.setPosition(new Point(iXPos, nYDBPos)); + m_dbControlWidth = _curDBControl.getSize().Width; + m_dbControlHeight = _curDBControl.getSize().Height; + _curDBControl.setPosition(new Point(iXPos, _curDBControl.getPosition().Y)); } private void initializePosSizes() { - this.nMaxDBYPos = 0; - nXTCPos = cXOffset; - nTCWidth = 2000; - nDBWidth = 2000; - nDBHeight = oFormHandler.getControlReferenceHeight(); - nTCHeight = oFormHandler.getLabelHeight(); + m_controlMaxPosY = 0; + m_currentLabelPosX = cXOffset; + m_LabelWidth = 2000; + m_dbControlWidth = 2000; + m_dbControlHeight = oFormHandler.getControlReferenceHeight(); + m_LabelHeight = oFormHandler.getLabelHeight(); iReduceWidth = 0; - if (icurArrangement == FormWizard.SOCOLUMNARLEFT) + if (icurArrangement == FormWizard.COLUMNAR_LEFT) { - nYTCPos = cYOffset + this.getLabelDiffHeight(0); - nXDBPos = cXOffset + 3050; - nYDBPos = cYOffset; + m_currentLabelPosY = cYOffset + getLabelDiffHeight(0); + m_currentControlPosX = cXOffset + 3050; + m_currentControlPosY = cYOffset; } else { - nXDBPos = cXOffset; - nYTCPos = cYOffset; + m_currentControlPosX = cXOffset; + m_currentLabelPosY = cYOffset; } } @@ -554,52 +535,54 @@ public class FormControlArranger { if (bControlsareCreated) { - LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos)); - if (icurArrangement != FormWizard.SOCOLUMNARLEFT) + LabelControlList[i].setPosition(new Point(m_currentLabelPosX, m_currentLabelPosY)); + if (icurArrangement != FormWizard.COLUMNAR_LEFT) { - nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle()); - LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight)); + m_LabelWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle()); + LabelControlList[i].setSize(new Size(m_LabelWidth, m_LabelHeight)); } else { - nTCWidth = LabelControlList[i].getSize().Width; + m_LabelWidth = LabelControlList[i].getSize().Width; } } else { - Point aPoint = new Point(nXTCPos, nYTCPos); - Size aSize = new Size(nTCWidth, nTCHeight); + Point aPoint = new Point(m_currentLabelPosX, m_currentLabelPosY); + Size aSize = new Size(m_LabelWidth, m_LabelHeight); final String sFieldName = FieldColumns[i].getFieldName(); - this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize); + LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize); + // LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos)); if (bIsVeryFirstRun) { - if (icurArrangement == FormWizard.SOCOLUMNARTOP) + if (icurArrangement == FormWizard.COLUMNAR_TOP) { - nYDBPos = nYTCPos + nTCHeight; + m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; } } String sTitle = FieldColumns[i].getFieldTitle(); - nTCWidth = LabelControlList[i].getPreferredWidth(sTitle); - } + m_LabelWidth = LabelControlList[i].getPreferredWidth(sTitle); + LabelControlList[i].setSize(new Size(m_LabelWidth, m_LabelHeight)); + } Control curLabelControl = LabelControlList[i]; - if (icurArrangement == FormWizard.SOCOLUMNARLEFT) + if (icurArrangement == FormWizard.COLUMNAR_LEFT) { // Note This If Sequence must be called before retrieving the outer Points if (bIsFirstRun) { - nMaxTCWidth = nTCWidth; + m_MaxLabelWidth = m_LabelWidth; bIsFirstRun = false; } - else if (nTCWidth > nMaxTCWidth) + else if (m_LabelWidth > m_MaxLabelWidth) { - nMaxTCWidth = nTCWidth; + m_MaxLabelWidth = m_LabelWidth; } } - checkOuterPoints(nXTCPos, nTCWidth, nYTCPos, nTCHeight, false); - if ((icurArrangement == FormWizard.SOCOLUMNARTOP) || (icurArrangement == FormWizard.SOTOPJUSTIFIED)) + checkOuterPoints(m_currentLabelPosX, m_LabelWidth, m_currentLabelPosY, m_LabelHeight, false); + if ((icurArrangement == FormWizard.COLUMNAR_TOP) || (icurArrangement == FormWizard.IN_BLOCK_TOP)) { - nXDBPos = nXTCPos; - nYDBPos = nYTCPos + nTCHeight; + m_currentControlPosX = m_currentLabelPosX; + m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) com.sun.star.awt.TextAlign.LEFT)); } else @@ -608,7 +591,7 @@ public class FormControlArranger } if (!bControlsareCreated) { - curLabelControl.setSize(new Size(nTCWidth, nTCHeight)); + curLabelControl.setSize(new Size(m_LabelWidth, m_LabelHeight)); } // if (CurHelpText != ""){ // oModel.HelpText = CurHelptext; @@ -627,7 +610,7 @@ public class FormControlArranger String sFieldName = FieldColumns[i].getFieldName(); int nFieldType = FieldColumns[i].getFieldType(); - Point aPoint = new Point(nXDBPos, nYDBPos); + Point aPoint = new Point(m_currentControlPosX, m_currentControlPosY); if (bControlsareCreated) { DBControlList[i].setPosition(aPoint); @@ -649,23 +632,24 @@ public class FormControlArranger } } DatabaseControl aDBControl = DBControlList[i]; - nDBHeight = aDBControl.getControlHeight(); - nDBWidth = aDBControl.getControlWidth(); + m_dbControlHeight = aDBControl.getControlHeight(); + m_dbControlWidth = aDBControl.getControlWidth(); if (nFieldType != DataType.TIMESTAMP) { - aDBControl.setSize(new Size(nDBWidth, nDBHeight)); + aDBControl.setSize(new Size(m_dbControlWidth, m_dbControlHeight)); } if (aDBControl.getControlType() == FormHandler.SOCHECKBOX) { - nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - nDBHeight) / 2); - aPoint = new Point(nXDBPos, nYDBPos); + m_currentControlPosY = m_currentControlPosY + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - m_dbControlHeight) / 2); + aPoint = new Point(m_currentControlPosX, m_currentControlPosY); aDBControl.setPosition(aPoint); } if (nFieldType == DataType.LONGVARCHAR) /* memo */ + { Helper.setUnoPropertyValue(LabelControlList[i], PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); } - checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true); + checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true); aDBControl.setPropertyValue("Border", NBorderType); } catch (Exception e) @@ -688,12 +672,12 @@ public class FormControlArranger public int getFormHeight() { - return nMaxDBYPos - this.cYOffset; + return m_controlMaxPosY - cYOffset; } public int getEntryPointY() { - if (this.icurArrangement == FormWizard.SOCOLUMNARTOP) + if (icurArrangement == FormWizard.COLUMNAR_TOP) { Control curLabelControl2 = LabelControlList[0]; return curLabelControl2.getPosition().Y; @@ -707,8 +691,8 @@ public class FormControlArranger public void setStartPoint(Point _aPoint) { - this.cXOffset = _aPoint.X; - this.cYOffset = _aPoint.Y; + cXOffset = _aPoint.X; + cYOffset = _aPoint.Y; } public void adjustYPositions(int _diffY) @@ -717,10 +701,10 @@ public class FormControlArranger { Point aPoint = DBControlList[i].getPosition(); DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); - aPoint = this.LabelControlList[i].getPosition(); + aPoint = LabelControlList[i].getPosition(); LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); } - nMaxDBYPos = -_diffY; + m_controlMaxPosY = -_diffY; cYOffset = -_diffY; } diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index ae1a795368e4..c31f907b5687 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -152,7 +152,7 @@ public class FormDocument extends TextDocument { if (oControlForms.size() == 0) { - final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID)); + final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.AS_GRID)); oControlForms.addElement(aMainControlForm); } else @@ -213,7 +213,7 @@ public class FormDocument extends TextDocument int nMainFormHeight = nFormHeight; if (bhasSubForm) { - if (_curArrangement == FormWizard.SOGRID) + if (_curArrangement == FormWizard.AS_GRID) { nMainFormHeight = (int) ((double) (nFormHeight - SOFORMGAP) / 2); } @@ -248,7 +248,7 @@ public class FormDocument extends TextDocument { ControlForm oMainControlForm = (ControlForm) oControlForms.get(0); oMainControlForm.setFormSize(getMainFormSize(oMainControlForm.curArrangement)); - if (oMainControlForm.curArrangement == FormWizard.SOGRID) + if (oMainControlForm.curArrangement == FormWizard.AS_GRID) { oMainControlForm.oGridControl.setSize(oMainControlForm.getFormSize()); } @@ -266,7 +266,7 @@ public class FormDocument extends TextDocument ControlForm oMainControlForm = (ControlForm) oControlForms.get(0); ControlForm oSubControlForm = (ControlForm) oControlForms.get(1); oSubControlForm.setFormSize(new Size(nFormWidth, (int) nFormHeight - oMainControlForm.getFormSize().Height)); - if (oSubControlForm.curArrangement == FormWizard.SOGRID) + if (oSubControlForm.curArrangement == FormWizard.AS_GRID) { Point aPoint = oSubControlForm.oGridControl.getPosition(); int idiffheight = oSubControlForm.getEntryPointY() - oMainControlForm.getActualFormHeight() - oMainControlForm.aStartPoint.Y - SOFORMGAP; @@ -404,13 +404,13 @@ public class FormDocument extends TextDocument } else { - if (curArrangement == FormWizard.SOGRID) + if (curArrangement == FormWizard.AS_GRID) { oFormHandler.moveShapesToNirwana(getLabelControls()); oFormHandler.moveShapesToNirwana(getDatabaseControls()); } } - if (curArrangement == FormWizard.SOGRID) + if (curArrangement == FormWizard.AS_GRID) { insertGridControl(_NBorderType); badaptControlStyles = true; @@ -483,7 +483,7 @@ public class FormDocument extends TextDocument private int getActualFormHeight() { - if (curArrangement == FormWizard.SOGRID) + if (curArrangement == FormWizard.AS_GRID) { return oGridControl.xShape.getSize().Height; } @@ -495,7 +495,7 @@ public class FormDocument extends TextDocument private int getEntryPointY() { - if (curArrangement == FormWizard.SOGRID) + if (curArrangement == FormWizard.AS_GRID) { return oGridControl.xShape.getPosition().Y; } @@ -549,10 +549,10 @@ public class FormDocument extends TextDocument { try { - curArrangement = FormWizard.SOGRID; + curArrangement = FormWizard.AS_GRID; if (Name.equals(SOMAINFORM)) { - oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.SOGRID)); + oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.AS_GRID)); } else { @@ -574,7 +574,7 @@ public class FormDocument extends TextDocument { for (int i = 0; i < getLabelControls().length; i++) { - if (curArrangement == FormWizard.SOGRID) + if (curArrangement == FormWizard.AS_GRID) { if ((oLabelControls[i] != null) && (oDBControls[i] != null)) { diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index f75f3e1b84ab..5c29b47c9e1a 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -66,23 +66,23 @@ public class FormWizard extends DatabaseObjectWizard public static final int SODATA_PAGE = 6; public static final int SOSTYLE_PAGE = 7; public static final int SOSTORE_PAGE = 8; - public static final int SOCOLUMNARLEFT = 1; - public static final int SOCOLUMNARTOP = 2; - public static final int SOGRID = 3; - public static final int SOTOPJUSTIFIED = 4; + public static final int COLUMNAR_LEFT = 1; + public static final int COLUMNAR_TOP = 2; + public static final int AS_GRID = 3; + public static final int IN_BLOCK_TOP = 4; private String slblTables; private boolean m_openForEditing; private boolean m_success = false; private String FormName; - public FormWizard( XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext ) + public FormWizard(XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext) { - super( i_servicFactory, 34400, i_wizardContext ); + super(i_servicFactory, 34400, i_wizardContext); super.addResourceHandler("FormWizard", "dbw"); Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -117,7 +117,7 @@ public class FormWizard extends DatabaseObjectWizard RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName); curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController); } - break; + break; case SOSUBFORMFIELDS_PAGE: { String sPreSelectedTableName = curFormConfiguration.getreferencedTableName(); @@ -133,14 +133,14 @@ public class FormWizard extends DatabaseObjectWizard curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly); } } - break; + break; case SOFIELDLINKER_PAGE: { final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames(); final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames(); curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames); } - break; + break; case SOCONTROL_PAGE: curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm()); break; @@ -153,7 +153,7 @@ public class FormWizard extends DatabaseObjectWizard String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName(); this.curFinalizer.initialize(sTableName, curFormDocument); } - break; + break; default: break; } @@ -186,9 +186,10 @@ public class FormWizard extends DatabaseObjectWizard curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1); } catch (java.lang.Exception e) - {} + { + } } - break; + break; case SOSUBFORM_PAGE: break; case SOSUBFORMFIELDS_PAGE: @@ -203,9 +204,10 @@ public class FormWizard extends DatabaseObjectWizard curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0); } catch (java.lang.Exception e) - {} + { + } } - break; + break; case SOFIELDLINKER_PAGE: curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames(); break; @@ -337,7 +339,7 @@ public class FormWizard extends DatabaseObjectWizard try { curFormDocument = new FormDocument(xMSF); - if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) ) + if (curFormDocument.oMainFormDBMetaData.getConnection(m_wizardContext)) { curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[] { @@ -345,16 +347,16 @@ public class FormWizard extends DatabaseObjectWizard }); curFormDocument.xProgressBar.setValue(20); buildSteps(); - this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false ); + this.curDBCommandFieldSelection.preselectCommand(m_wizardContext, false); XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer); - curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 ); + curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2); insertFormRelatedSteps(); short dialogReturn = executeDialog(curFormDocument.xFrame); xComponent.dispose(); - if ( ( dialogReturn == 0 ) && m_success ) + if ((dialogReturn == 0) && m_success) { - curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent ); - loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing ); + curFormDocument.oMainFormDBMetaData.addFormDocument(curFormDocument.xComponent); + loadSubComponent(DatabaseObject.FORM, FormName, m_openForEditing); } } } @@ -432,6 +434,7 @@ public class FormWizard extends DatabaseObjectWizard } } // @Override + public void moveItemDown(String item) { } @@ -475,8 +478,3 @@ public class FormWizard extends DatabaseObjectWizard } } } - - - - - diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 4ce88908228a..8ba87b457577 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -281,7 +281,7 @@ public class StyleApplier for (int m = 0; m < curFormDocument.oControlForms.size(); m++) { FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m)); - if (curControlForm.getArrangemode() == FormWizard.SOGRID) + if (curControlForm.getArrangemode() == FormWizard.AS_GRID) { GridControl oGridControl = curControlForm.getGridControl(); oGridControl.xPropertySet.setPropertyValue("Border", IBorderValue); @@ -439,7 +439,7 @@ public class StyleApplier for (int m = 0; m < curFormDocument.oControlForms.size(); m++) { FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m)); - if (curControlForm.getArrangemode() == FormWizard.SOGRID) + if (curControlForm.getArrangemode() == FormWizard.AS_GRID) { if (_iStyleColors[SOLABELTEXTCOLOR] > -1) { diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index d4cd1ccc7cb6..5a2fb0592e96 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -226,7 +226,7 @@ public class UIControlArranger for (int m = 0; m < curFormDocument.oControlForms.size(); m++) { FormDocument.ControlForm curControlForm = (FormDocument.ControlForm) curFormDocument.oControlForms.get(m); - if (curControlForm.getArrangemode() == FormWizard.SOCOLUMNARLEFT) + if (curControlForm.getArrangemode() == FormWizard.COLUMNAR_LEFT) { Control[] LabelControls = curControlForm.getLabelControls(); for (int n = 0; n < LabelControls.length; n++) @@ -421,7 +421,7 @@ public class UIControlArranger m_aButtonList.setListModel(model); m_aButtonList.create(CurUnoDialog); - m_aButtonList.setSelected(FormWizard.SOGRID - 1); + m_aButtonList.setSelected(FormWizard.AS_GRID - 1); m_aButtonList.addItemListener(this); } @@ -450,13 +450,13 @@ public class UIControlArranger final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1); - bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) || - (nSelected1 == FormWizard.SOCOLUMNARLEFT)); + bEnableAlignControlGroup = ((nSelected0 == FormWizard.COLUMNAR_LEFT) || + (nSelected1 == FormWizard.COLUMNAR_LEFT)); } else { final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); - bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT); + bEnableAlignControlGroup = (nSelected0 == FormWizard.COLUMNAR_LEFT); } enableAlignControlGroup(bEnableAlignControlGroup); final Short nBorderType = CurUnoDialog.getBorderType(); diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java index 619227d9f3ba..1c2a27e8ec2d 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java @@ -143,7 +143,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index bca4e1a6fa5f..11b9add2ea61 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -186,7 +186,7 @@ public class QueryWizard extends DatabaseObjectWizard resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88); Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 2081b655ae7e..a1b989b10404 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -119,7 +119,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 46fe77fbee38..b2c41bb2c1af 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -115,7 +115,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, - "Title", + PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index ebcb28ca48b1..3015e2ddec40 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -79,7 +79,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index b8cb2e81bf6d..35b8f10707fc 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -198,7 +198,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -573,7 +573,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID * I get a ucb content. * I list the files in this content. * I call the ucb "open" command. - * I get the "Title" property of this content. + * I get the PropertyNames.PROPERTY_TITLE property of this content. * @param acountUrl * @throws Exception */ @@ -592,7 +592,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID ucb.executeCommand(content, "open", aArg); //get the title property of the content. - Object obj = ucb.getContentProperty(content, "Title", String.class); + Object obj = ucb.getContentProperty(content, PropertyNames.PROPERTY_TITLE, String.class); } diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java index df4f4142f858..caf2a729d493 100644 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java @@ -133,7 +133,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java index c765e2410312..c26030f5e44b 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ b/wizards/com/sun/star/wizards/web/StatusDialog.java @@ -84,7 +84,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -245,7 +245,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener try { this.parent = parent_; - Helper.setUnoPropertyValue(this.xDialogModel, "Title", title); + Helper.setUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_TITLE, title); try { //TODO change this to another execute dialog method. diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java index e9d1d2fd7a87..34b278afd5e4 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java @@ -219,7 +219,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH + "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { -- cgit From f7937e2a3c25d98fa772b9dff63333878accad53 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Tue, 30 Nov 2010 13:30:09 +0100 Subject: dba34c: #i98239# alignment changed --- .../star/wizards/agenda/AgendaWizardDialog.java | 108 ++++++------ .../com/sun/star/wizards/agenda/TopicsControl.java | 12 +- .../com/sun/star/wizards/common/PropertyNames.java | 4 + .../com/sun/star/wizards/db/ColumnPropertySet.java | 2 +- .../com/sun/star/wizards/db/TableDescriptor.java | 2 +- wizards/com/sun/star/wizards/document/Control.java | 4 +- .../sun/star/wizards/document/DatabaseControl.java | 2 +- .../com/sun/star/wizards/fax/FaxWizardDialog.java | 116 ++++++------ .../com/sun/star/wizards/form/DataEntrySetter.java | 12 +- wizards/com/sun/star/wizards/form/FieldLinker.java | 12 +- wizards/com/sun/star/wizards/form/Finalizer.java | 10 +- .../sun/star/wizards/form/FormConfiguration.java | 12 +- .../sun/star/wizards/form/FormControlArranger.java | 91 +++++----- .../com/sun/star/wizards/form/FormDocument.java | 2 +- wizards/com/sun/star/wizards/form/FormWizard.java | 8 +- .../com/sun/star/wizards/form/StyleApplier.java | 22 +-- .../sun/star/wizards/form/UIControlArranger.java | 31 ++-- .../sun/star/wizards/letter/LetterDocument.java | 4 +- .../star/wizards/letter/LetterWizardDialog.java | 170 +++++++++--------- wizards/com/sun/star/wizards/query/Finalizer.java | 14 +- .../com/sun/star/wizards/query/QueryWizard.java | 4 +- .../com/sun/star/wizards/report/Dataimport.java | 12 +- .../sun/star/wizards/report/GroupFieldHandler.java | 2 +- .../sun/star/wizards/report/ReportFinalizer.java | 16 +- .../sun/star/wizards/report/ReportLayouter.java | 24 +-- .../com/sun/star/wizards/report/ReportWizard.java | 12 +- .../sun/star/wizards/table/FieldDescription.java | 2 +- .../com/sun/star/wizards/table/FieldFormatter.java | 20 +-- wizards/com/sun/star/wizards/table/Finalizer.java | 22 +-- .../sun/star/wizards/table/PrimaryKeyHandler.java | 24 +-- .../sun/star/wizards/table/ScenarioSelector.java | 12 +- .../com/sun/star/wizards/table/TableWizard.java | 4 +- .../sun/star/wizards/ui/AggregateComponent.java | 18 +- wizards/com/sun/star/wizards/ui/ButtonList.java | 6 +- .../sun/star/wizards/ui/CommandFieldSelection.java | 4 +- .../com/sun/star/wizards/ui/ControlScroller.java | 4 +- .../com/sun/star/wizards/ui/FieldSelection.java | 16 +- wizards/com/sun/star/wizards/ui/ImageList.java | 18 +- wizards/com/sun/star/wizards/ui/PathSelection.java | 6 +- .../com/sun/star/wizards/ui/SortingComponent.java | 10 +- .../com/sun/star/wizards/ui/TitlesComponent.java | 8 +- wizards/com/sun/star/wizards/ui/UIConsts.java | 16 +- wizards/com/sun/star/wizards/ui/UnoDialog.java | 2 +- wizards/com/sun/star/wizards/ui/UnoDialog2.java | 4 +- wizards/com/sun/star/wizards/ui/WizardDialog.java | 16 +- .../com/sun/star/wizards/ui/event/DataAware.java | 2 +- .../sun/star/wizards/ui/event/DataAwareFields.java | 2 +- .../sun/star/wizards/ui/event/RadioDataAware.java | 2 +- .../sun/star/wizards/ui/event/UnoDataAware.java | 4 +- wizards/com/sun/star/wizards/web/FTPDialog.java | 40 ++--- .../com/sun/star/wizards/web/ImageListDialog.java | 14 +- wizards/com/sun/star/wizards/web/StatusDialog.java | 12 +- .../com/sun/star/wizards/web/WebWizardDialog.java | 194 ++++++++++----------- .../wizards/web/export/ImpressHTMLExporter.java | 6 +- 54 files changed, 597 insertions(+), 599 deletions(-) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java index 0a6b82f4a9fb..ab600176080d 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java @@ -123,7 +123,7 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda private String[] PROPS_X = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; private String[] PROPS_TEXTAREA = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; private String[] PROPS_TEXT = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; - private String[] PROPS_IMAGE = new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; + private String[] PROPS_IMAGE = new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; private static final Short NO_BORDER = new Short((short)0); @@ -134,8 +134,8 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda //set dialog properties... Helper.setUnoPropertyValues(xDialogModel, - new String[] { "Closeable",PropertyNames.PROPERTY_HEIGHT,"Moveable",PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,PropertyNames.PROPERTY_TITLE,PropertyNames.PROPERTY_WIDTH}, - new Object[] { Boolean.TRUE,new Integer(210),Boolean.TRUE,new Integer(200),new Integer(52),INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,new Integer(310)} + new String[] { PropertyNames.PROPERTY_CLOSEABLE,PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_MOVEABLE,PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,PropertyNames.PROPERTY_TITLE,PropertyNames.PROPERTY_WIDTH}, + new Object[] { Boolean.TRUE,210,Boolean.TRUE,200,52,INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,310} ); //Set member- FontDescriptors... @@ -149,27 +149,27 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda public void buildStep1() { lblTitle1 = insertLabel("lblTitle1", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[1],new Short((short)100),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[1],new Short((short)100),212} ); lblPageDesign = insertLabel("lblPageDesign", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblPageDesign_value,new Integer(97),new Integer(32),INTEGERS[1],new Short((short)101),new Integer(66)} + new Object[] { INTEGERS[8],resources.reslblPageDesign_value,97,32,INTEGERS[1],new Short((short)101),66} ); listPageDesign = insertListBox("listPageDesign", null, null, PROPS_LIST, - new Object[] { Boolean.TRUE,INTEGER_12,LISTPAGEDESIGN_HID,new Integer(166),new Integer(30),INTEGERS[1],new Short((short)102),new Integer(70)} + new Object[] { Boolean.TRUE,INTEGER_12,LISTPAGEDESIGN_HID,166,30,INTEGERS[1],new Short((short)102),70} ); chkMinutes = insertCheckBox("chkMinutes", null, PROPS_CHECK, - new Object[] { INTEGERS[9],CHKMINUTES_HID,resources.reschkMinutes_value,new Integer(97),new Integer(50),new Short((short)0),INTEGERS[1],new Short((short)103),new Integer(203)} + new Object[] { INTEGERS[9],CHKMINUTES_HID,resources.reschkMinutes_value,97,50,new Short((short)0),INTEGERS[1],new Short((short)103),203} ); imgHelp1 = insertImage("imgHelp1", PROPS_IMAGE, - new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID, AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145), Boolean.FALSE, INTEGERS[1], new Short((short)104),INTEGERS[10]} + new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID, AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145, Boolean.FALSE, INTEGERS[1], new Short((short)104),INTEGERS[10]} ); lblHelp1 = insertLabel("lblHelp1", PROPS_TEXTAREA, - new Object[] { new Integer(39),resources.reslblHelp1_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[1],new Short((short)105),new Integer(199)} + new Object[] { 39,resources.reslblHelp1_value,Boolean.TRUE,104,145,INTEGERS[1],new Short((short)105),199} ); } @@ -177,49 +177,49 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda public void buildStep2() { lblTitle2 = insertLabel("lblTitle2", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[2],new Short((short)200),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[2],new Short((short)200),212} ); lblDate = insertLabel("lblDate", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblDate_value,new Integer(97),new Integer(32),INTEGERS[2],new Short((short)201),new Integer(66)} + new Object[] { INTEGERS[8],resources.reslblDate_value,97,32,INTEGERS[2],new Short((short)201),66} ); txtDate = insertDateField("txtDate", null, PROPS_LIST, - new Object[] { Boolean.TRUE,INTEGER_12,TXTDATE_HID,new Integer(166),new Integer(30),INTEGERS[2],new Short((short)202),new Integer(70)} + new Object[] { Boolean.TRUE,INTEGER_12,TXTDATE_HID,166,30,INTEGERS[2],new Short((short)202),70} ); lblTime = insertLabel("lblTime", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblTime_value,new Integer(97),new Integer(50),INTEGERS[2],new Short((short)203),new Integer(66)} + new Object[] { INTEGERS[8],resources.reslblTime_value,97,50,INTEGERS[2],new Short((short)203),66} ); txtTime = insertTimeField("txtTime", null, new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StrictFormat", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { INTEGER_12,TXTTIME_HID,new Integer(166),new Integer(48),INTEGERS[2],Boolean.TRUE,new Short((short)204),new Integer(70)} + new Object[] { INTEGER_12,TXTTIME_HID,166,48,INTEGERS[2],Boolean.TRUE,new Short((short)204),70} ); lblTitle = insertLabel("lblTitle", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblTitle_value,new Integer(97),new Integer(68),INTEGERS[2],new Short((short)205),new Integer(66)} + new Object[] { INTEGERS[8],resources.reslblTitle_value,97,68,INTEGERS[2],new Short((short)205),66} ); txtTitle = insertTextField("txtTitle", null, new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { new Integer(26),TXTTITLE_HID,Boolean.TRUE,new Integer(166),new Integer(66),INTEGERS[2],new Short((short)206),new Integer(138)} + new Object[] { 26,TXTTITLE_HID,Boolean.TRUE,166,66,INTEGERS[2],new Short((short)206),138} ); lblLocation = insertLabel("lblLocation", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblLocation_value,new Integer(97),new Integer(100),INTEGERS[2],new Short((short)207),new Integer(66)} + new Object[] { INTEGERS[8],resources.reslblLocation_value,97,100,INTEGERS[2],new Short((short)207),66} ); cbLocation = insertTextField("cbLocation", null,null, new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { new Integer(34),CBLOCATION_HID,Boolean.TRUE,new Integer(166),new Integer(98),INTEGERS[2],new Short((short)208),new Integer(138)} + new Object[] { 34,CBLOCATION_HID,Boolean.TRUE,166,98,INTEGERS[2],new Short((short)208),138} ); imgHelp2 = insertImage("imgHelp2", PROPS_IMAGE, - new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[2],new Short((short)209),INTEGERS[10]} + new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[2],new Short((short)209),INTEGERS[10]} ); lblHelp2 = insertLabel("lblHelp2", PROPS_TEXTAREA, - new Object[] { new Integer(39),resources.reslblHelp2_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[2],new Short((short)210),new Integer(199)} + new Object[] { 39,resources.reslblHelp2_value,Boolean.TRUE,104,145,INTEGERS[2],new Short((short)210),199} ); } @@ -227,93 +227,93 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda public void buildStep3() { lblTitle3 = insertLabel("lblTitle3", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[3],new Short((short)300),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[3],new Short((short)300),212} ); chkMeetingTitle = insertCheckBox("chkMeetingTitle", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKMEETINGTITLE_HID,resources.reschkMeetingTitle_value,new Integer(97),new Integer(32),new Short((short)1),INTEGERS[3],new Short((short)301),new Integer(69)} + new Object[] { INTEGERS[8],CHKMEETINGTITLE_HID,resources.reschkMeetingTitle_value,97,32,new Short((short)1),INTEGERS[3],new Short((short)301),69} ); chkRead = insertCheckBox("chkRead", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKREAD_HID,resources.reschkRead_value,new Integer(97),new Integer(46),new Short((short)0),INTEGERS[3],new Short((short)302),new Integer(162)} + new Object[] { INTEGERS[8],CHKREAD_HID,resources.reschkRead_value,97,46,new Short((short)0),INTEGERS[3],new Short((short)302),162} ); chkBring = insertCheckBox("chkBring", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKBRING_HID,resources.reschkBring_value,new Integer(97),new Integer(60),new Short((short)0),INTEGERS[3],new Short((short)303),new Integer(162)} + new Object[] { INTEGERS[8],CHKBRING_HID,resources.reschkBring_value,97,60,new Short((short)0),INTEGERS[3],new Short((short)303),162} ); chkNotes = insertCheckBox("chkNotes", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKNOTES_HID,resources.reschkNotes_value,new Integer(97),new Integer(74),new Short((short)1),INTEGERS[3],new Short((short)304),new Integer(160)} + new Object[] { INTEGERS[8],CHKNOTES_HID,resources.reschkNotes_value,97,74,new Short((short)1),INTEGERS[3],new Short((short)304),160} ); imgHelp3 = insertImage("imgHelp3", PROPS_IMAGE, - new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[3],new Short((short)305),INTEGERS[10]} + new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[3],new Short((short)305),INTEGERS[10]} ); lblHelp3 = insertLabel("lblHelp3", PROPS_TEXTAREA, - new Object[] { new Integer(39),resources.reslblHelp3_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[3],new Short((short)306),new Integer(199)} + new Object[] { 39,resources.reslblHelp3_value,Boolean.TRUE,104,145,INTEGERS[3],new Short((short)306),199} ); } public void buildStep4() { lblTitle5 = insertLabel("lblTitle5", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[4],new Short((short)400),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[4],new Short((short)400),212} ); chkConvenedBy = insertCheckBox("chkConvenedBy", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKCONVENEDBY_HID,resources.reschkConvenedBy_value,new Integer(97),new Integer(32),new Short((short)1),INTEGERS[4],new Short((short)401),new Integer(150)} + new Object[] { INTEGERS[8],CHKCONVENEDBY_HID,resources.reschkConvenedBy_value,97,32,new Short((short)1),INTEGERS[4],new Short((short)401),150} ); chkPresiding = insertCheckBox("chkPresiding", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKPRESIDING_HID,resources.reschkPresiding_value,new Integer(97),new Integer(46),new Short((short)0),INTEGERS[4],new Short((short)402),new Integer(150)} + new Object[] { INTEGERS[8],CHKPRESIDING_HID,resources.reschkPresiding_value,97,46,new Short((short)0),INTEGERS[4],new Short((short)402),150} ); chkNoteTaker = insertCheckBox("chkNoteTaker", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKNOTETAKER_HID,resources.reschkNoteTaker_value,new Integer(97),new Integer(60),new Short((short)0),INTEGERS[4],new Short((short)403),new Integer(150)} + new Object[] { INTEGERS[8],CHKNOTETAKER_HID,resources.reschkNoteTaker_value,97,60,new Short((short)0),INTEGERS[4],new Short((short)403),150} ); chkTimekeeper = insertCheckBox("chkTimekeeper", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKTIMEKEEPER_HID,resources.reschkTimekeeper_value,new Integer(97),new Integer(74),new Short((short)0),INTEGERS[4],new Short((short)404),new Integer(150)} + new Object[] { INTEGERS[8],CHKTIMEKEEPER_HID,resources.reschkTimekeeper_value,97,74,new Short((short)0),INTEGERS[4],new Short((short)404),150} ); chkAttendees = insertCheckBox("chkAttendees", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKATTENDEES_HID,resources.reschkAttendees_value,new Integer(97),new Integer(88),new Short((short)1),INTEGERS[4],new Short((short)405),new Integer(150)} + new Object[] { INTEGERS[8],CHKATTENDEES_HID,resources.reschkAttendees_value,97,88,new Short((short)1),INTEGERS[4],new Short((short)405),150} ); chkObservers = insertCheckBox("chkObservers", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKOBSERVERS_HID,resources.reschkObservers_value,new Integer(97),new Integer(102),new Short((short)0),INTEGERS[4],new Short((short)406),new Integer(150)} + new Object[] { INTEGERS[8],CHKOBSERVERS_HID,resources.reschkObservers_value,97,102,new Short((short)0),INTEGERS[4],new Short((short)406),150} ); chkResourcePersons = insertCheckBox("chkResourcePersons", null, PROPS_CHECK, - new Object[] { INTEGERS[8],CHKRESOURCEPERSONS_HID,resources.reschkResourcePersons_value,new Integer(97),new Integer(116),new Short((short)0),INTEGERS[4],new Short((short)407),new Integer(150)} + new Object[] { INTEGERS[8],CHKRESOURCEPERSONS_HID,resources.reschkResourcePersons_value,97,116,new Short((short)0),INTEGERS[4],new Short((short)407),150} ); imgHelp4 = insertImage("imgHelp4", PROPS_IMAGE, - new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[4],new Short((short)408),INTEGERS[10]} + new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[4],new Short((short)408),INTEGERS[10]} ); lblHelp4 = insertLabel("lblHelp4", PROPS_TEXTAREA, - new Object[] { new Integer(39),resources.reslblHelp4_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[4],new Short((short)409),new Integer(199)} + new Object[] { 39,resources.reslblHelp4_value,Boolean.TRUE,104,145,INTEGERS[4],new Short((short)409),199} ); } public void buildStep5() { lblTitle4 = insertLabel("lblTitle4", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[5],new Short((short)500),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[5],new Short((short)500),212} ); lblTopic = insertLabel("lblTopic", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblTopic_value,new Integer(107),new Integer(28),INTEGERS[5],new Short((short)71),new Integer(501)} + new Object[] { INTEGERS[8],resources.reslblTopic_value,107,28,INTEGERS[5],new Short((short)71),501} ); lblResponsible = insertLabel("lblResponsible", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblResponsible_value,new Integer(195),new Integer(28),INTEGERS[5],new Short((short)72),new Integer(502)} + new Object[] { INTEGERS[8],resources.reslblResponsible_value,195,28,INTEGERS[5],new Short((short)72),502} ); lblDuration = insertLabel("lblDuration", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblDuration_value,new Integer(267),new Integer(28),INTEGERS[5],new Short((short)73),new Integer(503)} + new Object[] { INTEGERS[8],resources.reslblDuration_value,267,28,INTEGERS[5],new Short((short)73),503} ); @@ -322,19 +322,19 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda btnInsert = insertButton("btnInsert", BTNINSERT_ACTION_PERFORMED, PROPS_BUTTON, - new Object[] { INTEGER_14,BTNINSERT_HID,resources.resButtonInsert,new Integer(92),new Integer(136),INTEGERS[5],new Short((short)580),INTEGER_40} + new Object[] { INTEGER_14,BTNINSERT_HID,resources.resButtonInsert,92,136,INTEGERS[5],new Short((short)580),INTEGER_40} ); btnRemove = insertButton("btnRemove", BTNREMOVE_ACTION_PERFORMED, PROPS_BUTTON, - new Object[] { INTEGER_14,BTNREMOVE_HID,resources.resButtonRemove,new Integer(134),new Integer(136),INTEGERS[5],new Short((short)581),INTEGER_40} + new Object[] { INTEGER_14,BTNREMOVE_HID,resources.resButtonRemove,134,136,INTEGERS[5],new Short((short)581),INTEGER_40} ); btnUp = insertButton("btnUp", BTNUP_ACTION_PERFORMED, PROPS_BUTTON, - new Object[] { INTEGER_14,BTNUP_HID,resources.resButtonUp,new Integer(222),new Integer(136),INTEGERS[5],new Short((short)582),INTEGER_40} + new Object[] { INTEGER_14,BTNUP_HID,resources.resButtonUp,222,136,INTEGERS[5],new Short((short)582),INTEGER_40} ); btnDown = insertButton("btnDown", BTNDOWN_ACTION_PERFORMED, PROPS_BUTTON, - new Object[] { INTEGER_14,BTNDOWN_HID,resources.resButtonDown,new Integer(264),new Integer(136),INTEGERS[5],new Short((short)583),INTEGER_40} + new Object[] { INTEGER_14,BTNDOWN_HID,resources.resButtonDown,264,136,INTEGERS[5],new Short((short)583),INTEGER_40} ); @@ -344,40 +344,40 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda lblTitle6 = insertLabel("lblTitle6", PROPS_LABEL_B, - new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[6],new Short((short)600),new Integer(212)} + new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[6],new Short((short)600),212} ); lblHelpPg6 = insertLabel("lblHelpPg6", PROPS_TEXTAREA, - new Object[] { new Integer(24),resources.reslblHelpPg6_value,Boolean.TRUE,new Integer(97),new Integer(32),INTEGERS[6],new Short((short)601),new Integer(204)} + new Object[] { 24,resources.reslblHelpPg6_value,Boolean.TRUE,97,32,INTEGERS[6],new Short((short)601),204} ); lblTemplateName = insertLabel("lblTemplateName", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblTemplateName_value,new Integer(97),new Integer(62),INTEGERS[6],new Short((short)602),new Integer(101)} + new Object[] { INTEGERS[8],resources.reslblTemplateName_value,97,62,INTEGERS[6],new Short((short)602),101} ); txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED, PROPS_X, - new Object[] { INTEGER_12,TXTTEMPLATENAME_HID,new Integer(202),new Integer(60),INTEGERS[6],new Short((short)603),new Integer(100)} + new Object[] { INTEGER_12,TXTTEMPLATENAME_HID,202,60,INTEGERS[6],new Short((short)603),100} ); lblProceed = insertLabel("lblProceed", PROPS_TEXT, - new Object[] { INTEGERS[8],resources.reslblProceed_value,new Integer(97),new Integer(101),INTEGERS[6],new Short((short)607),new Integer(204)} + new Object[] { INTEGERS[8],resources.reslblProceed_value,97,101,INTEGERS[6],new Short((short)607),204} ); optCreateAgenda = insertRadioButton("optCreateAgenda", null, PROPS_CHECK, - new Object[] { INTEGERS[8],OPTCREATEAGENDA_HID,resources.resoptCreateAgenda_value,new Integer(103),new Integer(113),new Short((short)1),INTEGERS[6],new Short((short)608),new Integer(198)} + new Object[] { INTEGERS[8],OPTCREATEAGENDA_HID,resources.resoptCreateAgenda_value,103,113,new Short((short)1),INTEGERS[6],new Short((short)608),198} ); optMakeChanges = insertRadioButton("optMakeChanges", null, PROPS_BUTTON, - new Object[] { INTEGERS[8],OPTMAKECHANGES_HID,resources.resoptMakeChanges_value,new Integer(103),new Integer(125),INTEGERS[6],new Short((short)609),new Integer(198)} + new Object[] { INTEGERS[8],OPTMAKECHANGES_HID,resources.resoptMakeChanges_value,103,125,INTEGERS[6],new Short((short)609),198} ); imgHelp6 = insertImage("imgHelp6", PROPS_IMAGE, - new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[6],new Short((short)610),INTEGERS[10]} + new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,145,Boolean.FALSE, INTEGERS[6],new Short((short)610),INTEGERS[10]} ); lblHelp6 = insertLabel("lblHelp6", PROPS_TEXTAREA, - new Object[] { new Integer(39),resources.reslblHelp6_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[6],new Short((short)611),new Integer(199)} + new Object[] { 39,resources.reslblHelp6_value,Boolean.TRUE,104,145,INTEGERS[6],new Short((short)611),199} ); } diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java index 0e3678139378..25f0cf9103a0 100644 --- a/wizards/com/sun/star/wizards/agenda/TopicsControl.java +++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java @@ -1038,11 +1038,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener /** * A static member used for the child-class ControlRow (GUI Constant) */ - private static Integer I_12 = new Integer(12); + private static Integer I_12 = 12; /** * A static member used for the child-class ControlRow (GUI Constant) */ - private static Integer I_8 = new Integer(8); + private static Integer I_8 = 8; /** * A static member used for the child-class ControlRow (GUI Constant) */ @@ -1173,28 +1173,28 @@ public class TopicsControl extends ControlScroller implements XFocusListener LABEL_PROPS, new Object[] { - I_8, "" + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), new Integer(10) + I_8, "" + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), 10 }); textbox = dialog.insertTextField(TOPIC + i, "topicTextChanged", this, TEXT_PROPS, new Object[] { - I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 1), new Integer(x + 15), y_, IStep, new Short((short) (tabindex + 1)), new Integer(84) + I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 1), new Integer(x + 15), y_, IStep, new Short((short) (tabindex + 1)), 84 }); combobox = dialog.insertTextField(RESP + i, "responsibleTextChanged", this, TEXT_PROPS, new Object[] { - I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 2), new Integer(x + 103), y_, IStep, new Short((short) (tabindex + 2)), new Integer(68) + I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 2), new Integer(x + 103), y_, IStep, new Short((short) (tabindex + 2)), 68 }); timebox = dialog.insertTextField(TIME + i, "timeTextChanged", this, TEXT_PROPS, new Object[] { - I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 3), new Integer(x + 175), y_, IStep, new Short((short) (tabindex + 3)), new Integer(20) + I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 3), new Integer(x + 175), y_, IStep, new Short((short) (tabindex + 3)), 20 }); setEnabled(false); diff --git a/wizards/com/sun/star/wizards/common/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java index ff0e0717895d..4361b2757773 100644 --- a/wizards/com/sun/star/wizards/common/PropertyNames.java +++ b/wizards/com/sun/star/wizards/common/PropertyNames.java @@ -47,4 +47,8 @@ public class PropertyNames public static String PROPERTY_STATE = "State"; public static String PROPERTY_IMAGEURL = "ImageURL"; public static String PROPERTY_TITLE = "Title"; + public static String PROPERTY_BORDER = "Border"; + public static String PROPERTY_MOVEABLE = "Moveable"; + public static String PROPERTY_CLOSEABLE = "Closeable"; + public static String PROPERTY_ALIGN = "Align"; } diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java index a3ff8c12b712..db5ceb257118 100644 --- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java +++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java @@ -80,7 +80,7 @@ public class ColumnPropertySet } if ((nType == DataType.VARCHAR) && (precision == null || precision.intValue() == 0)) { - precision = new Integer(50); + precision = 50; } if (precision != null) { diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index c7f728648467..0330e518b774 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -257,7 +257,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen XPropertySet xColPropertySet = getByIndex(i); if (!isColunnNameDuplicate(xNameAccessColumns, xColPropertySet)) { - xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", new Integer(32423)) + xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", 32423) } else { diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index 96485cdf84ce..b5ec0ec4ff63 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -314,13 +314,13 @@ public class Control extends Shape } else if (getControlType() == FormHandler.SODATECONTROL) { - xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date + xPropertySet.setPropertyValue("Date", 4711); //TODO find a better date aPreferredSize = getPeer().getPreferredSize(); xPropertySet.setPropertyValue("Date", com.sun.star.uno.Any.VOID); } else if (getControlType() == FormHandler.SOTIMECONTROL) { - xPropertySet.setPropertyValue("Time", new Integer(47114)); //TODO find a better time + xPropertySet.setPropertyValue("Time", 47114); //TODO find a better time aPreferredSize = getPeer().getPreferredSize(); xPropertySet.setPropertyValue("Time", com.sun.star.uno.Any.VOID); } diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index 67a85c436f6f..e26449bc4632 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -93,7 +93,7 @@ public class DatabaseControl extends Control xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden)); xPropColumn.setPropertyValue("DataField", sFieldName); xPropColumn.setPropertyValue(PropertyNames.PROPERTY_LABEL, _columntitle); - xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, new Integer(0)); // Width of column is adjusted to Columname + xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, 0); // Width of column is adjusted to Columname XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo(); if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) ) diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java index d85f5a1180d9..b249bdd76035 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java @@ -112,11 +112,11 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.TRUE, new Integer(210), Boolean.TRUE, new Integer(104), new Integer(52), INTEGERS[1], new Short((short) 1), resources.resFaxWizardDialog_title, new Integer(310) + Boolean.TRUE, 210, Boolean.TRUE, 104, 52, INTEGERS[1], new Short((short) 1), resources.resFaxWizardDialog_title, 310 }); @@ -138,7 +138,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTBUSINESSFAX_HID, resources.resoptBusinessFax_value, new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184) + INTEGERS[8], OPTBUSINESSFAX_HID, resources.resoptBusinessFax_value, 97, 28, INTEGERS[1], new Short((short) 1), 184 }); lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED, new String[] @@ -147,7 +147,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - Boolean.TRUE, INTEGER_12, LSTBUSINESSSTYLE_HID, new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 3), new Integer(74) + Boolean.TRUE, INTEGER_12, LSTBUSINESSSTYLE_HID, 180, INTEGER_40, INTEGERS[1], new Short((short) 3), 74 }); optPrivateFax = insertRadioButton("optPrivateFax", OPTPRIVATEFAX_ITEM_CHANGED, new String[] @@ -156,7 +156,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTPRIVATEFAX_HID, resources.resoptPrivateFax_value, new Integer(97), new Integer(81), INTEGERS[1], new Short((short) 2), new Integer(184) + INTEGERS[8], OPTPRIVATEFAX_HID, resources.resoptPrivateFax_value, 97, 81, INTEGERS[1], new Short((short) 2), 184 }); lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED, new String[] @@ -165,7 +165,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - Boolean.TRUE, INTEGER_12, LSTPRIVATESTYLE_HID, new Integer(180), new Integer(95), INTEGERS[1], new Short((short) 4), new Integer(74) + Boolean.TRUE, INTEGER_12, LSTPRIVATESTYLE_HID, 180, 95, INTEGERS[1], new Short((short) 4), 74 }); lblBusinessStyle = insertLabel("lblBusinessStyle", new String[] @@ -174,7 +174,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblBusinessStyle_value, new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 32), new Integer(60) + INTEGERS[8], resources.reslblBusinessStyle_value, 110, 42, INTEGERS[1], new Short((short) 32), 60 }); lblTitle1 = insertLabel("lblTitle1", new String[] @@ -183,7 +183,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor5, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[1], new Short((short) 37), new Integer(212) + fontDescriptor5, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[1], new Short((short) 37), 212 }); lblPrivateStyle = insertLabel("lblPrivateStyle", new String[] @@ -192,7 +192,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblPrivateStyle_value, new Integer(110), new Integer(95), INTEGERS[1], new Short((short) 50), new Integer(60) + INTEGERS[8], resources.reslblPrivateStyle_value, 110, 95, INTEGERS[1], new Short((short) 50), 60 }); lblIntroduction = insertLabel("lblIntroduction", new String[] @@ -201,12 +201,12 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - new Integer(39), resources.reslblIntroduction_value, Boolean.TRUE, new Integer(104), new Integer(145), INTEGERS[1], new Short((short) 55), new Integer(199) + 39, resources.reslblIntroduction_value, Boolean.TRUE, 104, 145, INTEGERS[1], new Short((short) 55), 199 }); ImageControl3 = insertInfoImage(92, 145, 1); // ImageControl3 = insertImage("ImageControl3", -// new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, -// new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[1],new Short((short)56),INTEGERS[10]} +// new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, +// new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205",92,145,Boolean.FALSE,INTEGERS[1],new Short((short)56),INTEGERS[10]} // ); } @@ -219,7 +219,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSELOGO_HID, resources.reschkUseLogo_value, new Integer(97), new Integer(28), new Short((short) 0), INTEGERS[2], new Short((short) 5), new Integer(212) + INTEGERS[8], CHKUSELOGO_HID, resources.reschkUseLogo_value, 97, 28, new Short((short) 0), INTEGERS[2], new Short((short) 5), 212 }); chkUseDate = insertCheckBox("chkUseDate", CHKUSEDATE_ITEM_CHANGED, new String[] @@ -228,7 +228,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSEDATE_HID, resources.reschkUseDate_value, new Integer(97), new Integer(43), new Short((short) 0), INTEGERS[2], new Short((short) 6), new Integer(212) + INTEGERS[8], CHKUSEDATE_HID, resources.reschkUseDate_value, 97, 43, new Short((short) 0), INTEGERS[2], new Short((short) 6), 212 }); chkUseCommunicationType = insertCheckBox("chkUseCommunicationType", CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED, new String[] @@ -237,7 +237,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSECOMMUNICATIONTYPE_HID, resources.reschkUseCommunicationType_value, new Integer(97), new Integer(57), new Short((short) 0), INTEGERS[2], new Short((short) 7), new Integer(100) + INTEGERS[8], CHKUSECOMMUNICATIONTYPE_HID, resources.reschkUseCommunicationType_value, 97, 57, new Short((short) 0), INTEGERS[2], new Short((short) 7), 100 }); lstCommunicationType = insertComboBox("lstCommunicationType", LSTCOMMUNICATIONTYPE_ACTION_PERFORMED, LSTCOMMUNICATIONTYPE_ITEM_CHANGED, LSTCOMMUNICATIONTYPE_TEXT_CHANGED, new String[] @@ -246,7 +246,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - Boolean.TRUE, INTEGER_12, LSTCOMMUNICATIONTYPE_HID, new Integer(105), new Integer(68), INTEGERS[2], new Short((short) 8), new Integer(174) + Boolean.TRUE, INTEGER_12, LSTCOMMUNICATIONTYPE_HID, 105, 68, INTEGERS[2], new Short((short) 8), 174 }); chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED, new String[] @@ -255,7 +255,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSESUBJECT_HID, resources.reschkUseSubject_value, new Integer(97), new Integer(87), new Short((short) 0), INTEGERS[2], new Short((short) 9), new Integer(212) + INTEGERS[8], CHKUSESUBJECT_HID, resources.reschkUseSubject_value, 97, 87, new Short((short) 0), INTEGERS[2], new Short((short) 9), 212 }); chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED, new String[] @@ -264,7 +264,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSESALUTATION_HID, resources.reschkUseSalutation_value, new Integer(97), new Integer(102), new Short((short) 0), INTEGERS[2], new Short((short) 10), new Integer(100) + INTEGERS[8], CHKUSESALUTATION_HID, resources.reschkUseSalutation_value, 97, 102, new Short((short) 0), INTEGERS[2], new Short((short) 10), 100 }); lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED, new String[] @@ -273,7 +273,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - Boolean.TRUE, INTEGER_12, LSTSALUTATION_HID, new Integer(105), new Integer(113), INTEGERS[2], new Short((short) 11), new Integer(174) + Boolean.TRUE, INTEGER_12, LSTSALUTATION_HID, 105, 113, INTEGERS[2], new Short((short) 11), 174 }); chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED, new String[] @@ -282,7 +282,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSEGREETING_HID, resources.reschkUseGreeting_value, new Integer(97), new Integer(132), new Short((short) 0), INTEGERS[2], new Short((short) 12), new Integer(100) + INTEGERS[8], CHKUSEGREETING_HID, resources.reschkUseGreeting_value, 97, 132, new Short((short) 0), INTEGERS[2], new Short((short) 12), 100 }); lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED, new String[] @@ -291,7 +291,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - Boolean.TRUE, INTEGER_12, LSTGREETING_HID, new Integer(105), new Integer(143), INTEGERS[2], new Short((short) 13), new Integer(174) + Boolean.TRUE, INTEGER_12, LSTGREETING_HID, 105, 143, INTEGERS[2], new Short((short) 13), 174 }); chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED, new String[] @@ -300,7 +300,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKUSEFOOTER_HID, resources.reschkUseFooter_value, new Integer(97), new Integer(163), new Short((short) 0), INTEGERS[2], new Short((short) 14), new Integer(212) + INTEGERS[8], CHKUSEFOOTER_HID, resources.reschkUseFooter_value, 97, 163, new Short((short) 0), INTEGERS[2], new Short((short) 14), 212 }); lblTitle3 = insertLabel("lblTitle3", new String[] @@ -309,7 +309,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor5, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[2], new Short((short) 59), new Integer(212) + fontDescriptor5, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[2], new Short((short) 59), 212 }); } @@ -322,7 +322,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTSENDERPLACEHOLDER_HID, resources.resoptSenderPlaceholder_value, new Integer(104), new Integer(42), INTEGERS[3], new Short((short) 15), new Integer(149) + INTEGERS[8], OPTSENDERPLACEHOLDER_HID, resources.resoptSenderPlaceholder_value, 104, 42, INTEGERS[3], new Short((short) 15), 149 }); optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED, new String[] @@ -331,7 +331,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTSENDERDEFINE_HID, resources.resoptSenderDefine_value, new Integer(104), new Integer(54), INTEGERS[3], new Short((short) 16), new Integer(149) + INTEGERS[8], OPTSENDERDEFINE_HID, resources.resoptSenderDefine_value, 104, 54, INTEGERS[3], new Short((short) 16), 149 }); txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED, new String[] @@ -340,7 +340,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERNAME_HID, new Integer(182), new Integer(67), INTEGERS[3], new Short((short) 17), new Integer(119) + INTEGER_12, TXTSENDERNAME_HID, 182, 67, INTEGERS[3], new Short((short) 17), 119 }); txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED, new String[] @@ -349,7 +349,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERSTREET_HID, new Integer(182), new Integer(81), INTEGERS[3], new Short((short) 18), new Integer(119) + INTEGER_12, TXTSENDERSTREET_HID, 182, 81, INTEGERS[3], new Short((short) 18), 119 }); txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED, new String[] @@ -358,7 +358,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERPOSTCODE_HID, new Integer(182), new Integer(95), INTEGERS[3], new Short((short) 19), new Integer(25) + INTEGER_12, TXTSENDERPOSTCODE_HID, 182, 95, INTEGERS[3], new Short((short) 19), 25 }); txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED, new String[] @@ -367,7 +367,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERSTATE_HID, new Integer(211), new Integer(95), INTEGERS[3], new Short((short) 20), new Integer(21) + INTEGER_12, TXTSENDERSTATE_HID, 211, 95, INTEGERS[3], new Short((short) 20), 21 }); txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED, new String[] @@ -376,7 +376,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERCITY_HID, new Integer(236), new Integer(95), INTEGERS[3], new Short((short) 21), new Integer(65) + INTEGER_12, TXTSENDERCITY_HID, 236, 95, INTEGERS[3], new Short((short) 21), 65 }); txtSenderFax = insertTextField("txtSenderFax", TXTSENDERFAX_TEXT_CHANGED, new String[] @@ -385,7 +385,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTSENDERFAX_HID, new Integer(182), new Integer(109), INTEGERS[3], new Short((short) 22), new Integer(119) + INTEGER_12, TXTSENDERFAX_HID, 182, 109, INTEGERS[3], new Short((short) 22), 119 }); optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED, new String[] @@ -394,7 +394,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTRECEIVERPLACEHOLDER_HID, resources.resoptReceiverPlaceholder_value, new Integer(104), new Integer(148), INTEGERS[3], new Short((short) 23), new Integer(200) + INTEGERS[8], OPTRECEIVERPLACEHOLDER_HID, resources.resoptReceiverPlaceholder_value, 104, 148, INTEGERS[3], new Short((short) 23), 200 }); optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED, new String[] @@ -403,7 +403,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTRECEIVERDATABASE_HID, resources.resoptReceiverDatabase_value, new Integer(104), new Integer(160), INTEGERS[3], new Short((short) 24), new Integer(200) + INTEGERS[8], OPTRECEIVERDATABASE_HID, resources.resoptReceiverDatabase_value, 104, 160, INTEGERS[3], new Short((short) 24), 200 }); lblSenderAddress = insertLabel("lblSenderAddress", new String[] @@ -412,7 +412,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblSenderAddress_value, new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 46), new Integer(136) + INTEGERS[8], resources.reslblSenderAddress_value, 97, 28, INTEGERS[3], new Short((short) 46), 136 }); FixedLine2 = insertFixedLine("FixedLine2", new String[] @@ -421,7 +421,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[5], new Integer(90), new Integer(126), INTEGERS[3], new Short((short) 51), new Integer(212) + INTEGERS[5], 90, 126, INTEGERS[3], new Short((short) 51), 212 }); lblSenderName = insertLabel("lblSenderName", new String[] @@ -430,7 +430,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblSenderName_value, new Integer(113), new Integer(69), INTEGERS[3], new Short((short) 52), new Integer(68) + INTEGERS[8], resources.reslblSenderName_value, 113, 69, INTEGERS[3], new Short((short) 52), 68 }); lblSenderStreet = insertLabel("lblSenderStreet", new String[] @@ -439,7 +439,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblSenderStreet_value, new Integer(113), new Integer(82), INTEGERS[3], new Short((short) 53), new Integer(68) + INTEGERS[8], resources.reslblSenderStreet_value, 113, 82, INTEGERS[3], new Short((short) 53), 68 }); lblPostCodeCity = insertLabel("lblPostCodeCity", new String[] @@ -448,7 +448,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblPostCodeCity_value, new Integer(113), new Integer(97), INTEGERS[3], new Short((short) 54), new Integer(68) + INTEGERS[8], resources.reslblPostCodeCity_value, 113, 97, INTEGERS[3], new Short((short) 54), 68 }); lblTitle4 = insertLabel("lblTitle4", new String[] @@ -457,7 +457,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor5, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 60), new Integer(212) + fontDescriptor5, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[3], new Short((short) 60), 212 }); Label1 = insertLabel("lblSenderFax", new String[] @@ -466,7 +466,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.resLabel1_value, new Integer(113), new Integer(111), INTEGERS[3], new Short((short) 68), new Integer(68) + INTEGERS[8], resources.resLabel1_value, 113, 111, INTEGERS[3], new Short((short) 68), 68 }); Label2 = insertLabel("Label2", new String[] @@ -475,7 +475,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.resLabel2_value, new Integer(97), new Integer(137), INTEGERS[3], new Short((short) 69), new Integer(136) + INTEGERS[8], resources.resLabel2_value, 97, 137, INTEGERS[3], new Short((short) 69), 136 }); } @@ -488,7 +488,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - new Integer(47), TXTFOOTER_HID, Boolean.TRUE, new Integer(97), INTEGER_40, INTEGERS[4], new Short((short) 25), new Integer(203) + 47, TXTFOOTER_HID, Boolean.TRUE, 97, INTEGER_40, INTEGERS[4], new Short((short) 25), 203 }); chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED, new String[] @@ -497,7 +497,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKFOOTERNEXTPAGES_HID, resources.reschkFooterNextPages_value, new Integer(97), new Integer(92), new Short((short) 0), INTEGERS[4], new Short((short) 26), new Integer(202) + INTEGERS[8], CHKFOOTERNEXTPAGES_HID, resources.reschkFooterNextPages_value, 97, 92, new Short((short) 0), INTEGERS[4], new Short((short) 26), 202 }); chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED, new String[] @@ -506,7 +506,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], CHKFOOTERPAGENUMBERS_HID, resources.reschkFooterPageNumbers_value, new Integer(97), new Integer(106), new Short((short) 0), INTEGERS[4], new Short((short) 27), new Integer(201) + INTEGERS[8], CHKFOOTERPAGENUMBERS_HID, resources.reschkFooterPageNumbers_value, 97, 106, new Short((short) 0), INTEGERS[4], new Short((short) 27), 201 }); lblFooter = insertLabel("lblFooter", new String[] @@ -515,7 +515,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor4, INTEGERS[8], resources.reslblFooter_value, new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 33), new Integer(116) + fontDescriptor4, INTEGERS[8], resources.reslblFooter_value, 97, 28, INTEGERS[4], new Short((short) 33), 116 }); lblTitle5 = insertLabel("lblTitle5", new String[] @@ -524,7 +524,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor5, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 61), new Integer(212) + fontDescriptor5, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[4], new Short((short) 61), 212 }); } @@ -537,12 +537,12 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGER_12, TXTTEMPLATENAME_HID, new Integer(202), new Integer(56), INTEGERS[5], new Short((short) 28), resources.restxtTemplateName_value, new Integer(100) + INTEGER_12, TXTTEMPLATENAME_HID, 202, 56, INTEGERS[5], new Short((short) 28), resources.restxtTemplateName_value, 100 }); /* fileTemplatePath = insertFileControl("fileTemplatePath", FILETEMPLATEPATH_TEXT_CHANGED, new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,new Integer(172),new Integer(74),INTEGERS[5],new Short((short)29),new Integer(130)} + new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,172,74,INTEGERS[5],new Short((short)29),130} ); */ optCreateFax = insertRadioButton("optCreateFax", OPTCREATEFAX_ITEM_CHANGED, @@ -552,7 +552,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTCREATEFAX_HID, resources.resoptCreateFax_value, new Integer(104), new Integer(111), INTEGERS[5], new Short((short) 30), new Integer(198) + INTEGERS[8], OPTCREATEFAX_HID, resources.resoptCreateFax_value, 104, 111, INTEGERS[5], new Short((short) 30), 198 }); optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED, new String[] @@ -561,7 +561,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], OPTMAKECHANGES_HID, resources.resoptMakeChanges_value, new Integer(104), new Integer(123), INTEGERS[5], new Short((short) 31), new Integer(198) + INTEGERS[8], OPTMAKECHANGES_HID, resources.resoptMakeChanges_value, 104, 123, INTEGERS[5], new Short((short) 31), 198 }); lblFinalExplanation1 = insertLabel("lblFinalExplanation1", new String[] @@ -570,7 +570,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - new Integer(28), resources.reslblFinalExplanation1_value, Boolean.TRUE, new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 34), new Integer(205) + 28, resources.reslblFinalExplanation1_value, Boolean.TRUE, 97, 28, INTEGERS[5], new Short((short) 34), 205 }); lblProceed = insertLabel("lblProceed", new String[] @@ -579,7 +579,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblProceed_value, new Integer(97), new Integer(100), INTEGERS[5], new Short((short) 35), new Integer(204) + INTEGERS[8], resources.reslblProceed_value, 97, 100, INTEGERS[5], new Short((short) 35), 204 }); lblFinalExplanation2 = insertLabel("lblFinalExplanation2", new String[] @@ -588,16 +588,16 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - new Integer(33), resources.reslblFinalExplanation2_value, Boolean.TRUE, new Integer(104), new Integer(145), INTEGERS[5], new Short((short) 36), new Integer(199) + 33, resources.reslblFinalExplanation2_value, Boolean.TRUE, 104, 145, INTEGERS[5], new Short((short) 36), 199 }); ImageControl2 = insertImage("ImageControl2", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", new Integer(92), new Integer(145), Boolean.FALSE, INTEGERS[5], new Short((short) 47), INTEGERS[10] + new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", 92, 145, Boolean.FALSE, INTEGERS[5], new Short((short) 47), INTEGERS[10] }); lblTemplateName = insertLabel("lblTemplateName", new String[] @@ -606,12 +606,12 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - INTEGERS[8], resources.reslblTemplateName_value, new Integer(97), new Integer(58), INTEGERS[5], new Short((short) 57), new Integer(101) + INTEGERS[8], resources.reslblTemplateName_value, 97, 58, INTEGERS[5], new Short((short) 57), 101 }); /* lblTemplatePath = insertLabel("lblTemplatePath", new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,new Integer(97),new Integer(77),INTEGERS[5],new Short((short)58),new Integer(71)} + new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,97,77,INTEGERS[5],new Short((short)58),71} ); */ lblTitle6 = insertLabel("lblTitle6", @@ -621,7 +621,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD }, new Object[] { - fontDescriptor5, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 62), new Integer(212) + fontDescriptor5, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[5], new Short((short) 62), 212 }); } diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index ae042fa7de76..de1d9f55c7d0 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -66,7 +66,7 @@ public class DataEntrySetter }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, new Integer(98), new Integer(25), IDataStep, new Short(curtabindex++), new Integer(195) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, 98, 25, IDataStep, new Short(curtabindex++), 195 }); optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this, @@ -76,7 +76,7 @@ public class DataEntrySetter }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, new Integer(98), new Integer(50), new Short((short) 1), IDataStep, new Short(curtabindex++), new Integer(197) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, 98, 50, new Short((short) 1), IDataStep, new Short(curtabindex++), 197 }); chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null, new String[] @@ -85,7 +85,7 @@ public class DataEntrySetter }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, new Integer(108), new Integer(62), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, 108, 62, new Short((short) 0), IDataStep, new Short(curtabindex++), 189 }); chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null, new String[] @@ -94,7 +94,7 @@ public class DataEntrySetter }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, new Integer(108), new Integer(74), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, 108, 74, new Short((short) 0), IDataStep, new Short(curtabindex++), 189 }); chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null, new String[] @@ -103,7 +103,7 @@ public class DataEntrySetter }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, new Integer(108), new Integer(86), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(191) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, 108, 86, new Short((short) 0), IDataStep, new Short(curtabindex++), 191 }); CurUnoDialog.insertLabel("lbldontdisplayExistingData", new String[] @@ -112,7 +112,7 @@ public class DataEntrySetter }, new Object[] { - new Integer(8), sdontdisplayExistingData, new Integer(108), new Integer(33), IDataStep, new Short(curtabindex++), new Integer(134) + 8, sdontdisplayExistingData, 108, 33, IDataStep, new Short(curtabindex++), 134 }); } diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java index b0fecf192bb8..056d06934f55 100644 --- a/wizards/com/sun/star/wizards/form/FieldLinker.java +++ b/wizards/com/sun/star/wizards/form/FieldLinker.java @@ -98,7 +98,7 @@ public class FieldLinker extends DBLimitedFieldSelection }, new Object[] { - new Boolean(bDoEnable), new Integer(8), sSlaveListHeader[i], new Integer(97), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97) + new Boolean(bDoEnable), 8, sSlaveListHeader[i], 97, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 }); lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), new String[] @@ -121,11 +121,11 @@ public class FieldLinker extends DBLimitedFieldSelection UIConsts.INTEGER_12, sSlaveHidString, Short.valueOf(UnoDialog.getListBoxLineCount()), - new Integer(97), + 97, new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), - new Integer(97) + 97 }); lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(), @@ -135,7 +135,7 @@ public class FieldLinker extends DBLimitedFieldSelection }, new Object[] { - new Boolean(bDoEnable), new Integer(8), sMasterListHeader[i], new Integer(206), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97) + new Boolean(bDoEnable), 8, sMasterListHeader[i], 206, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97 }); lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), @@ -159,11 +159,11 @@ public class FieldLinker extends DBLimitedFieldSelection UIConsts.INTEGER_12, sMasterHidString, Short.valueOf(UnoDialog.getListBoxLineCount()), - new Integer(206), + 206, new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), - new Integer(97) + 97 }); iCurPosY = iCurPosY + 38; } diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index c5f12728e527..997b9a885676 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -64,7 +64,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], slblFormName, new Integer(97), new Integer(25), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(111) + UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], new Short(curtabindex++), 111 }); txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this, new String[] @@ -73,7 +73,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", new Integer(97), new Integer(35), UIConsts.INTEGERS[8], new Short((short) 82), "", new Integer(185) + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), "", 185 }); CurUnoDialog.insertLabel("lblProceed", new String[] @@ -82,7 +82,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185) + UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], new Short(curtabindex++), 185 }); CurUnoDialog.insertRadioButton("optWorkWithForm", null, new String[] @@ -91,7 +91,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, new Integer(101), new Integer(77), new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), 107 }); optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null, new String[] @@ -100,7 +100,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, new Integer(101), new Integer(89), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], new Short(curtabindex++), 107 }); } diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index 9c18ab47d79d..f8cc43a1833b 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -83,7 +83,7 @@ public class FormConfiguration }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, new Integer(97), new Integer(26), ISubFormStep, new Short(curtabindex++), new Integer(160) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, 97, 26, ISubFormStep, new Short(curtabindex++), 160 }); optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, this, new String[] @@ -92,7 +92,7 @@ public class FormConfiguration }, new Object[] { - Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, new Integer(107), new Integer(43), ISubFormStep, new Short(curtabindex++), new Integer(160) + Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, 107, 43, ISubFormStep, new Short(curtabindex++), 160 }); optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, this, new String[] @@ -101,7 +101,7 @@ public class FormConfiguration }, new Object[] { - Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, new Integer(107), new Integer(99), new Short((short) 1), ISubFormStep, new Short(curtabindex++), new Integer(160) + Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, 107, 99, new Short((short) 1), ISubFormStep, new Short(curtabindex++), 160 }); lblRelations = CurUnoDialog.insertLabel("lblSelectRelation", new String[] @@ -110,7 +110,7 @@ public class FormConfiguration }, new Object[] { - Boolean.FALSE, new Integer(19), sSelectRelation, Boolean.TRUE, new Integer(119), new Integer(56), ISubFormStep, new Short(curtabindex++), new Integer(80) + Boolean.FALSE, 19, sSelectRelation, Boolean.TRUE, 119, 56, ISubFormStep, new Short(curtabindex++), 80 }); lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this, new String[] @@ -119,7 +119,7 @@ public class FormConfiguration }, new Object[] { - Boolean.FALSE, new Integer(37), "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", new Integer(201), new Integer(55), ISubFormStep, new Short(curtabindex++), new Integer(103) + Boolean.FALSE, 37, "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", 201, 55, ISubFormStep, new Short(curtabindex++), 103 }); lblSubFormDescription = CurUnoDialog.insertLabel("lblSubFormDescription", new String[] @@ -128,7 +128,7 @@ public class FormConfiguration }, new Object[] { - new Integer(59), sSubFormDescription, Boolean.TRUE, new Integer(110), new Integer(120), ISubFormStep, new Short(curtabindex++), new Integer(190) + 59, sSubFormDescription, Boolean.TRUE, 110, 120, ISubFormStep, new Short(curtabindex++), 190 }); CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue()); } diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 8cbc0242b3ba..8d76f65f6435 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -54,7 +54,6 @@ public class FormControlArranger private Control[] LabelControlList = null; private XStatusIndicator xProgressBar; private FieldColumn[] FieldColumns; - private DatabaseControl curDBControl; // Control curLabelControl; private int icurArrangement; private boolean bIsFirstRun; @@ -81,7 +80,7 @@ public class FormControlArranger private int nFormHeight; private int m_currentMaxRowHeight; private int nSecMaxRowY; - private int nMaxColRightX; + private int m_maxPostionX; private int a; private int StartA; private int m_controlMaxPosY = 0; //the maximum YPosition of a DBControl in the form @@ -105,6 +104,7 @@ public class FormControlArranger private int getLabelDiffHeight(int _index) { + final DatabaseControl curDBControl = DBControlList[_index]; if (curDBControl != null && curDBControl.getControlType() == FormHandler.SOCHECKBOX) { return getCheckBoxDiffHeight(_index); @@ -131,7 +131,7 @@ public class FormControlArranger return 0; } - private boolean isReducable(int _index) + private boolean isReducable(int _index, int i_labelWidth, int i_dbControlWidth) { boolean bisreducable = false; int ntype = FieldColumns[_index].getFieldType(); @@ -173,7 +173,7 @@ public class FormControlArranger default: bisreducable = true; } - if (m_LabelWidth > 0.9 * CMAXREDUCTION * m_dbControlWidth) + if (bisreducable && i_labelWidth > 0.9 * CMAXREDUCTION * i_dbControlWidth) { bisreducable = false; } @@ -195,7 +195,7 @@ public class FormControlArranger private void checkJustifiedPosition(int a) { int nBaseWidth = nFormWidth + cXOffset; - int nLeftDist = nMaxColRightX - nBaseWidth; + int nLeftDist = m_maxPostionX - nBaseWidth; int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - cHoriDistance); if (nLeftDist < 0.5 * nRightDist) { @@ -228,7 +228,7 @@ public class FormControlArranger DBControlList[a].setPosition(new Point(cXOffset, m_currentControlPosY)); bIsFirstRun = true; checkOuterPoints(m_currentControlPosX, m_dbControlWidth > m_LabelWidth ? m_dbControlWidth : m_LabelWidth, m_currentControlPosY, m_dbControlHeight, true); - m_currentLabelPosX = nMaxColRightX + cHoriDistance; + m_currentLabelPosX = m_maxPostionX + cHoriDistance; m_currentControlPosX = m_currentLabelPosX; adjustLineWidth(StartA, a - 1, nRightDist, 1); StartA = a; @@ -265,15 +265,15 @@ public class FormControlArranger for (int i = StartIndex; i <= EndIndex; i++) { int nControlBaseWidth = 0; - curDBControl = DBControlList[i]; + DatabaseControl dbControl = DBControlList[i]; Control curLabelControl = LabelControlList[i]; if (i != StartIndex) { curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y)); - curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight)); + dbControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight)); } final Size labelSize = curLabelControl.getSize(); - final Size controlSize = curDBControl.getSize(); + Size controlSize = dbControl.getSize(); if (((labelSize.Width > controlSize.Width)) && (WidthFactor > 0)) { nControlBaseWidth = labelSize.Width; @@ -284,21 +284,23 @@ public class FormControlArranger } if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) { - TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl; + TimeStampControl oDBTimeStampControl = (TimeStampControl) dbControl; nControlBaseWidth = oDBTimeStampControl.getSize().Width; } - if (isReducable(i) || WidthFactor > 0) + if (WidthFactor > 0 || isReducable(i, labelSize.Width, controlSize.Width)) { - curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, controlSize.Height)); + controlSize.Width = nControlBaseWidth + WidthFactor * CorrWidth; + dbControl.setSize(controlSize); + controlSize = dbControl.getSize(); } if (labelSize.Width > controlSize.Width) { - iLocTCPosX = curLabelControl.getPosition().X + labelSize.Width; + iLocTCPosX += labelSize.Width; } else { - iLocTCPosX = curDBControl.getPosition().X + controlSize.Width; + iLocTCPosX += controlSize.Width; } iLocTCPosX += cHoriDistance; } @@ -314,7 +316,6 @@ public class FormControlArranger private void checkOuterPoints(int i_nXPos, int i_nWidth, int i_nYPos, int i_nHeight, boolean i_bIsDBField) { - int nColRightX; if (icurArrangement == FormWizard.IN_BLOCK_TOP && i_bIsDBField) { // Only at DBControls you can measure the Value of nMaxRowY @@ -336,15 +337,15 @@ public class FormControlArranger // Find the outer right point if (bIsFirstRun) { - nMaxColRightX = i_nXPos + i_nWidth; + m_maxPostionX = i_nXPos + i_nWidth; bIsFirstRun = false; } else { - nColRightX = i_nXPos + i_nWidth; - if (nColRightX > nMaxColRightX) + int nColRightX = i_nXPos + i_nWidth; + if (nColRightX > m_maxPostionX) { - nMaxColRightX = nColRightX; + m_maxPostionX = nColRightX; } } } @@ -361,7 +362,7 @@ public class FormControlArranger bIsVeryFirstRun = true; m_currentMaxRowHeight = 0; nSecMaxRowY = 0; - nMaxColRightX = 0; + m_maxPostionX = 0; xProgressBar.start("", FieldColumns.length); for (int i = 0; i < FieldColumns.length; i++) { @@ -417,7 +418,7 @@ public class FormControlArranger if ((m_currentControlPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) { repositionColumnarLeftControls(LastIndex); - m_currentLabelPosX = nMaxColRightX + 2 * cHoriDistance; + m_currentLabelPosX = m_maxPostionX + 2 * cHoriDistance; m_currentControlPosX = m_currentLabelPosX + cLabelGap + m_MaxLabelWidth; m_currentControlPosY = cYOffset; nYRefPos = m_currentControlPosY; @@ -441,7 +442,7 @@ public class FormControlArranger if ((m_currentLabelPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1))) { - m_currentControlPosX = nMaxColRightX + cHoriDistance; + m_currentControlPosX = m_maxPostionX + cHoriDistance; m_currentLabelPosX = m_currentControlPosX; nYRefPos = m_currentControlPosY; m_currentControlPosY = cYOffset + m_LabelHeight + cVertDistance; @@ -459,20 +460,26 @@ public class FormControlArranger break; case FormWizard.IN_BLOCK_TOP: - if (isReducable(a)) + if (isReducable(a, m_LabelWidth, m_dbControlWidth)) { - iReduceWidth = iReduceWidth + 1; + ++iReduceWidth; } - if (nMaxColRightX > cXOffset + nFormWidth) + //if (m_maxPostionX > (nFormWidth-cXOffset-cXOffset)) // cXOffset + nFormWidth + if (m_maxPostionX > cXOffset + nFormWidth) { - int nOldYTCPos = m_currentLabelPosY; checkJustifiedPosition(a); nYRefPos = m_currentControlPosY; } else { - m_currentLabelPosX = nMaxColRightX + cHoriDistance; + m_currentLabelPosX = m_maxPostionX + cHoriDistance; } + if (a == FieldColumns.length - 1) + { + checkJustifiedPosition(a); + nYRefPos = m_currentControlPosY; + } + m_currentControlPosX = m_currentLabelPosX; ++a; if ((nYRefPos + m_dbControlHeight) > m_controlMaxPosY) { @@ -480,8 +487,6 @@ public class FormControlArranger } break; } -// if ((nYRefPos + nDBHeight) > nMaxDBYPos) -// nMaxDBYPos = nYRefPos + nDBHeight; } private void repositionColumnarLeftControls(int LastIndex) @@ -533,13 +538,16 @@ public class FormControlArranger { try { + Point aPoint = new Point(m_currentLabelPosX, m_currentLabelPosY); + Size aSize = new Size(m_LabelWidth, m_LabelHeight); if (bControlsareCreated) { - LabelControlList[i].setPosition(new Point(m_currentLabelPosX, m_currentLabelPosY)); + LabelControlList[i].setPosition(aPoint); if (icurArrangement != FormWizard.COLUMNAR_LEFT) { m_LabelWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle()); - LabelControlList[i].setSize(new Size(m_LabelWidth, m_LabelHeight)); + aSize.Width = m_LabelWidth; + LabelControlList[i].setSize(aSize); } else { @@ -548,21 +556,16 @@ public class FormControlArranger } else { - Point aPoint = new Point(m_currentLabelPosX, m_currentLabelPosY); - Size aSize = new Size(m_LabelWidth, m_LabelHeight); final String sFieldName = FieldColumns[i].getFieldName(); LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize); - // LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos)); - if (bIsVeryFirstRun) + if (bIsVeryFirstRun && icurArrangement == FormWizard.COLUMNAR_TOP) { - if (icurArrangement == FormWizard.COLUMNAR_TOP) - { - m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; - } + m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; } - String sTitle = FieldColumns[i].getFieldTitle(); + final String sTitle = FieldColumns[i].getFieldTitle(); m_LabelWidth = LabelControlList[i].getPreferredWidth(sTitle); - LabelControlList[i].setSize(new Size(m_LabelWidth, m_LabelHeight)); + aSize.Width = m_LabelWidth; + LabelControlList[i].setSize(aSize); } Control curLabelControl = LabelControlList[i]; if (icurArrangement == FormWizard.COLUMNAR_LEFT) @@ -583,11 +586,11 @@ public class FormControlArranger { m_currentControlPosX = m_currentLabelPosX; m_currentControlPosY = m_currentLabelPosY + m_LabelHeight; - curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) com.sun.star.awt.TextAlign.LEFT)); + curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) com.sun.star.awt.TextAlign.LEFT)); } else { - curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) _iAlign)); + curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) _iAlign)); } if (!bControlsareCreated) { @@ -650,7 +653,7 @@ public class FormControlArranger Helper.setUnoPropertyValue(LabelControlList[i], PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); } checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true); - aDBControl.setPropertyValue("Border", NBorderType); + aDBControl.setPropertyValue(PropertyNames.PROPERTY_BORDER, NBorderType); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index c31f907b5687..7a19b31df875 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -558,7 +558,7 @@ public class FormDocument extends TextDocument { oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getSubFormSize()); } - oGridControl.xPropertySet.setPropertyValue("Border", _NBorderType); + oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, _NBorderType); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 5c29b47c9e1a..bc49311be433 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -82,11 +82,11 @@ public class FormWizard extends DatabaseObjectWizard Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(210), Boolean.TRUE, "DialogForm", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), new Integer(310) + 210, Boolean.TRUE, "DialogForm", 102, 41, 1, new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), 310 }); drawNaviBar(); if (getFormResources() == true) @@ -237,7 +237,7 @@ public class FormWizard extends DatabaseObjectWizard }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAIN_PAGE), new Integer(210) + 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOMAIN_PAGE), 210 }); curFormConfiguration = new FormConfiguration(this); @@ -252,7 +252,7 @@ public class FormWizard extends DatabaseObjectWizard }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDS_PAGE), new Integer(210) + 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOSUBFORMFIELDS_PAGE), 210 }); curFormDocument.xProgressBar.setValue(40); diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 8ba87b457577..5cc524839b1f 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -116,7 +116,7 @@ public class StyleApplier }, new Object[] { - UIConsts.INTEGERS[8], sPageStyles, new Integer(92), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(90) + UIConsts.INTEGERS[8], sPageStyles, 92, 25, IStyleStep, new Short(curtabindex++), 90 }); lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this, @@ -126,7 +126,7 @@ public class StyleApplier }, new Object[] { - new Integer(143), "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", new Integer(92), new Integer(35), SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), new Integer(90) + 143, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", 92, 35, SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), 90 }); optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this, @@ -136,7 +136,7 @@ public class StyleApplier }, new Object[] { - UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, new Integer(196), new Integer(39), IStyleStep, new Short(curtabindex++), "0", new Integer(93) + UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, 196, 39, IStyleStep, new Short(curtabindex++), "0", 93 }); opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this, @@ -146,7 +146,7 @@ public class StyleApplier }, new Object[] { - UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, new Integer(196), new Integer(53), new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", new Integer(93) + UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, 196, 53, new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", 93 }); optFlat = CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this, @@ -156,7 +156,7 @@ public class StyleApplier }, new Object[] { - UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, new Integer(196), new Integer(67), IStyleStep, new Short(curtabindex++), "2", new Integer(93) + UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, 196, 67, IStyleStep, new Short(curtabindex++), "2", 93 }); CurUnoDialog.insertFixedLine("lnFieldBorder", @@ -166,7 +166,7 @@ public class StyleApplier }, new Object[] { - UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98) + UIConsts.INTEGERS[8], sFieldBorder, 192, 25, IStyleStep, new Short(curtabindex++), 98 }); // } // catch (Exception e) @@ -284,7 +284,7 @@ public class StyleApplier if (curControlForm.getArrangemode() == FormWizard.AS_GRID) { GridControl oGridControl = curControlForm.getGridControl(); - oGridControl.xPropertySet.setPropertyValue("Border", IBorderValue); + oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); } else { @@ -297,17 +297,17 @@ public class StyleApplier for (int i = 0; i < 2; i++) { XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); - if (xPropertySet.getPropertySetInfo().hasPropertyByName("Border")) + if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) { - xPropertySet.setPropertyValue("Border", IBorderValue); + xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); } } } else { - if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName("Border")) + if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) { - DBControls[n].xPropertySet.setPropertyValue("Border", IBorderValue); + DBControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); } } } diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index 5a2fb0592e96..cbab5c8c8ae6 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -83,7 +83,7 @@ public class UIControlArranger }, new Object[] { - UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207) + UIConsts.INTEGERS[8], sLabelPlacment, 97, 25, IControlStep, new Short(curtabindex++), 207 }); // Radio Button "Align Left" optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this, @@ -93,7 +93,7 @@ public class UIControlArranger }, new Object[] { - UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171) + UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, 107, 38, new Short((short) 1), IControlStep, new Short(curtabindex++), 171 }); // Radio Button "Align Right" optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this, @@ -103,7 +103,7 @@ public class UIControlArranger }, new Object[] { - UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171) + UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, 107, 50, IControlStep, new Short(curtabindex++), 171 }); @@ -119,7 +119,7 @@ public class UIControlArranger // }, // new Object[] // { -// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207) +// UIConsts.INTEGERS[8], sArrangementHeader[0], 97, 60, IControlStep, new Short(curtabindex++), 207 // }); // // boolean bEnabled = true; @@ -142,14 +142,14 @@ public class UIControlArranger // new Object[] // { // Boolean.valueOf(bEnabled), -// new Integer(14), +// 14, ///* TODO: WRONG!*/ "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", // "1", // new Integer(nXPos + nBtnWidth), // new Integer(nYPos), // IControlStep, // new Short(curtabindex++), -// new Integer(16) +// 16 // }); DefaultListModel imageModel = new DefaultListModel(); @@ -206,16 +206,7 @@ public class UIControlArranger public short getAlignValue() { - Short IAlignValue = null; - if (optAlignLeft.getState()) - { - IAlignValue = new Short((short) 0); - } - else - { - IAlignValue = new Short((short) 2); - } - return IAlignValue.shortValue(); + return optAlignLeft.getState() ? (short)0 : (short)2; } public void alignLabelControls() @@ -231,7 +222,7 @@ public class UIControlArranger Control[] LabelControls = curControlForm.getLabelControls(); for (int n = 0; n < LabelControls.length; n++) { - LabelControls[n].xPropertySet.setPropertyValue("Align", new Short(iAlignValue)); + LabelControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short(iAlignValue)); } } } @@ -267,7 +258,7 @@ public class UIControlArranger // }, // new Object[] // { -// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207) +// UIConsts.INTEGERS[8], _sArrangementHeader, 97, YPos, IControlStep, new Short(curtabindex++), 207 // }); // // int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT; @@ -396,11 +387,11 @@ public class UIControlArranger { UIConsts.INTEGERS[8], _sArrangementHeader, - new Integer(97), + 97, YPos, IControlStep, new Short(curtabindex++), - new Integer(207) + 207 }); int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT; diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java index b7b260e69e85..3160ff1ed011 100644 --- a/wizards/com/sun/star/wizards/letter/LetterDocument.java +++ b/wizards/com/sun/star/wizards/letter/LetterDocument.java @@ -268,7 +268,7 @@ public class LetterDocument extends TextDocument Helper.setUnoPropertyValue(xFrame, "TextWrap", WrapTextMode.THROUGHT); Helper.setUnoPropertyValue(xFrame, "Opaque", Boolean.TRUE); - Helper.setUnoPropertyValue(xFrame, "BackColor", new Integer(15790320)); + Helper.setUnoPropertyValue(xFrame, "BackColor", 15790320); BorderLine myBorder = new BorderLine(); myBorder.OuterLineWidth = 0; @@ -287,7 +287,7 @@ public class LetterDocument extends TextDocument XTextCursor xFrameCursor = xFrameText.createTextCursor(); XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFrameCursor); xCursorProps.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD)); - xCursorProps.setPropertyValue("CharColor", new Integer(16777215)); + xCursorProps.setPropertyValue("CharColor", 16777215); xCursorProps.setPropertyValue("CharFontName", new String("Albany")); xCursorProps.setPropertyValue("CharHeight", new Float(18)); diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java index 1c2a27e8ec2d..c8de529d2d41 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java @@ -143,11 +143,11 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.TRUE, new Integer(210), Boolean.TRUE, "LetterWizardDialog", new Integer(104), new Integer(52), INTEGERS[1], new Short((short) 1), resources.resLetterWizardDialog_title, new Integer(310) + Boolean.TRUE, 210, Boolean.TRUE, "LetterWizardDialog", 104, 52, INTEGERS[1], new Short((short) 1), resources.resLetterWizardDialog_title, 310 }); @@ -169,7 +169,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 1), resources.resoptBusinessLetter_value, "optBusinessLetter", new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184) + INTEGERS[8], HelpIds.getHelpIdString(HID + 1), resources.resoptBusinessLetter_value, "optBusinessLetter", 97, 28, INTEGERS[1], new Short((short) 1), 184 }); optPrivOfficialLetter = insertRadioButton("optPrivOfficialLetter", OPTPRIVOFFICIALLETTER_ITEM_CHANGED, new String[] @@ -178,7 +178,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 2), resources.resoptPrivOfficialLetter_value, "optPrivOfficialLetter", new Integer(97), new Integer(74), INTEGERS[1], new Short((short) 2), new Integer(184) + INTEGERS[8], HelpIds.getHelpIdString(HID + 2), resources.resoptPrivOfficialLetter_value, "optPrivOfficialLetter", 97, 74, INTEGERS[1], new Short((short) 2), 184 }); optPrivateLetter = insertRadioButton("optPrivateLetter", OPTPRIVATELETTER_ITEM_CHANGED, new String[] @@ -187,7 +187,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 3), resources.resoptPrivateLetter_value, "optPrivateLetter", new Integer(97), new Integer(106), INTEGERS[1], new Short((short) 3), new Integer(184) + INTEGERS[8], HelpIds.getHelpIdString(HID + 3), resources.resoptPrivateLetter_value, "optPrivateLetter", 97, 106, INTEGERS[1], new Short((short) 3), 184 }); lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED, new String[] @@ -196,7 +196,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 4), "lstBusinessStyle", new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 4), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 4), "lstBusinessStyle", 180, INTEGER_40, INTEGERS[1], new Short((short) 4), 74 }); chkBusinessPaper = insertCheckBox("chkBusinessPaper", CHKBUSINESSPAPER_ITEM_CHANGED, new String[] @@ -205,7 +205,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 5), resources.reschkBusinessPaper_value, "chkBusinessPaper", new Integer(110), new Integer(56), new Short((short) 0), INTEGERS[1], new Short((short) 5), new Integer(168) + INTEGERS[8], HelpIds.getHelpIdString(HID + 5), resources.reschkBusinessPaper_value, "chkBusinessPaper", 110, 56, new Short((short) 0), INTEGERS[1], new Short((short) 5), 168 }); lstPrivOfficialStyle = insertListBox("lstPrivOfficialStyle", LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED, LSTPRIVOFFICIALSTYLE_ITEM_CHANGED, new String[] @@ -214,7 +214,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 6), "lstPrivOfficialStyle", new Integer(180), new Integer(86), INTEGERS[1], new Short((short) 6), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 6), "lstPrivOfficialStyle", 180, 86, INTEGERS[1], new Short((short) 6), 74 }); lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED, new String[] @@ -223,7 +223,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 7), "lstPrivateStyle", new Integer(180), new Integer(118), INTEGERS[1], new Short((short) 7), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 7), "lstPrivateStyle", 180, 118, INTEGERS[1], new Short((short) 7), 74 }); lblBusinessStyle = insertLabel("lblBusinessStyle", new String[] @@ -232,7 +232,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblBusinessStyle_value, "lblBusinessStyle", new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 48), new Integer(60) + INTEGERS[8], resources.reslblBusinessStyle_value, "lblBusinessStyle", 110, 42, INTEGERS[1], new Short((short) 48), 60 }); lblPrivOfficialStyle = insertLabel("lblPrivOfficialStyle", new String[] @@ -241,7 +241,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblPrivOfficialStyle_value, "lblPrivOfficialStyle", new Integer(110), new Integer(88), INTEGERS[1], new Short((short) 49), new Integer(60) + INTEGERS[8], resources.reslblPrivOfficialStyle_value, "lblPrivOfficialStyle", 110, 88, INTEGERS[1], new Short((short) 49), 60 }); lblTitle1 = insertLabel("lblTitle1", new String[] @@ -250,7 +250,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, "lblTitle1", new Integer(91), INTEGERS[8], INTEGERS[1], new Short((short) 55), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, "lblTitle1", 91, INTEGERS[8], INTEGERS[1], new Short((short) 55), 212 }); lblPrivateStyle = insertLabel("lblPrivateStyle", new String[] @@ -259,7 +259,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblPrivateStyle_value, "lblPrivateStyle", new Integer(110), new Integer(120), INTEGERS[1], new Short((short) 74), new Integer(60) + INTEGERS[8], resources.reslblPrivateStyle_value, "lblPrivateStyle", 110, 120, INTEGERS[1], new Short((short) 74), 60 }); lblIntroduction = insertLabel("lblIntroduction", new String[] @@ -268,13 +268,13 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - new Integer(39), resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", new Integer(104), new Integer(145), INTEGERS[1], new Short((short) 80), new Integer(199) + 39, resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", 104, 145, INTEGERS[1], new Short((short) 80), 199 }); ImageControl3 = insertInfoImage(92, 145, 1); // ImageControl3 = insertImage("ImageControl3", -// new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, -// new Object[] { new Short((short)0), INTEGERS[10],"private:resource/dbu/image/19205","ImageControl3",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[1],new Short((short)81),INTEGERS[10]} +// new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, +// new Object[] { new Short((short)0), INTEGERS[10],"private:resource/dbu/image/19205","ImageControl3",92,145,Boolean.FALSE,INTEGERS[1],new Short((short)81),INTEGERS[10]} // ); } @@ -287,7 +287,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 8), resources.reschkPaperCompanyLogo_value, "chkPaperCompanyLogo", new Integer(97), new Integer(28), new Short((short) 0), INTEGERS[2], new Short((short) 8), new Integer(68) + INTEGERS[8], HelpIds.getHelpIdString(HID + 8), resources.reschkPaperCompanyLogo_value, "chkPaperCompanyLogo", 97, 28, new Short((short) 0), INTEGERS[2], new Short((short) 8), 68 }); numLogoHeight = insertNumericField("numLogoHeight", NUMLOGOHEIGHT_TEXT_CHANGED, new String[] @@ -296,7 +296,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 9), "numLogoHeight", new Integer(138), INTEGER_40, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 9), INTEGERS[3], new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 9), "numLogoHeight", 138, INTEGER_40, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 9), INTEGERS[3], 30 }); numLogoX = insertNumericField("numLogoX", NUMLOGOX_TEXT_CHANGED, new String[] @@ -305,7 +305,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 10), "numLogoX", new Integer(266), INTEGER_40, Boolean.TRUE, INTEGERS[2], new Short((short) 10), INTEGERS[0], new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 10), "numLogoX", 266, INTEGER_40, Boolean.TRUE, INTEGERS[2], new Short((short) 10), INTEGERS[0], 30 }); numLogoWidth = insertNumericField("numLogoWidth", NUMLOGOWIDTH_TEXT_CHANGED, new String[] @@ -314,7 +314,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 11), "numLogoWidth", new Integer(138), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 11), new Double(3.8), new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 11), "numLogoWidth", 138, 56, Boolean.TRUE, INTEGERS[2], new Short((short) 11), new Double(3.8), 30 }); numLogoY = insertNumericField("numLogoY", NUMLOGOY_TEXT_CHANGED, new String[] @@ -323,7 +323,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 12), "numLogoY", new Integer(266), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 12), new Double(-3.4), new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 12), "numLogoY", 266, 56, Boolean.TRUE, INTEGERS[2], new Short((short) 12), new Double(-3.4), 30 }); chkPaperCompanyAddress = insertCheckBox("chkPaperCompanyAddress", CHKPAPERCOMPANYADDRESS_ITEM_CHANGED, new String[] @@ -332,7 +332,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 13), resources.reschkPaperCompanyAddress_value, "chkPaperCompanyAddress", new Integer(98), new Integer(84), new Short((short) 0), INTEGERS[2], new Short((short) 13), new Integer(68) + INTEGERS[8], HelpIds.getHelpIdString(HID + 13), resources.reschkPaperCompanyAddress_value, "chkPaperCompanyAddress", 98, 84, new Short((short) 0), INTEGERS[2], new Short((short) 13), 68 }); numAddressHeight = insertNumericField("numAddressHeight", NUMADDRESSHEIGHT_TEXT_CHANGED, new String[] @@ -341,7 +341,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 14), "numAddressHeight", new Integer(138), new Integer(96), Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 14), INTEGERS[3], new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 14), "numAddressHeight", 138, 96, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 14), INTEGERS[3], 30 }); numAddressX = insertNumericField("numAddressX", NUMADDRESSX_TEXT_CHANGED, new String[] @@ -350,7 +350,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 15), "numAddressX", new Integer(266), new Integer(96), Boolean.TRUE, INTEGERS[2], new Short((short) 15), new Double(3.8), new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 15), "numAddressX", 266, 96, Boolean.TRUE, INTEGERS[2], new Short((short) 15), new Double(3.8), 30 }); numAddressWidth = insertNumericField("numAddressWidth", NUMADDRESSWIDTH_TEXT_CHANGED, new String[] @@ -359,7 +359,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 16), "numAddressWidth", new Integer(138), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 16), new Double(13.8), new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 16), "numAddressWidth", 138, 112, Boolean.TRUE, INTEGERS[2], new Short((short) 16), new Double(13.8), 30 }); numAddressY = insertNumericField("numAddressY", NUMADDRESSY_TEXT_CHANGED, new String[] @@ -368,7 +368,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 17), "numAddressY", new Integer(266), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 17), new Double(-3.4), new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 17), "numAddressY", 266, 112, Boolean.TRUE, INTEGERS[2], new Short((short) 17), new Double(-3.4), 30 }); chkCompanyReceiver = insertCheckBox("chkCompanyReceiver", CHKCOMPANYRECEIVER_ITEM_CHANGED, new String[] @@ -377,7 +377,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 18), resources.reschkCompanyReceiver_value, "chkCompanyReceiver", new Integer(103), new Integer(131), new Short((short) 0), INTEGERS[2], new Short((short) 18), new Integer(185) + INTEGERS[8], HelpIds.getHelpIdString(HID + 18), resources.reschkCompanyReceiver_value, "chkCompanyReceiver", 103, 131, new Short((short) 0), INTEGERS[2], new Short((short) 18), 185 }); chkPaperFooter = insertCheckBox("chkPaperFooter", CHKPAPERFOOTER_ITEM_CHANGED, new String[] @@ -386,7 +386,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 19), resources.reschkPaperFooter_value, "chkPaperFooter", new Integer(97), new Integer(158), new Short((short) 0), INTEGERS[2], new Short((short) 19), new Integer(68) + INTEGERS[8], HelpIds.getHelpIdString(HID + 19), resources.reschkPaperFooter_value, "chkPaperFooter", 97, 158, new Short((short) 0), INTEGERS[2], new Short((short) 19), 68 }); numFooterHeight = insertNumericField("numFooterHeight", NUMFOOTERHEIGHT_TEXT_CHANGED, new String[] @@ -395,7 +395,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 20), "numFooterHeight", new Integer(236), new Integer(156), Boolean.TRUE, INTEGERS[2], new Short((short) 20), INTEGERS[5], new Integer(30) + INTEGER_12, HelpIds.getHelpIdString(HID + 20), "numFooterHeight", 236, 156, Boolean.TRUE, INTEGERS[2], new Short((short) 20), INTEGERS[5], 30 }); lblLogoHeight = insertLabel("lblLogoHeight", new String[] @@ -404,7 +404,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblLogoHeight_value, "lblLogoHeight", new Integer(103), new Integer(42), INTEGERS[2], new Short((short) 68), new Integer(32) + INTEGERS[8], resources.reslblLogoHeight_value, "lblLogoHeight", 103, 42, INTEGERS[2], new Short((short) 68), 32 }); lblLogoWidth = insertLabel("lblLogoWidth", new String[] @@ -413,7 +413,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblLogoWidth_value, "lblLogoWidth", new Integer(103), new Integer(58), INTEGERS[2], new Short((short) 69), new Integer(32) + INTEGERS[8], resources.reslblLogoWidth_value, "lblLogoWidth", 103, 58, INTEGERS[2], new Short((short) 69), 32 }); FixedLine5 = insertFixedLine("FixedLine5", new String[] @@ -422,7 +422,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[2], "FixedLine5", new Integer(90), new Integer(78), INTEGERS[2], new Short((short) 70), new Integer(215) + INTEGERS[2], "FixedLine5", 90, 78, INTEGERS[2], new Short((short) 70), 215 }); FixedLine6 = insertFixedLine("FixedLine6", new String[] @@ -431,7 +431,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[2], "FixedLine6", new Integer(90), new Integer(150), INTEGERS[2], new Short((short) 71), new Integer(215) + INTEGERS[2], "FixedLine6", 90, 150, INTEGERS[2], new Short((short) 71), 215 }); lblFooterHeight = insertLabel("lblFooterHeight", new String[] @@ -440,7 +440,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblFooterHeight_value, "lblFooterHeight", new Integer(200), new Integer(158), INTEGERS[2], new Short((short) 72), new Integer(32) + INTEGERS[8], resources.reslblFooterHeight_value, "lblFooterHeight", 200, 158, INTEGERS[2], new Short((short) 72), 32 }); lblLogoX = insertLabel("lblLogoX", new String[] @@ -449,7 +449,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblLogoX_value, "lblLogoX", new Integer(170), new Integer(42), INTEGERS[2], new Short((short) 84), new Integer(94) + INTEGERS[8], resources.reslblLogoX_value, "lblLogoX", 170, 42, INTEGERS[2], new Short((short) 84), 94 }); lblLogoY = insertLabel("lblLogoY", new String[] @@ -458,7 +458,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblLogoY_value, "lblLogoY", new Integer(170), new Integer(58), INTEGERS[2], new Short((short) 85), new Integer(94) + INTEGERS[8], resources.reslblLogoY_value, "lblLogoY", 170, 58, INTEGERS[2], new Short((short) 85), 94 }); lblAddressHeight = insertLabel("lblAddressHeight", new String[] @@ -467,7 +467,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblAddressHeight_value, "lblAddressHeight", new Integer(103), new Integer(98), INTEGERS[2], new Short((short) 86), new Integer(32) + INTEGERS[8], resources.reslblAddressHeight_value, "lblAddressHeight", 103, 98, INTEGERS[2], new Short((short) 86), 32 }); lblAddressWidth = insertLabel("lblAddressWidth", new String[] @@ -476,7 +476,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblAddressWidth_value, "lblAddressWidth", new Integer(103), new Integer(114), INTEGERS[2], new Short((short) 87), new Integer(32) + INTEGERS[8], resources.reslblAddressWidth_value, "lblAddressWidth", 103, 114, INTEGERS[2], new Short((short) 87), 32 }); lblAddressX = insertLabel("lblAddressX", new String[] @@ -485,7 +485,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblAddressX_value, "lblAddressX", new Integer(170), new Integer(98), INTEGERS[2], new Short((short) 88), new Integer(94) + INTEGERS[8], resources.reslblAddressX_value, "lblAddressX", 170, 98, INTEGERS[2], new Short((short) 88), 94 }); lblAddressY = insertLabel("lblAddressY", new String[] @@ -494,7 +494,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblAddressY_value, "lblAddressY", new Integer(170), new Integer(114), INTEGERS[2], new Short((short) 89), new Integer(94) + INTEGERS[8], resources.reslblAddressY_value, "lblAddressY", 170, 114, INTEGERS[2], new Short((short) 89), 94 }); lblTitle2 = insertLabel("lblTitle2", new String[] @@ -503,7 +503,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle2_value, Boolean.TRUE, "lblTitle2", new Integer(91), INTEGERS[8], INTEGERS[2], new Short((short) 91), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle2_value, Boolean.TRUE, "lblTitle2", 91, INTEGERS[8], INTEGERS[2], new Short((short) 91), 212 }); } @@ -516,7 +516,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 21), "lstLetterNorm", new Integer(210), new Integer(34), INTEGERS[3], new Short((short) 21), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 21), "lstLetterNorm", 210, 34, INTEGERS[3], new Short((short) 21), 74 }); chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED, new String[] @@ -525,7 +525,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 22), resources.reschkUseLogo_value, "chkUseLogo", new Integer(97), new Integer(54), new Short((short) 0), INTEGERS[3], new Short((short) 22), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 22), resources.reschkUseLogo_value, "chkUseLogo", 97, 54, new Short((short) 0), INTEGERS[3], new Short((short) 22), 212 }); chkUseAddressReceiver = insertCheckBox("chkUseAddressReceiver", CHKUSEADDRESSRECEIVER_ITEM_CHANGED, new String[] @@ -534,7 +534,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 23), resources.reschkUseAddressReceiver_value, "chkUseAddressReceiver", new Integer(97), new Integer(69), new Short((short) 0), INTEGERS[3], new Short((short) 23), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 23), resources.reschkUseAddressReceiver_value, "chkUseAddressReceiver", 97, 69, new Short((short) 0), INTEGERS[3], new Short((short) 23), 212 }); chkUseSigns = insertCheckBox("chkUseSigns", CHKUSESIGNS_ITEM_CHANGED, new String[] @@ -543,7 +543,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 24), resources.reschkUseSigns_value, "chkUseSigns", new Integer(97), new Integer(82), new Short((short) 0), INTEGERS[3], new Short((short) 24), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 24), resources.reschkUseSigns_value, "chkUseSigns", 97, 82, new Short((short) 0), INTEGERS[3], new Short((short) 24), 212 }); chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED, new String[] @@ -552,7 +552,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 25), resources.reschkUseSubject_value, "chkUseSubject", new Integer(97), new Integer(98), new Short((short) 0), INTEGERS[3], new Short((short) 25), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 25), resources.reschkUseSubject_value, "chkUseSubject", 97, 98, new Short((short) 0), INTEGERS[3], new Short((short) 25), 212 }); chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED, new String[] @@ -561,7 +561,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 26), resources.reschkUseSalutation_value, "chkUseSalutation", new Integer(97), new Integer(113), new Short((short) 0), INTEGERS[3], new Short((short) 26), new Integer(66) + INTEGERS[8], HelpIds.getHelpIdString(HID + 26), resources.reschkUseSalutation_value, "chkUseSalutation", 97, 113, new Short((short) 0), INTEGERS[3], new Short((short) 26), 66 }); lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED, new String[] @@ -570,7 +570,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 27), "lstSalutation", new Integer(210), new Integer(110), INTEGERS[3], new Short((short) 27), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 27), "lstSalutation", 210, 110, INTEGERS[3], new Short((short) 27), 74 }); chkUseBendMarks = insertCheckBox("chkUseBendMarks", CHKUSEBENDMARKS_ITEM_CHANGED, new String[] @@ -579,7 +579,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 28), resources.reschkUseBendMarks_value, "chkUseBendMarks", new Integer(97), new Integer(127), new Short((short) 0), INTEGERS[3], new Short((short) 28), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 28), resources.reschkUseBendMarks_value, "chkUseBendMarks", 97, 127, new Short((short) 0), INTEGERS[3], new Short((short) 28), 212 }); chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED, new String[] @@ -588,7 +588,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 29), resources.reschkUseGreeting_value, "chkUseGreeting", new Integer(97), new Integer(142), new Short((short) 0), INTEGERS[3], new Short((short) 29), new Integer(66) + INTEGERS[8], HelpIds.getHelpIdString(HID + 29), resources.reschkUseGreeting_value, "chkUseGreeting", 97, 142, new Short((short) 0), INTEGERS[3], new Short((short) 29), 66 }); lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED, new String[] @@ -597,7 +597,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 30), "lstGreeting", new Integer(210), new Integer(141), INTEGERS[3], new Short((short) 30), new Integer(74) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 30), "lstGreeting", 210, 141, INTEGERS[3], new Short((short) 30), 74 }); chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED, new String[] @@ -606,7 +606,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 31), resources.reschkUseFooter_value, "chkUseFooter", new Integer(97), new Integer(158), new Short((short) 0), INTEGERS[3], new Short((short) 31), new Integer(212) + INTEGERS[8], HelpIds.getHelpIdString(HID + 31), resources.reschkUseFooter_value, "chkUseFooter", 97, 158, new Short((short) 0), INTEGERS[3], new Short((short) 31), 212 }); lblLetterNorm = insertLabel("lblLetterNorm", new String[] @@ -615,7 +615,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_16, resources.reslblLetterNorm_value, Boolean.TRUE, "lblLetterNorm", new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 50), new Integer(109) + INTEGER_16, resources.reslblLetterNorm_value, Boolean.TRUE, "lblLetterNorm", 97, 28, INTEGERS[3], new Short((short) 50), 109 }); lblTitle3 = insertLabel("lblTitle3", new String[] @@ -624,7 +624,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, "lblTitle3", new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 90), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, "lblTitle3", 91, INTEGERS[8], INTEGERS[3], new Short((short) 90), 212 }); } @@ -637,7 +637,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 32), resources.resoptSenderPlaceholder_value, "optSenderPlaceholder", new Integer(104), new Integer(42), INTEGERS[4], new Short((short) 32), new Integer(149) + INTEGERS[8], HelpIds.getHelpIdString(HID + 32), resources.resoptSenderPlaceholder_value, "optSenderPlaceholder", 104, 42, INTEGERS[4], new Short((short) 32), 149 }); optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED, new String[] @@ -646,7 +646,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 33), resources.resoptSenderDefine_value, "optSenderDefine", new Integer(104), new Integer(54), INTEGERS[4], new Short((short) 33), new Integer(149) + INTEGERS[8], HelpIds.getHelpIdString(HID + 33), resources.resoptSenderDefine_value, "optSenderDefine", 104, 54, INTEGERS[4], new Short((short) 33), 149 }); txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED, new String[] @@ -655,7 +655,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 34), "txtSenderName", new Integer(182), new Integer(67), INTEGERS[4], new Short((short) 34), new Integer(119) + INTEGER_12, HelpIds.getHelpIdString(HID + 34), "txtSenderName", 182, 67, INTEGERS[4], new Short((short) 34), 119 }); txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED, new String[] @@ -664,7 +664,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 35), "txtSenderStreet", new Integer(182), new Integer(81), INTEGERS[4], new Short((short) 35), new Integer(119) + INTEGER_12, HelpIds.getHelpIdString(HID + 35), "txtSenderStreet", 182, 81, INTEGERS[4], new Short((short) 35), 119 }); txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED, new String[] @@ -673,7 +673,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 36), "txtSenderPostCode", new Integer(182), new Integer(95), INTEGERS[4], new Short((short) 36), new Integer(25) + INTEGER_12, HelpIds.getHelpIdString(HID + 36), "txtSenderPostCode", 182, 95, INTEGERS[4], new Short((short) 36), 25 }); txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED, new String[] @@ -682,7 +682,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 37), "txtSenderState", new Integer(211), new Integer(95), INTEGERS[4], new Short((short) 37), new Integer(21) + INTEGER_12, HelpIds.getHelpIdString(HID + 37), "txtSenderState", 211, 95, INTEGERS[4], new Short((short) 37), 21 }); txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED, new String[] @@ -691,7 +691,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 38), "txtSenderCity", new Integer(236), new Integer(95), INTEGERS[4], new Short((short) 38), new Integer(65) + INTEGER_12, HelpIds.getHelpIdString(HID + 38), "txtSenderCity", 236, 95, INTEGERS[4], new Short((short) 38), 65 }); optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED, new String[] @@ -700,7 +700,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 39), resources.resoptReceiverPlaceholder_value, "optReceiverPlaceholder", new Integer(104), new Integer(145), INTEGERS[4], new Short((short) 39), new Integer(200) + INTEGERS[8], HelpIds.getHelpIdString(HID + 39), resources.resoptReceiverPlaceholder_value, "optReceiverPlaceholder", 104, 145, INTEGERS[4], new Short((short) 39), 200 }); optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED, new String[] @@ -709,7 +709,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 40), resources.resoptReceiverDatabase_value, "optReceiverDatabase", new Integer(104), new Integer(157), INTEGERS[4], new Short((short) 40), new Integer(200) + INTEGERS[8], HelpIds.getHelpIdString(HID + 40), resources.resoptReceiverDatabase_value, "optReceiverDatabase", 104, 157, INTEGERS[4], new Short((short) 40), 200 }); lblSenderAddress = insertLabel("lblSenderAddress", new String[] @@ -718,7 +718,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblSenderAddress_value, "lblSenderAddress", new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 64), new Integer(136) + INTEGERS[8], resources.reslblSenderAddress_value, "lblSenderAddress", 97, 28, INTEGERS[4], new Short((short) 64), 136 }); FixedLine2 = insertFixedLine("FixedLine2", new String[] @@ -727,7 +727,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[5], "FixedLine2", new Integer(90), new Integer(126), INTEGERS[4], new Short((short) 75), new Integer(212) + INTEGERS[5], "FixedLine2", 90, 126, INTEGERS[4], new Short((short) 75), 212 }); lblReceiverAddress = insertLabel("lblReceiverAddress", new String[] @@ -736,7 +736,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblReceiverAddress_value, "lblReceiverAddress", new Integer(97), new Integer(134), INTEGERS[4], new Short((short) 76), new Integer(136) + INTEGERS[8], resources.reslblReceiverAddress_value, "lblReceiverAddress", 97, 134, INTEGERS[4], new Short((short) 76), 136 }); lblSenderName = insertLabel("lblSenderName", new String[] @@ -745,7 +745,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblSenderName_value, "lblSenderName", new Integer(113), new Integer(69), INTEGERS[4], new Short((short) 77), new Integer(68) + INTEGERS[8], resources.reslblSenderName_value, "lblSenderName", 113, 69, INTEGERS[4], new Short((short) 77), 68 }); lblSenderStreet = insertLabel("lblSenderStreet", new String[] @@ -754,7 +754,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblSenderStreet_value, "lblSenderStreet", new Integer(113), new Integer(82), INTEGERS[4], new Short((short) 78), new Integer(68) + INTEGERS[8], resources.reslblSenderStreet_value, "lblSenderStreet", 113, 82, INTEGERS[4], new Short((short) 78), 68 }); lblPostCodeCity = insertLabel("lblPostCodeCity", new String[] @@ -763,7 +763,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblPostCodeCity_value, "lblPostCodeCity", new Integer(113), new Integer(97), INTEGERS[4], new Short((short) 79), new Integer(68) + INTEGERS[8], resources.reslblPostCodeCity_value, "lblPostCodeCity", 113, 97, INTEGERS[4], new Short((short) 79), 68 }); lblTitle4 = insertLabel("lblTitle4", new String[] @@ -772,7 +772,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, "lblTitle4", new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 92), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, "lblTitle4", 91, INTEGERS[8], INTEGERS[4], new Short((short) 92), 212 }); } @@ -785,7 +785,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - new Integer(47), HelpIds.getHelpIdString(HID + 41), Boolean.TRUE, "txtFooter", new Integer(97), INTEGER_40, INTEGERS[5], new Short((short) 41), new Integer(203) + 47, HelpIds.getHelpIdString(HID + 41), Boolean.TRUE, "txtFooter", 97, INTEGER_40, INTEGERS[5], new Short((short) 41), 203 }); chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED, new String[] @@ -794,7 +794,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 42), resources.reschkFooterNextPages_value, "chkFooterNextPages", new Integer(97), new Integer(92), new Short((short) 0), INTEGERS[5], new Short((short) 42), new Integer(202) + INTEGERS[8], HelpIds.getHelpIdString(HID + 42), resources.reschkFooterNextPages_value, "chkFooterNextPages", 97, 92, new Short((short) 0), INTEGERS[5], new Short((short) 42), 202 }); chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED, new String[] @@ -803,7 +803,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 43), resources.reschkFooterPageNumbers_value, "chkFooterPageNumbers", new Integer(97), new Integer(106), new Short((short) 0), INTEGERS[5], new Short((short) 43), new Integer(201) + INTEGERS[8], HelpIds.getHelpIdString(HID + 43), resources.reschkFooterPageNumbers_value, "chkFooterPageNumbers", 97, 106, new Short((short) 0), INTEGERS[5], new Short((short) 43), 201 }); lblFooter = insertLabel("lblFooter", new String[] @@ -812,7 +812,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor5, INTEGERS[8], resources.reslblFooter_value, "lblFooter", new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 52), new Integer(116) + fontDescriptor5, INTEGERS[8], resources.reslblFooter_value, "lblFooter", 97, 28, INTEGERS[5], new Short((short) 52), 116 }); lblTitle5 = insertLabel("lblTitle5", new String[] @@ -821,7 +821,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, "lblTitle5", new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 93), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, "lblTitle5", 91, INTEGERS[8], INTEGERS[5], new Short((short) 93), 212 }); } @@ -834,7 +834,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID + 44), "txtTemplateName", new Integer(202), new Integer(56), INTEGERS[6], new Short((short) 44), resources.restxtTemplateName_value, new Integer(100) + INTEGER_12, HelpIds.getHelpIdString(HID + 44), "txtTemplateName", 202, 56, INTEGERS[6], new Short((short) 44), resources.restxtTemplateName_value, 100 }); optCreateLetter = insertRadioButton("optCreateLetter", OPTCREATELETTER_ITEM_CHANGED, new String[] @@ -843,7 +843,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 45), resources.resoptCreateLetter_value, "optCreateLetter", new Integer(104), new Integer(111), INTEGERS[6], new Short((short) 50), new Integer(198) + INTEGERS[8], HelpIds.getHelpIdString(HID + 45), resources.resoptCreateLetter_value, "optCreateLetter", 104, 111, INTEGERS[6], new Short((short) 50), 198 }); optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED, new String[] @@ -852,7 +852,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID + 46), resources.resoptMakeChanges_value, "optMakeChanges", new Integer(104), new Integer(123), INTEGERS[6], new Short((short) 51), new Integer(198) + INTEGERS[8], HelpIds.getHelpIdString(HID + 46), resources.resoptMakeChanges_value, "optMakeChanges", 104, 123, INTEGERS[6], new Short((short) 51), 198 }); lblFinalExplanation1 = insertLabel("lblFinalExplanation1", new String[] @@ -861,7 +861,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - new Integer(26), resources.reslblFinalExplanation1_value, Boolean.TRUE, "lblFinalExplanation1", new Integer(97), new Integer(28), INTEGERS[6], new Short((short) 52), new Integer(205) + 26, resources.reslblFinalExplanation1_value, Boolean.TRUE, "lblFinalExplanation1", 97, 28, INTEGERS[6], new Short((short) 52), 205 }); lblProceed = insertLabel("lblProceed", new String[] @@ -870,7 +870,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblProceed_value, "lblProceed", new Integer(97), new Integer(100), INTEGERS[6], new Short((short) 53), new Integer(204) + INTEGERS[8], resources.reslblProceed_value, "lblProceed", 97, 100, INTEGERS[6], new Short((short) 53), 204 }); lblFinalExplanation2 = insertLabel("lblFinalExplanation2", new String[] @@ -879,16 +879,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - new Integer(33), resources.reslblFinalExplanation2_value, Boolean.TRUE, "lblFinalExplanation2", new Integer(104), new Integer(145), INTEGERS[6], new Short((short) 54), new Integer(199) + 33, resources.reslblFinalExplanation2_value, Boolean.TRUE, "lblFinalExplanation2", 104, 145, INTEGERS[6], new Short((short) 54), 199 }); ImageControl2 = insertImage("ImageControl2", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", "ImageControl2", new Integer(92), new Integer(145), Boolean.FALSE, INTEGERS[6], new Short((short) 66), INTEGERS[10] + new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", "ImageControl2", 92, 145, Boolean.FALSE, INTEGERS[6], new Short((short) 66), INTEGERS[10] }); lblTemplateName = insertLabel("lblTemplateName", new String[] @@ -897,7 +897,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - INTEGERS[8], resources.reslblTemplateName_value, "lblTemplateName", new Integer(97), new Integer(58), INTEGERS[6], new Short((short) 82), new Integer(101) + INTEGERS[8], resources.reslblTemplateName_value, "lblTemplateName", 97, 58, INTEGERS[6], new Short((short) 82), 101 }); lblTitle6 = insertLabel("lblTitle6", new String[] @@ -906,7 +906,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW }, new Object[] { - fontDescriptor6, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, "lblTitle6", new Integer(91), INTEGERS[8], INTEGERS[6], new Short((short) 94), new Integer(212) + fontDescriptor6, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, "lblTitle6", 91, INTEGERS[8], INTEGERS[6], new Short((short) 94), 212 }); } diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 1b528a749f36..bfdb93c3bb02 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -71,7 +71,7 @@ public class Finalizer }, new Object[] { - new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52) + 8, reslblQueryTitle, 95, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 52 }); m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, new String[] { @@ -79,7 +79,7 @@ public class Finalizer }, new Object[] { - new Integer(12), HelpIds.getHelpIdString(curHelpIndex++), new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90) + 12, HelpIds.getHelpIdString(curHelpIndex++), 95, 37, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 90 }); m_queryWizard.insertLabel("lblHowGoOn", new String[] { @@ -87,7 +87,7 @@ public class Finalizer }, new Object[] { - new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112) + 16, reslblHowGoOn, Boolean.TRUE, 192, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 112 }); this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery", new String[] @@ -96,7 +96,7 @@ public class Finalizer }, new Object[] { - new Integer(9), HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) + 9, HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, 192, 46, new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118 }); m_queryWizard.insertRadioButton("optModifyQuery", @@ -106,7 +106,7 @@ public class Finalizer }, new Object[] { - new Integer(10), HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) + 10, HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, 192, 56, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118 }); m_queryWizard.insertFixedLine("flnSummary", new String[] { @@ -114,7 +114,7 @@ public class Finalizer }, new Object[] { - new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209) + 10, resflnSummary, 95, 68, 8, new Short(curtabindex++), 209 }); m_queryWizard.insertTextField("txtSummary", 0, null, new String[] { @@ -122,7 +122,7 @@ public class Finalizer }, new Object[] { - new Integer(96), HelpIds.getHelpIdString(curHelpIndex++), Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209) + 96, HelpIds.getHelpIdString(curHelpIndex++), Boolean.TRUE, 95, 80, Boolean.TRUE, 8, Boolean.TRUE, 209 }); } diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 11b9add2ea61..c31315b965a0 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -186,11 +186,11 @@ public class QueryWizard extends DatabaseObjectWizard resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88); Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310) + 210, Boolean.TRUE, "DialogQuery", 102, 41, 1, new Short((short) 0), resQueryWizard, 310 }); drawNaviBar(); setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index a1b989b10404..00b58fb5e008 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -123,7 +123,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(84), new Integer(0), sProgressTitle, new Integer(180) + 84, 0, sProgressTitle, 180 }); com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor(); oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD; @@ -136,7 +136,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150) + oFontDesc, 10, sProgressDBConnection, 6, 6, 0, 150 }); insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport", @@ -146,7 +146,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120) + 10, sProgressDataImport, 6, 24, 0, 120 }); } else @@ -158,7 +158,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120) + oFontDesc, 10, sProgressDataImport, 6, 24, 0, 120 }); } insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress", @@ -168,7 +168,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120) + 10, "", 12, 42, 0, 120 }); insertButton("cmdCancel", 10000, this, @@ -178,7 +178,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(14), HelpIds.getHelpIdString(34321), new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop + 14, HelpIds.getHelpIdString(34321), 74, 58, 0, new Short((short) 1), 40, sStop }); createWindowPeer(CurReportDocument.getWizardParent()); calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize()); diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index bab8a4bb240e..b18a99c35a5b 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -64,7 +64,7 @@ public class GroupFieldHandler extends FieldSelection }, new Object[] { - new Boolean(false), new Integer(18), sNote, new Boolean(true), new Integer(95), new Integer(158), new Integer(ReportWizard.SOGROUPPAGE), new Integer(209) + new Boolean(false), 18, sNote, new Boolean(true), 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209 }); } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 73a32f35c029..1de9f32bff23 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -94,7 +94,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68) + 8, sReportTitle, 95, 27, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 68 }); xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this, @@ -104,7 +104,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(12), "HID:WIZARDS_HID_DLGREPORT_4_TITLE", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 12, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", 95, 37, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind", @@ -114,7 +114,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, slblChooseReportKind, 95, 57, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -124,7 +124,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138 }); CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -134,7 +134,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, 95, 81, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); @@ -145,7 +145,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, slblHowProceed, 105, 93, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); @@ -156,7 +156,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, new Short(curtabindex++), 138 }); CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -166,7 +166,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, 111, 115, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138 }); } diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index 16180f4df91c..4286b8819c69 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -96,7 +96,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99) + 8, slblDataStructure, 95, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99 }); short iSelPos = 0; @@ -115,10 +115,10 @@ public class ReportLayouter }, new Object[] { - new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", new Integer(95), new Integer(37), new short[] + 108, "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", 95, 37, new short[] { iSelPos - }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99) + }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), 99 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout", @@ -128,7 +128,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99) + 8, slblPageLayout, 205, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99 }); short iSelLayoutPos = 0; @@ -150,10 +150,10 @@ public class ReportLayouter }, new Object[] { - new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", new Integer(205), new Integer(37), new short[] + 108, "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", 205, 37, new short[] { iSelLayoutPos - }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99) + }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99 }); iOldLayoutPos = (int) iSelPos; CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation", @@ -163,7 +163,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74) + 8, sOrientationHeader, 95, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 74 }); short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0; @@ -174,7 +174,7 @@ public class ReportLayouter }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60) + 10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60 }); short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0; @@ -185,17 +185,17 @@ public class ReportLayouter }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60) + 10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60 }); aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short("0"), new Integer(23), new Integer(164), new Integer(158), new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(30) + new Short("0"), 23, 164, 158, new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), 30 }); String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource); @@ -206,7 +206,7 @@ public class ReportLayouter }, new Object[] { - new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99) + 34, sNote, new Boolean(true), 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99 }); if (m_nLandscapeState == 1) { diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index b2c41bb2c1af..224cd7abeff3 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -109,7 +109,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, new String[] { PropertyNames.PROPERTY_HEIGHT, - "Moveable", + PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, @@ -123,12 +123,12 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, Integer.valueOf(210), Boolean.TRUE, "DialogReport", - new Integer(102), - new Integer(41), - new Integer(1), + 102, + 41, + 1, new Short((short) 0), sMsgWizardName, - new Integer(310) + 310 }); drawNaviBar(); setRightPaneHeaders(this.WizardHeaderText); @@ -329,7 +329,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, }, new Object[] { - new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210) + 16, sShowBinaryFields, 95, 162, 1, 210 }); } // CurReportDocument.getDoc().xProgressBar.setValue(40); diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java index f816b03e8f8c..cf00c86f90d4 100644 --- a/wizards/com/sun/star/wizards/table/FieldDescription.java +++ b/wizards/com/sun/star/wizards/table/FieldDescription.java @@ -155,7 +155,7 @@ public class FieldDescription if (propertyexists("DefaultValue")) { aPropertyValues.addElement(Properties.createProperty("DefaultValue", (Boolean) xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue"); - //Type = new Integer(4); // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type"); + //Type = 4; // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type"); } } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index 43349d71376f..5c5111e273b1 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -84,7 +84,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - UIConsts.INTEGERS[8], sFieldNames, new Integer(91), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(90) + UIConsts.INTEGERS[8], sFieldNames, 91, 27, IFieldFormatStep, new Short(curtabindex++), 90 }); try @@ -96,7 +96,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - new Integer(133), "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", new Integer(92), new Integer(37), IFieldFormatStep, new Short(curtabindex++), new Integer(62) + 133, "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", 92, 37, IFieldFormatStep, new Short(curtabindex++), 62 }); } catch (Exception e) @@ -114,7 +114,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - Boolean.FALSE, oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), new Integer(158), new Integer(139), IFieldFormatStep, new Short(curtabindex++), new Integer(14) + Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), 158, 139, IFieldFormatStep, new Short(curtabindex++), 14 }); btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this, @@ -124,7 +124,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - Boolean.FALSE, oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), new Integer(158), new Integer(156), IFieldFormatStep, new Short(curtabindex++), new Integer(14) + Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), 158, 156, IFieldFormatStep, new Short(curtabindex++), 14 }); oFontDesc = new FontDescriptor(); oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD; @@ -136,7 +136,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", new Integer(118), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14) + oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", 118, 175, IFieldFormatStep, new Short(curtabindex++), 14 }); btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this, @@ -146,7 +146,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", new Integer(137), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14) + oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", 137, 175, IFieldFormatStep, new Short(curtabindex++), 14 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "ColDescriptorHeader", @@ -156,7 +156,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - new Integer(8), sfieldinfo, new Integer(0), new Integer(158), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(165) + 8, sfieldinfo, 0, 158, 27, IFieldFormatStep, new Short(curtabindex++), 165 }); @@ -167,7 +167,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - UIConsts.INTEGERS[8], sFieldName, new Integer(158), new Integer(39), IFieldFormatStep, new Short(curtabindex++), new Integer(94) + UIConsts.INTEGERS[8], sFieldName, 158, 39, IFieldFormatStep, new Short(curtabindex++), 94 }); txtfieldname = CurUnoDialog.insertTextField("txtfieldname", MODIFYFIELDNAME, this, @@ -177,7 +177,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", new Integer(274), new Integer(37), IFieldFormatStep, new Short(curtabindex++), "", new Integer(50) + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, new Short(curtabindex++), "", 50 }); txtfieldname.addTextListener(CurUnoDialog); CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext); @@ -195,7 +195,7 @@ public class FieldFormatter implements XItemListener }, // PropertyNames.PROPERTY_HELPURL new Object[] { - new Integer(85), new Integer(158), new Integer(49), IFieldFormatStep, new Short(curtabindex++), new Integer(166), new Integer(50) + 85, 158, 49, IFieldFormatStep, new Short(curtabindex++), 166, 50 }); //, "HID:WIZARDS_HID_DLGTABLE_COLMODIFIER" curTableDescriptor = _curTableDescriptor; Helper.setUnoPropertyValue(oColumnDescriptorModel, "ActiveConnection", _curTableDescriptor.DBConnection); diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java index 340dd5d2dc7b..83c92aeb731f 100644 --- a/wizards/com/sun/star/wizards/table/Finalizer.java +++ b/wizards/com/sun/star/wizards/table/Finalizer.java @@ -83,7 +83,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], slblTableName, new Integer(97), new Integer(25), IFINALSTEP, new Integer(220) + UIConsts.INTEGERS[8], slblTableName, 97, 25, IFINALSTEP, 220 }); txtTableName = CurUnoDialog.insertTextField("txtTableName", SETCOMPLETIONFLAG, this, new String[] @@ -92,7 +92,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", new Integer(97), new Integer(35), IFINALSTEP, new Short(curtabindex++), "", new Integer(223) + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, new Short(curtabindex++), "", 223 }); txtTableName.addTextListener(CurUnoDialog); txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength()); @@ -119,7 +119,7 @@ public class Finalizer }, new Object[] { - new Integer(8), slblCatalog, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(120) + 8, slblCatalog, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 120 }); try @@ -131,7 +131,7 @@ public class Finalizer }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sCatalogNames, new Short(curtabindex++), 80 }); int isel = JavaTools.FieldInList(sCatalogNames, sCatalog); if (isel < 0) @@ -174,7 +174,7 @@ public class Finalizer }, new Object[] { - new Integer(8), slblSchema, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(80) + 8, slblSchema, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 80 }); try @@ -186,7 +186,7 @@ public class Finalizer }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sSchemaNames, new Short(curtabindex++), 80 }); int isel = JavaTools.FieldInList(sSchemaNames, sSchema); if (isel < 0) @@ -214,7 +214,7 @@ public class Finalizer }, new Object[] { - new Integer(16), sCongratulations, Boolean.TRUE, new Integer(97), new Integer(62), IFINALSTEP, new Short(curtabindex++), new Integer(226) + 16, sCongratulations, Boolean.TRUE, 97, 62, IFINALSTEP, new Short(curtabindex++), 226 }); } else @@ -228,7 +228,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(227) + UIConsts.INTEGERS[8], slblProceed, 97, new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 227 }); optWorkWithTable = CurUnoDialog.insertRadioButton("optWorkWithTable", null, new String[] @@ -237,7 +237,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, new Integer(101), new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), new Integer(177) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, 101, new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), 177 }); optModifyTable = CurUnoDialog.insertRadioButton("optModifyTable", null, new String[] @@ -246,7 +246,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, new Integer(101), new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, 101, new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177 }); optStartFormWizard = CurUnoDialog.insertRadioButton("optStartFormWizard", null, new String[] @@ -255,7 +255,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, new Integer(101), new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, 101, new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177 }); } catch (SQLException e) diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index a4a896752dd2..aec63204f64a 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -90,7 +90,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, new Object[] { - new Integer(40), sExplanations, Boolean.TRUE, new Integer(91), new Integer(27), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(233) + 40, sExplanations, Boolean.TRUE, 91, 27, IPRIMEKEYSTEP, new Short(curtabindex++), 233 }); chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", SPRIMEKEYMODE, this, @@ -100,7 +100,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, new Integer(97), new Integer(70), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(160) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, 97, 70, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 160 }); optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", SPRIMEKEYMODE, this, @@ -110,7 +110,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, new Integer(106), new Integer(82), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, 106, 82, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 200 }); optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", SPRIMEKEYMODE, this, @@ -120,7 +120,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, //94 new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, new Integer(106), new Integer(104), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, 106, 104, IPRIMEKEYSTEP, new Short(curtabindex++), 200 }); optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", SPRIMEKEYMODE, this, @@ -130,7 +130,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, new Integer(106), new Integer(132), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, 106, 132, IPRIMEKEYSTEP, new Short(curtabindex++), 200 }); chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", SPRIMEKEYMODE, this, @@ -140,7 +140,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, //107 new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, new Integer(116), new Integer(92), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(68) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, 116, 92, IPRIMEKEYSTEP, new Short(curtabindex++), 68 }); lblPrimeFieldName = CurUnoDialog.insertLabel("lblPrimeFieldName", @@ -150,7 +150,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, new Object[] { - Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, new Integer(116), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(46) + Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, 116, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 46 }); lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this, @@ -171,14 +171,14 @@ public class PrimaryKeyHandler implements XFieldSelectionListener { Boolean.TRUE, Boolean.FALSE, - new Integer(12), + 12, "HID:WIZARDS_HID_DLGTABLE_LB_PK_FIELDNAME", Short.valueOf(UnoDialog.getListBoxLineCount()), - new Integer(162), - new Integer(115), + 162, + 115, IPRIMEKEYSTEP, new Short(curtabindex++), - new Integer(80) + 80 }); chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this, @@ -188,7 +188,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener }, //107 new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, new Integer(248), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(66) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, 248, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 66 }); curPrimaryKeySelection = new FieldSelection(CurUnoDialog, IPRIMEKEYSTEP.intValue(), 116, 142, 208, 47, slblAvailableFields, slblSelPrimaryFields, 41234, false); curPrimaryKeySelection.addFieldSelectionListener(this); diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 9ad0506064bb..e7b94596a90a 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -104,7 +104,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - new Integer(32), sExplanation, Boolean.TRUE, new Integer(91), new Integer(27), IMAINSTEP, new Short(pretabindex++), new Integer(233) + 32, sExplanation, Boolean.TRUE, 91, 27, IMAINSTEP, new Short(pretabindex++), 233 }); lblCategories = CurUnoDialog.insertLabel("lblCategories", @@ -114,7 +114,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100) + 8, sCategories, 91, 60, IMAINSTEP, new Short(pretabindex++), 100 }); optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this, @@ -124,7 +124,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, new Integer(98), new Integer(70), new Short((short) 1), IMAINSTEP, new Short(pretabindex++), new Integer(78) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, 98, 70, new Short((short) 1), IMAINSTEP, new Short(pretabindex++), 78 }); optPrivate = CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this, @@ -134,7 +134,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, new Integer(182), new Integer(70), IMAINSTEP, new Short(pretabindex++), new Integer(90) + UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, 182, 70, IMAINSTEP, new Short(pretabindex++), 90 }); CurUnoDialog.insertLabel("lblTableNames", @@ -144,7 +144,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - new Integer(8), sTableNames, new Integer(91), new Integer(82), IMAINSTEP, new Short(pretabindex++), new Integer(80) + 8, sTableNames, 91, 82, IMAINSTEP, new Short(pretabindex++), 80 }); try @@ -156,7 +156,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LBTABLES", new Short(UnoDialog.getListBoxLineCount()), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth() + Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LBTABLES", new Short(UnoDialog.getListBoxLineCount()), 91, 92, IMAINSTEP, new Short(pretabindex++), getListboxWidth() }); } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 3015e2ddec40..79ddb8ae1039 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -79,11 +79,11 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(218), Boolean.TRUE, "DialogTable", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), sTitle, new Integer(330) + 218, Boolean.TRUE, "DialogTable", 102, 41, 1, new Short((short) 0), sTitle, 330 }); drawNaviBar(); fielditems = new Hashtable(); diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java index 69583f14c8bd..3f37d68123a6 100644 --- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java +++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java @@ -88,7 +88,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - new Integer(8), HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth) + 8, HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth) }); optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(), @@ -98,7 +98,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - new Integer(16), HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth) + 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth) }); CurUnoDialog.insertLabel("lblAggregate", new String[] @@ -107,7 +107,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - new Integer(8), slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90) + 8, slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 }); CurUnoDialog.insertLabel("lblFieldnames", new String[] @@ -116,7 +116,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - new Integer(8), slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90) + 8, slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 }); this.setTotalFieldCount(1); FontDescriptor oFontDescriptor = new FontDescriptor(); @@ -131,7 +131,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - oFontDescriptor, new Integer(14), HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), new Integer(16) + oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), 16 }); CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(), new String[] @@ -140,7 +140,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - oFontDescriptor, new Integer(14), HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), new Integer(16) + oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), 16 }); CurDBMetaData.Type = getQueryType(); } @@ -407,7 +407,7 @@ public class AggregateComponent extends ControlScroller String sDisplayFunction = sFunctions[index]; sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, sDisplayFunction, ""); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sDuplicateAggregateFunction); - CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2))); + CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2)); return new String[][] { }; @@ -532,7 +532,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - Boolean.TRUE, new Integer(12), HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), new Integer(88) + Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), 88 }); xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(), @@ -542,7 +542,7 @@ public class AggregateComponent extends ControlScroller }, new Object[] { - Boolean.TRUE, new Integer(12), HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(86) + Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 86 }); lastHelpIndex = _curHelpID - 1; } diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index 41062757f0cf..2239b940798e 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -199,7 +199,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener Integer.valueOf(cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) }); - Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); + Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1)); Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<"); Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">"); @@ -238,7 +238,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener XButton aButton = dialog.insertImageButton(sButtonName, this, new String[] { - /* "Border", */ + /* PropertyNames.PROPERTY_BORDER, */ /* "BackgroundColor", */ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, @@ -735,7 +735,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private void setBorder(Object control, Short border) { - Helper.setUnoPropertyValue(getModel(control), "Border", border); + Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_BORDER, border); //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer(); //peer.invalidate(InvalidateStyle.CHILDREN); } diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index 5a2457a18d76..1352f70f9e83 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -142,7 +142,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator }, new Object[] { - Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth + Boolean.FALSE, 8, _reslblTables, 95, 27, IStep, new Short((short) 3), LabelWidth }); // DropDown Listbox TableNames xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(), @@ -152,7 +152,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator }, new Object[] { - Boolean.TRUE, Boolean.FALSE, new Integer(12), HelpIds.getHelpIdString(super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth() + Boolean.TRUE, Boolean.FALSE, 12, HelpIds.getHelpIdString(super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), 95, 37, IStep, new Short((short) 4), getListboxWidth() }); // XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); fillupCommandListBox(); diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index b2a736fcfb0a..b8f2036f9867 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -118,7 +118,7 @@ public abstract class ControlScroller oImgControl = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgBackground" + sIncSuffix, new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -130,7 +130,7 @@ public abstract class ControlScroller new AdjustmentListenerImpl(), new String[] { - "Border", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 6ec242243adb..8159de0dd1dd 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -230,7 +230,7 @@ public class FieldSelection }, new Object[] { - new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109) + 8, slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), 109 }); // Listbox 'Available fields' @@ -251,7 +251,7 @@ public class FieldSelection }, new Object[] { - Boolean.FALSE, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth + Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); if (bshowFourButtons == true) @@ -263,7 +263,7 @@ public class FieldSelection }, new Object[] { - new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth + 14, HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); } Object btnremoveselected = CurUnoDialog.insertButton("cmdRemoveSelected" + sIncSuffix, SOCMDREMOVESEL, new ActionListenerImpl(), @@ -273,7 +273,7 @@ public class FieldSelection }, new Object[] { - Boolean.FALSE, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth + Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); if (bshowFourButtons == true) @@ -285,7 +285,7 @@ public class FieldSelection }, new Object[] { - new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth + 14, HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth }); } @@ -300,7 +300,7 @@ public class FieldSelection }, new Object[] { - new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth + 8, slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth }); // ListBox 'Fields in the form' @@ -321,7 +321,7 @@ public class FieldSelection }, new Object[] { - Boolean.FALSE, oFontDesc, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth + Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth }); Object btnmovedown = CurUnoDialog.insertButton("cmdMoveDown" + sIncSuffix, SOCMDMOVEDOWN, new ActionListenerImpl(), @@ -331,7 +331,7 @@ public class FieldSelection }, new Object[] { - Boolean.FALSE, oFontDesc, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth + Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth }); CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected); diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java index 9d42aa45599e..3f57e93edaa1 100644 --- a/wizards/com/sun/star/wizards/ui/ImageList.java +++ b/wizards/com/sun/star/wizards/ui/ImageList.java @@ -97,7 +97,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public IRenderer counterRenderer = new SimpleCounterRenderer(); private Object dialogModel; private ImageKeyListener imageKeyListener; - private static final Integer BACKGROUND_COLOR = new Integer(16777216); //new Integer(SystemColor.window.getRGB() + 16777216); + private static final Integer BACKGROUND_COLOR = 16777216; //new Integer(SystemColor.window.getRGB() + 16777216); private final static Short HIDE_PAGE = new Short((short) 99); private final static Integer TRANSPARENT = new Integer(-1); private final static int LINE_HEIGHT = 8; //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE; @@ -163,7 +163,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener new String[] { "BackgroundColor", - "Border", + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, @@ -202,7 +202,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[] { "BackgroundColor", - "Border", + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, @@ -215,8 +215,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener new Short((short) 1), new Integer(imageSize.Height + (selectionGap.Height * 2)), //height - new Integer(0), //posx - new Integer(0), //posy + 0, //posx + 0, //posy step, Boolean.TRUE, new Integer(selectionWidth) @@ -252,7 +252,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener if (showButtons) { - final Integer btnSize = new Integer(14); + final Integer btnSize = 14; btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[] { @@ -290,7 +290,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) }); - Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); + Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1)); Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<"); Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">"); @@ -331,7 +331,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private Integer m_imageHeight, m_imageWidth; private final static String[] IMAGE_PROPS = new String[] { - "Border", + PropertyNames.PROPERTY_BORDER, "BackgroundColor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, @@ -894,7 +894,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener */ private void setBorder(Object control, Short border) { - Helper.setUnoPropertyValue(getModel(control), "Border", border); + Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_BORDER, border); //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer(); //peer.invalidate(InvalidateStyle.CHILDREN); } diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java index 6b50127017e1..a19ca220490b 100755 --- a/wizards/com/sun/star/wizards/ui/PathSelection.java +++ b/wizards/com/sun/star/wizards/ui/PathSelection.java @@ -81,7 +81,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), new Integer(8), LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width) + new Boolean(Enabled), 8, LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width) }); xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[] @@ -89,7 +89,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), new Integer(12), TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26) + new Boolean(Enabled), 12, TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26) }); //CurUnoDialog.setControlProperty("txtSavePath", "ReadOnly", Boolean.TRUE); CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); @@ -98,7 +98,7 @@ public class PathSelection PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(Enabled), new Integer(14), BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), new Integer(16) + new Boolean(Enabled), 14, BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), 16 }); } diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index 3b57ca3f670a..d15f5131b560 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -102,7 +102,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth + new Boolean(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth }); HIDString = HelpIds.getHelpIdString(FirstHelpIndex); @@ -111,7 +111,7 @@ public class SortingComponent "Dropdown", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth + new Boolean(true), new Boolean(bDoEnable), 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth }); //new Short((short) (17+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 1); @@ -120,7 +120,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), new Integer(10), HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth + new Boolean(bDoEnable), 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth }); //, new Short((short) (18+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 2); @@ -129,7 +129,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), new Integer(10), HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth + new Boolean(bDoEnable), 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth }); //, new Short((short) (19+i*4)) iCurPosY = iCurPosY + 36; FirstHelpIndex += 3; @@ -276,7 +276,7 @@ public class SortingComponent { String sLocSortCriteriaisduplicate = JavaTools.replaceSubString(sSortCriteriaisduplicate, SortFieldNames.get(iduplicate)[0], ""); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocSortCriteriaisduplicate); - CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2))); + CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2)); CurUnoDialog.setFocus("lstSort" + (iduplicate + 1)); return new String[][] { diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java index ef9a568d2e01..6ef9557b158f 100644 --- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java +++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java @@ -55,14 +55,14 @@ public class TitlesComponent extends ControlScroller PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(8), _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, new Integer(60) + 8, _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, 60 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnTitles", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(8), _slblColumnTitles, new Integer(90), new Integer(iCompPosY - 10), IStep, new Integer(152) + 8, _slblColumnTitles, 90, new Integer(iCompPosY - 10), IStep, 152 }); } @@ -111,7 +111,7 @@ public class TitlesComponent extends ControlScroller }, new Object[] { - new Integer(16), new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(30) + 16, new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 30 }); xTextComponent = CurUnoDialog.insertTextField(stextfieldname, 0, null, @@ -121,7 +121,7 @@ public class TitlesComponent extends ControlScroller }, new Object[] { - new Integer(12), HelpIds.getHelpIdString(curHelpIndex++), new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20) + 12, HelpIds.getHelpIdString(curHelpIndex++), new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20) }); } } diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.java b/wizards/com/sun/star/wizards/ui/UIConsts.java index bac864ecd09c..0d5915481943 100644 --- a/wizards/com/sun/star/wizards/ui/UIConsts.java +++ b/wizards/com/sun/star/wizards/ui/UIConsts.java @@ -24,7 +24,7 @@ public interface UIConsts public static final int RID_IMG_REPORT = 1000; public static final int RID_IMG_FORM = 1100; public static final int RID_IMG_WEB = 1200; - public static final Integer INVISIBLESTEP = new Integer(99); + public static final Integer INVISIBLESTEP = 99; public static final String INFOIMAGEURL = "private:resource/dbu/image/19205"; public static final String INFOIMAGEURL_HC = "private:resource/dbu/image/19230"; /** @@ -32,12 +32,12 @@ public interface UIConsts * high tabindex because on every step their taborder must appear at the end */ public static final short SOFIRSTWIZARDNAVITABINDEX = 30000; - public static final Integer INTEGER_8 = new Integer(8); - public static final Integer INTEGER_12 = new Integer(12); - public static final Integer INTEGER_14 = new Integer(14); - public static final Integer INTEGER_16 = new Integer(16); - public static final Integer INTEGER_40 = new Integer(40); - public static final Integer INTEGER_50 = new Integer(50); + public static final Integer INTEGER_8 = 8; + public static final Integer INTEGER_12 = 12; + public static final Integer INTEGER_14 = 14; + public static final Integer INTEGER_16 = 16; + public static final Integer INTEGER_40 = 40; + public static final Integer INTEGER_50 = 50; /**Steps of the QueryWizard * */ @@ -51,7 +51,7 @@ public interface UIConsts public static final int SOSUMMARYPAGE = 8; public static final Integer[] INTEGERS = new Integer[] { - new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7), new Integer(8), new Integer(9), new Integer(10) + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; class CONTROLTYPE diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index e372a843a56a..e4f92d537841 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -619,7 +619,7 @@ public class UnoDialog implements EventNames try { int ncurstep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP)); - Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(99)); + Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, 99); Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(ncurstep)); } catch (com.sun.star.uno.Exception exception) diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index 0769e1d23b38..a872accecdcc 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -209,11 +209,11 @@ public class UnoDialog2 extends UnoDialog implements EventNames XControl xImgControl = insertImage(Desktop.getUniqueName(getDlgNameAccess(), "imgHint"), new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 0), new Integer(10), UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), new Integer(10) + new Short((short) 0), 10, UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), 10 }); super.getPeerConfiguration().setImageUrl(getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC); return xImgControl; diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index c03ceb2dc257..859904e7fc6f 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -247,12 +247,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL new Object[] { new Integer(iDialogHeight - 26), - new Integer(0), - new Integer(0), - new Integer(0), + 0, + 0, + 0, new Short((short)0), Boolean.TRUE, - new Integer(85) + 85 }); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi"); @@ -454,7 +454,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL Integer IButtonWidth = new Integer(iButtonWidth); int iButtonHeight = 14; Integer IButtonHeight = new Integer(iButtonHeight); - Integer ICurStep = new Integer(0); + Integer ICurStep = 0; int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue(); int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_WIDTH)).intValue(); int iHelpPosX = 8; @@ -471,7 +471,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL }, new Object[] { - new Integer(1), new Integer(0), new Integer(0), new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth) + 1, 0, 0, new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth) }); insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep", @@ -481,7 +481,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL }, new Object[] { - new Integer(iBtnPosY - 6), new Integer(1), new Integer(85), new Integer(0), ICurStep, new Integer(1) + new Integer(iBtnPosY - 6), 1, 85, 0, ICurStep, 1 }); String[] propNames = new String[] @@ -751,7 +751,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL }, new Object[] { - oFontDesc, new Integer(16), sRightPaneHeaders[i], Boolean.TRUE, new Integer(91), new Integer(8), new Integer(i + 1), new Short((short) 12), new Integer(212) + oFontDesc, 16, sRightPaneHeaders[i], Boolean.TRUE, 91, 8, new Integer(i + 1), new Short((short) 12), 212 }); } } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 62eaaf657447..4c8d009f967a 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -324,7 +324,7 @@ public abstract class DataAware { if (getMethod.getReturnType().equals(Short.class)) return new Short((short) 0); if (getMethod.getReturnType().equals(Integer.class)) - return new Integer(0); + return 0; if (getMethod.getReturnType().equals(short[].class)) return new short[0]; } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java index 119b2b6e1e51..3a5a1f6b637a 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java @@ -388,7 +388,7 @@ public class DataAwareFields } if (field.getType().equals(Integer.class)) { - return new Integer(0); + return 0; } if (field.getType().equals(short[].class)) { diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java index 7dddea572503..b2a9b0197357 100644 --- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java @@ -89,7 +89,7 @@ public class RadioDataAware extends DataAware { final RadioDataAware da = new RadioDataAware(data, field - ? DataAwareFields.getFieldValueFor(data, dataProp, new Integer(0)) + ? DataAwareFields.getFieldValueFor(data, dataProp, 0) : new DataAware.PropertyValue(dataProp, data), buttons); XItemListener xil = UnoDataAware.itemListener(da, listener); for (int i = 0; i < da.radioButtons.length; i++) diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index b8024fb4f9c9..acc0ed8787e6 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -184,12 +184,12 @@ public class UnoDataAware extends DataAware public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field) { - return attachTextControl(data, prop, unoControl, listener, "Date", field, new Integer(0)); + return attachTextControl(data, prop, unoControl, listener, "Date", field, 0); } public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field) { - return attachTextControl(data, prop, unoControl, listener, "Time", field, new Integer(0)); + return attachTextControl(data, prop, unoControl, listener, "Time", field, 0); } public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field) diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index 35b8f10707fc..2c8122d82df1 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -198,11 +198,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.TRUE, new Integer(160), HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", new Integer(167), new Integer(82), resources.resFTPDialog_title, new Integer(222) + Boolean.TRUE, 160, HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", 167, 82, resources.resFTPDialog_title, 222 }); //add controls to dialog @@ -235,13 +235,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), new Integer(210) + INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), 210 }); lblFTPAddress = insertLabel("lblFTPAddress", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, new Integer(20), new Short((short) 1), new Integer(95) + INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, 20, new Short((short) 1), 95 }); txtHost = insertTextField("txtHost", "disconnect", new String[] @@ -250,13 +250,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", new Integer(110), new Integer(18), new Short((short) 2), new Integer(106) + INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", 110, 18, new Short((short) 2), 106 }); lblUsername = insertLabel("lblUsername", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, new Integer(36), new Short((short) 3), new Integer(85) + INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, 36, new Short((short) 3), 85 }); txtUsername = insertTextField("txtUsername", "disconnect", new String[] @@ -265,13 +265,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID }, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", new Integer(110), new Integer(34), new Short((short) 4), new Integer(106) + INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", 110, 34, new Short((short) 4), 106 }); lblPassword = insertLabel("lblPassword", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, new Integer(52), new Short((short) 5), new Integer(85) + INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, 52, new Short((short) 5), 85 }); txtPassword = insertTextField("txtPassword", "disconnect", new String[] @@ -280,43 +280,43 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID }, new Object[] { - new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", new Integer(110), new Integer(50), new Short((short) 6), new Integer(106) + new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", 110, 50, new Short((short) 6), 106 }); ln2 = insertFixedLine("ln2", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], new Integer(68), new Short((short) 7), new Integer(210) + INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], 68, new Short((short) 7), 210 }); btnTestConnection = insertButton("btnConnect", "connect", PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, new Integer(80), new Short((short) 8), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, 80, new Short((short) 8), INTEGER_50 }); imgStatus = insertImage("imgStatus", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 0), INTEGER_14, new Integer(68), new Integer(80), Boolean.FALSE, Boolean.FALSE, INTEGER_14 + new Short((short) 0), INTEGER_14, 68, 80, Boolean.FALSE, Boolean.FALSE, INTEGER_14 }); lblStatus = insertLabel("lblStatus", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.resFTPDisconnected, "lblStatus", new Integer(86), new Integer(82), new Short((short) 9), new Integer(99) + INTEGERS[8], resources.resFTPDisconnected, "lblStatus", 86, 82, new Short((short) 9), 99 }); ln3 = insertFixedLine("ln3", PROPNAMES_LABEL, new Object[] { - INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], new Integer(100), new Short((short) 10), new Integer(210) + INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], 100, new Short((short) 10), 210 }); txtDir = insertTextField("txtDir", @@ -326,34 +326,34 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID }, new Object[] { - new Boolean(false), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, new Integer(113), new Short((short) 11), resources.restxtDir_value, new Integer(184) + new Boolean(false), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184 }); btnDir = insertButton("btnDir", "chooseDirectory", PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", new Integer(199), new Integer(112), new Short((short) 12), INTEGER_16 + INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", 199, 112, new Short((short) 12), INTEGER_16 }); btnOK = insertButton("btnOK", null, PROPNAMES_BUTTON2, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_OK), resources.resbtnOK_value, "btnOK", new Integer(165), new Integer(142), new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID_FTP_OK), resources.resbtnOK_value, "btnOK", 165, 142, new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50 }); btnCancel = insertButton("btnCancel", null, PROPNAMES_BUTTON2, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_CANCEL), resources.resbtnCancel_value, "btnCancel", new Integer(113), new Integer(142), new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID_FTP_CANCEL), resources.resbtnCancel_value, "btnCancel", 113, 142, new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50 }); btnHelp = insertButton("btnHelp", null, PROPNAMES_BUTTON2, new Object[] { - INTEGER_14, "", resources.resbtnHelp_value, "btnHelp", new Integer(57), new Integer(142), new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 + INTEGER_14, "", resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 }); } diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java index caf2a729d493..c726c0266df1 100644 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java @@ -133,11 +133,11 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", new Integer(59), new Integer(24), INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth) + Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", 59, 24, INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth) }); //Set member- FontDescriptors... fontDescriptor1.Weight = 150; @@ -153,19 +153,19 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts PROPNAMES, new Object[] { - Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(hid + 3), resources[RES_OK], "btnOK", iButtonsX, new Integer(22), new Short((short) com.sun.star.awt.PushButtonType.OK_value), new Short((short) 7), INTEGER_50 + Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(hid + 3), resources[RES_OK], "btnOK", iButtonsX, 22, new Short((short) com.sun.star.awt.PushButtonType.OK_value), new Short((short) 7), INTEGER_50 }); btnCancel = insertButton("btnCancel", null, PROPNAMES, new Object[] { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, new Integer(41), new Short((short) com.sun.star.awt.PushButtonType.CANCEL_value), new Short((short) 8), INTEGER_50 + Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, 41, new Short((short) com.sun.star.awt.PushButtonType.CANCEL_value), new Short((short) 8), INTEGER_50 }); btnHelp = insertButton("btnHelp", null, PROPNAMES, new Object[] { - Boolean.FALSE, INTEGER_14, "", resources[RES_HELP], "CommandButton3", iButtonsX, new Integer(71), new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50 + Boolean.FALSE, INTEGER_14, "", resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50 }); if (showOtherButton) @@ -202,7 +202,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts /*lblContainer = insertLabel("lblContainer", new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}, - new Object[] { new Integer(176),"lblContainer",new Integer(6),new Integer(17),new Short((short)5),new Integer(214)} + new Object[] { 176,"lblContainer",6,17,new Short((short)5),214} );*/ lblTitle = insertLabel("lblTitle", @@ -212,7 +212,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts }, new Object[] { - fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), new Integer(216) + fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), 216 }); } diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java index c26030f5e44b..3e3d40f54e76 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ b/wizards/com/sun/star/wizards/web/StatusDialog.java @@ -84,11 +84,11 @@ public class StatusDialog extends UnoDialog2 implements TaskListener Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE, "StatusDialog", new Integer(102), new Integer(52), new Integer(0), res[0], new Integer(width) + Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE, "StatusDialog", 102, 52, 0, res[0], new Integer(width) }); short tabstop = 1; @@ -100,7 +100,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener }, new Object[] { - new Integer(8), taskName, new Integer(6), new Integer(6), new Short(tabstop++), new Integer(width * 2 / 3) + 8, taskName, 6, 6, new Short(tabstop++), new Integer(width * 2 / 3) }); lblCounter = insertLabel("lblCounter", new String[] @@ -109,7 +109,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener }, new Object[] { - new Integer(8), "", new Integer(width * 2 / 3), new Integer(6), new Short(tabstop++), new Integer(width / 3 - 4) + 8, "", new Integer(width * 2 / 3), 6, new Short(tabstop++), new Integer(width / 3 - 4) }); progressBar = insertProgressBar("progress", new String[] @@ -118,7 +118,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener }, new Object[] { - new Integer(10), new Integer(6), new Integer(16), new Short(tabstop++), new Integer(width - 12) + 10, 6, 16, new Short(tabstop++), new Integer(width - 12) }); @@ -131,7 +131,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener }, new Object[] { - new Integer(14), res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), new Integer(40) + 14, res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), 40 }); } diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java index 34b278afd5e4..7c782354c0dd 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java @@ -202,10 +202,10 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC { "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }; - private static Integer INTEGER_91 = new Integer(91); - private static Integer INTEGER_97 = new Integer(97); - private static Integer INTEGER_103 = new Integer(103); - private static Integer INTEGER_169 = new Integer(169); //Resources Object + private static Integer INTEGER_91 = 91; + private static Integer INTEGER_97 = 97; + private static Integer INTEGER_103 = 103; + private static Integer INTEGER_169 = 169; //Resources Object WebWizardDialogResources resources; public WebWizardDialog(XMultiServiceFactory xmsf) @@ -219,11 +219,11 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - Boolean.TRUE, new Integer(210), HelpIds.getHelpIdString(HID0_WEBWIZARD), Boolean.TRUE, "WebWizardDialog", new Integer(102), new Integer(52), INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, new Integer(330) + Boolean.TRUE, 210, HelpIds.getHelpIdString(HID0_WEBWIZARD), Boolean.TRUE, "WebWizardDialog", 102, 52, INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, 330 }); //Set member- FontDescriptors... @@ -254,7 +254,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslbIntroTitle_value, Boolean.TRUE, "lbIntroTitle", new Integer(91), INTEGERS[8], INTEGERS[1], new Short(tabIndex++), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslbIntroTitle_value, Boolean.TRUE, "lbIntroTitle", 91, INTEGERS[8], INTEGERS[1], new Short(tabIndex++), 232 }); lblIntroduction = insertLabel("lblIntroduction", new String[] @@ -263,14 +263,14 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - new Integer(119), resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", new Integer(97), new Integer(28), INTEGERS[1], new Short(tabIndex++), new Integer(226) + 119, resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", 97, 28, INTEGERS[1], new Short(tabIndex++), 226 }); lnLoadSettings = insertFixedLine("lnLoadSettings", PROPNAMES_TXT, new Object[] { - INTEGERS[2], "", "lnLoadSettings", new Integer(91), new Integer(147), INTEGERS[1], new Short(tabIndex++), new Integer(234) + INTEGERS[2], "", "lnLoadSettings", 91, 147, INTEGERS[1], new Short(tabIndex++), 234 }); lblLoadSettings = insertLabel("lblLoadSettings", new String[] @@ -279,7 +279,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", new Integer(97), new Integer(153), INTEGERS[1], new Short(tabIndex++), new Integer(226) + INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", 97, 153, INTEGERS[1], new Short(tabIndex++), 226 }); lstLoadSettings = insertListBox("lstLoadSettings", null, LSTLOADSETTINGS_ITEM_CHANGED, new String[] @@ -288,7 +288,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), new Short((short) 14), "lstLoadSettings", new Integer(97), new Integer(165), INTEGERS[1], new Short(tabIndex++), new Integer(173) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), new Short((short) 14), "lstLoadSettings", 97, 165, INTEGERS[1], new Short(tabIndex++), 173 }); btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED, new String[] @@ -297,7 +297,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(HID1_BTN_DEL_SES), new Short(com.sun.star.awt.ImageAlign.LEFT), resources.resbtnDelSession_value, "btnDelSession", new Integer(274), new Integer(164), INTEGERS[1], new Short(tabIndex++), INTEGER_50 + Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(HID1_BTN_DEL_SES), new Short(com.sun.star.awt.ImageAlign.LEFT), resources.resbtnDelSession_value, "btnDelSession", 274, 164, INTEGERS[1], new Short(tabIndex++), INTEGER_50 }); } @@ -309,13 +309,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslblContentTitle_value, Boolean.TRUE, "lblContentTitle", new Integer(91), INTEGERS[8], INTEGERS[2], new Short(tabIndex++), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslblContentTitle_value, Boolean.TRUE, "lblContentTitle", 91, INTEGERS[8], INTEGERS[2], new Short(tabIndex++), 232 }); lblSiteContent = insertLabel("lblSiteContent", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSiteContent_value, "lblSiteContent", new Integer(97), new Integer(28), INTEGERS[2], new Short(tabIndex++), new Integer(105) + INTEGERS[8], resources.reslblSiteContent_value, "lblSiteContent", 97, 28, INTEGERS[2], new Short(tabIndex++), 105 }); lstDocuments = insertListBox("lstDocuments", null, null, new String[] @@ -324,19 +324,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - new Integer(123), HelpIds.getHelpIdString(HID2_LST_DOCS), new Short((short) 9), "lstDocuments", new Integer(97), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(103) + 123, HelpIds.getHelpIdString(HID2_LST_DOCS), new Short((short) 9), "lstDocuments", 97, 38, INTEGERS[2], new Short(tabIndex++), 103 }); btnAddDoc = insertButton("btnAddDoc", BTNADDDOC_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), resources.resbtnAddDoc_value, "btnAddDoc", new Integer(97), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), resources.resbtnAddDoc_value, "btnAddDoc", 97, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50 }); btnRemoveDoc = insertButton("btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), resources.resbtnRemoveDoc_value, "btnRemoveDoc", new Integer(150), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), resources.resbtnRemoveDoc_value, "btnRemoveDoc", 150, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50 }); btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED, new String[] @@ -345,7 +345,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), resources.resbtnDocUp_value, "btnDocUp", new Integer(205), new Integer(87), INTEGERS[2], new Short(tabIndex++), new Integer(18) + fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), resources.resbtnDocUp_value, "btnDocUp", 205, 87, INTEGERS[2], new Short(tabIndex++), 18 }); btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED, new String[] @@ -354,14 +354,14 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), resources.resbtnDocDown_value, "btnDocDown", new Integer(205), new Integer(105), INTEGERS[2], new Short(tabIndex++), new Integer(18) + fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), resources.resbtnDocDown_value, "btnDocDown", 205, 105, INTEGERS[2], new Short(tabIndex++), 18 }); lblDocExportFormat = insertLabel("lblDocExportFormat", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblDocExportFormat_value, "lblDocExportFormat", new Integer(235), new Integer(28), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGERS[8], resources.reslblDocExportFormat_value, "lblDocExportFormat", 235, 28, INTEGERS[2], new Short(tabIndex++), 89 }); lstDocTargetType = insertListBox("lstDocTargetType", null, null, new String[] @@ -370,7 +370,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), new Short((short) 14), "lstDocTargetType", new Integer(235), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(89) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), new Short((short) 14), "lstDocTargetType", 235, 38, INTEGERS[2], new Short(tabIndex++), 89 }); @@ -380,25 +380,25 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", new Integer(235), new Integer(66), INTEGERS[2], new Short(tabIndex++), new Integer(90) + INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", 235, 66, INTEGERS[2], new Short(tabIndex++), 90 }); lblDocTitle = insertLabel("lblDocTitle", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblDocTitle_value, "lblDocTitle", new Integer(235), new Integer(78), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGERS[8], resources.reslblDocTitle_value, "lblDocTitle", 235, 78, INTEGERS[2], new Short(tabIndex++), 89 }); txtDocTitle = insertTextField("txtDocTitle", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", new Integer(235), new Integer(88), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", 235, 88, INTEGERS[2], new Short(tabIndex++), 89 }); lblDocInfo = insertLabel("lblDocInfo", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblDocInfo_value, "lblDocInfo", new Integer(235), new Integer(103), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGERS[8], resources.reslblDocInfo_value, "lblDocInfo", 235, 103, INTEGERS[2], new Short(tabIndex++), 89 }); txtDocInfo = insertTextField("txtDocInfo", null, new String[] @@ -407,19 +407,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - INTEGER_40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), Boolean.TRUE, "txtDocInfo", new Integer(235), new Integer(113), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGER_40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), Boolean.TRUE, "txtDocInfo", 235, 113, INTEGERS[2], new Short(tabIndex++), 89 }); lblDocAuthor = insertLabel("lblDocAuthor", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblDocAuthor_value, "lblDocAuthor", new Integer(235), new Integer(155), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGERS[8], resources.reslblDocAuthor_value, "lblDocAuthor", 235, 155, INTEGERS[2], new Short(tabIndex++), 89 }); txtDocAuthor = insertTextField("txtDocAuthor", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), "txtDocAuthor", new Integer(235), new Integer(165), INTEGERS[2], new Short(tabIndex++), new Integer(89) + INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), "txtDocAuthor", 235, 165, INTEGERS[2], new Short(tabIndex++), 89 }); } @@ -429,13 +429,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslblLayoutTitle_value, Boolean.TRUE, "lblLayoutTitle", new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 29), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslblLayoutTitle_value, Boolean.TRUE, "lblLayoutTitle", 91, INTEGERS[8], INTEGERS[3], new Short((short) 29), 232 }); lblLayouts = insertLabel("lblLayouts", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblLayouts_value, "lblLayouts", new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 30), new Integer(206) + INTEGERS[8], resources.reslblLayouts_value, "lblLayouts", 97, 28, INTEGERS[3], new Short((short) 30), 206 }); } @@ -446,7 +446,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslblLayout2Title_value, Boolean.TRUE, "lblLayout2Title", new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 33), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslblLayout2Title_value, Boolean.TRUE, "lblLayout2Title", 91, INTEGERS[8], INTEGERS[4], new Short((short) 33), 232 }); lnDisplay = insertLabel("lblDisplay", new String[] @@ -455,86 +455,86 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - INTEGER_16, resources.reslblDisplay_value, Boolean.TRUE, "lblDisplay", new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 34), new Integer(226) + INTEGER_16, resources.reslblDisplay_value, Boolean.TRUE, "lblDisplay", 97, 28, INTEGERS[4], new Short((short) 34), 226 }); chkDocFilename = insertCheckBox("chkDocFilename", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FILENAME), resources.reschkDocFilename_value, "chkDocFilename", new Integer(103), new Integer(50), new Short((short) 0), INTEGERS[4], new Short((short) 35), new Integer(99) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FILENAME), resources.reschkDocFilename_value, "chkDocFilename", 103, 50, new Short((short) 0), INTEGERS[4], new Short((short) 35), 99 }); chbDocDesc = insertCheckBox("chbDocDesc", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_DESCRIPTION), resources.reschbDocDesc_value, "chbDocDesc", new Integer(103), new Integer(60), new Short((short) 0), INTEGERS[4], new Short((short) 36), new Integer(99) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_DESCRIPTION), resources.reschbDocDesc_value, "chbDocDesc", 103, 60, new Short((short) 0), INTEGERS[4], new Short((short) 36), 99 }); chbDocAuthor = insertCheckBox("chbDocAuthor", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_AUTHOR), resources.reschbDocAuthor_value, "chbDocAuthor", new Integer(103), new Integer(70), new Short((short) 0), INTEGERS[4], new Short((short) 37), new Integer(99) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_AUTHOR), resources.reschbDocAuthor_value, "chbDocAuthor", 103, 70, new Short((short) 0), INTEGERS[4], new Short((short) 37), 99 }); chkDocCreated = insertCheckBox("chkDocCreated", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_CR_DATE), resources.reschkDocCreated_value, "chkDocCreated", new Integer(103), new Integer(80), new Short((short) 0), INTEGERS[4], new Short((short) 38), new Integer(99) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_CR_DATE), resources.reschkDocCreated_value, "chkDocCreated", 103, 80, new Short((short) 0), INTEGERS[4], new Short((short) 38), 99 }); chkDocChanged = insertCheckBox("chkDocChanged", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_UP_DATE), resources.reschkDocChanged_value, "chkDocChanged", new Integer(103), new Integer(90), new Short((short) 0), INTEGERS[4], new Short((short) 39), new Integer(99) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_UP_DATE), resources.reschkDocChanged_value, "chkDocChanged", 103, 90, new Short((short) 0), INTEGERS[4], new Short((short) 39), 99 }); chkDocFormat = insertCheckBox("chkDocFormat", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FORMAT), resources.reschkDocFormat_value, "chkDocFormat", new Integer(200), new Integer(50), new Short((short) 0), INTEGERS[4], new Short((short) 40), new Integer(110) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FORMAT), resources.reschkDocFormat_value, "chkDocFormat", 200, 50, new Short((short) 0), INTEGERS[4], new Short((short) 40), 110 }); chkDocFormatIcon = insertCheckBox("chkDocFormatIcon", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_F_ICON), resources.reschkDocFormatIcon_value, "chkDocFormatIcon", new Integer(200), new Integer(60), new Short((short) 0), INTEGERS[4], new Short((short) 41), new Integer(110) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_F_ICON), resources.reschkDocFormatIcon_value, "chkDocFormatIcon", 200, 60, new Short((short) 0), INTEGERS[4], new Short((short) 41), 110 }); chkDocPages = insertCheckBox("chkDocPages", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_PAGES), resources.reschkDocPages_value, "chkDocPages", new Integer(200), new Integer(70), new Short((short) 0), INTEGERS[4], new Short((short) 42), new Integer(110) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_PAGES), resources.reschkDocPages_value, "chkDocPages", 200, 70, new Short((short) 0), INTEGERS[4], new Short((short) 42), 110 }); chkDocSize = insertCheckBox("chkDocSize", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_SIZE), resources.reschkDocSize_value, "chkDocSize", new Integer(200), new Integer(80), new Short((short) 0), INTEGERS[4], new Short((short) 43), new Integer(110) + INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_SIZE), resources.reschkDocSize_value, "chkDocSize", 200, 80, new Short((short) 0), INTEGERS[4], new Short((short) 43), 110 }); lblOptimizeFor = insertLabel("lblOptimizeFor", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblOptimizeFor_value, "lblOptimizeFor", new Integer(97), new Integer(113), INTEGERS[4], new Short((short) 44), new Integer(226) + INTEGERS[8], resources.reslblOptimizeFor_value, "lblOptimizeFor", 97, 113, INTEGERS[4], new Short((short) 44), 226 }); optOptimize640x480 = insertRadioButton("optOptimize640x480", null, PROPNAMES_BUTTON, new Object[] { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), resources.resoptOptimize640x480_value, "optOptimize640x480", new Integer(103), new Integer(133), INTEGERS[4], new Short((short) 45), new Integer(44) + INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), resources.resoptOptimize640x480_value, "optOptimize640x480", 103, 133, INTEGERS[4], new Short((short) 45), 44 }); optOptimize800x600 = insertRadioButton("optOptimize800x600", null, PROPNAMES_BUTTON, new Object[] { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), resources.resoptOptimize800x600_value, "optOptimize800x600", new Integer(103), new Integer(146), INTEGERS[4], new Short((short) 46), new Integer(44) + INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), resources.resoptOptimize800x600_value, "optOptimize800x600", 103, 146, INTEGERS[4], new Short((short) 46), 44 }); optOptimize1024x768 = insertRadioButton("optOptimize1024x768", null, PROPNAMES_BUTTON, new Object[] { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), resources.resoptOptimize1024x768_value, "optOptimize1024x768", new Integer(103), new Integer(158), INTEGERS[4], new Short((short) 47), new Integer(44) + INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), resources.resoptOptimize1024x768_value, "optOptimize1024x768", 103, 158, INTEGERS[4], new Short((short) 47), 44 }); } @@ -544,13 +544,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC lblStyleTitle = insertLabel("lblStyleTitle", PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslblStyleTitle_value, Boolean.TRUE, "lblStyleTitle", new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 50), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslblStyleTitle_value, Boolean.TRUE, "lblStyleTitle", 91, INTEGERS[8], INTEGERS[5], new Short((short) 50), 232 }); lblStyle = insertLabel("lblStyle", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblStyle_value, "lblStyle", new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 51), new Integer(80) + INTEGERS[8], resources.reslblStyle_value, "lblStyle", 97, 28, INTEGERS[5], new Short((short) 51), 80 }); lstStyles = insertListBox("lstStyles", null, LSTSTYLES_ITEM_CHANGED, new String[] @@ -559,48 +559,48 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID5_LST_STYLES), new Short((short) 14), "lstStyles", new Integer(179), new Integer(26), INTEGERS[5], new Short((short) 52), new Integer(145) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID5_LST_STYLES), new Short((short) 14), "lstStyles", 179, 26, INTEGERS[5], new Short((short) 52), 145 }); insertLabel("lblBackground", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblBackground, "lblBackground", new Integer(97), new Integer(46), INTEGERS[5], new Short((short) 51), new Integer(70) + INTEGERS[8], resources.reslblBackground, "lblBackground", 97, 46, INTEGERS[5], new Short((short) 51), 70 }); txtBackground = insertLabel("txtBackground", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 1), INTEGER_12, resources.resBackgroundNone, "txtBackground", new Integer(179), new Integer(44), INTEGERS[5], new Short((short) 52), new Integer(90) + new Short((short) 1), INTEGER_12, resources.resBackgroundNone, "txtBackground", 179, 44, INTEGERS[5], new Short((short) 52), 90 }); btnBackgrounds = insertButton("btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), resources.resBtnChooseBackground, "btnBackgrounds", new Integer(274), new Integer(43), INTEGERS[5], new Short((short) 53), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), resources.resBtnChooseBackground, "btnBackgrounds", 274, 43, INTEGERS[5], new Short((short) 53), INTEGER_50 }); insertLabel("lblIconset", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblIconset, "lblIconset", new Integer(97), new Integer(64), INTEGERS[5], new Short((short) 51), new Integer(70) + INTEGERS[8], resources.reslblIconset, "lblIconset", 97, 64, INTEGERS[5], new Short((short) 51), 70 }); txtIconset = insertLabel("txtIconset", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 1), INTEGER_12, resources.resIconsetNone, "txtIconset", new Integer(179), new Integer(62), INTEGERS[5], new Short((short) 52), new Integer(90) + new Short((short) 1), INTEGER_12, resources.resIconsetNone, "txtIconset", 179, 62, INTEGERS[5], new Short((short) 52), 90 }); btnIconSets = insertButton("btnIconSets", BTNICONSETS_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_ICONS), resources.resBtnChooseIconset, "btnIconSets", new Integer(274), new Integer(61), INTEGERS[5], new Short((short) 54), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_ICONS), resources.resBtnChooseIconset, "btnIconSets", 274, 61, INTEGERS[5], new Short((short) 54), INTEGER_50 }); insertLabel("lblIconsetInfo", new String[] @@ -609,7 +609,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", new Integer(179), new Integer(78), INTEGERS[5], new Short((short) 51), new Integer(145) + INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", 179, 78, INTEGERS[5], new Short((short) 51), 145 }); @@ -620,7 +620,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - new Integer(0), Boolean.FALSE, new Integer(78), "", "imgPreview", new Integer(91), new Integer(100), Boolean.FALSE, INTEGERS[5], new Short((short) 55), new Integer(232) + 0, Boolean.FALSE, 78, "", "imgPreview", 91, 100, Boolean.FALSE, INTEGERS[5], new Short((short) 55), 232 }); } @@ -632,19 +632,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGERS[8], resources.reslblTitleGeneralPage_value, Boolean.TRUE, "lblTitleGeneralPage", new Integer(90), INTEGERS[9], INTEGERS[6], new Short(tabIndex++), new Integer(232) + fontDescriptor4, INTEGERS[8], resources.reslblTitleGeneralPage_value, Boolean.TRUE, "lblTitleGeneralPage", 90, INTEGERS[9], INTEGERS[6], new Short(tabIndex++), 232 }); lblSiteTitle = insertLabel("lblSiteTitle", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSiteTitle_value, "lblSiteTitle", new Integer(97), new Integer(28), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblSiteTitle_value, "lblSiteTitle", 97, 28, INTEGERS[6], new Short(tabIndex++), 80 }); txtSiteTitle = insertTextField("txtSiteTitle", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), "txtSiteTitle", new Integer(179), new Integer(26), INTEGERS[6], new Short(tabIndex++), new Integer(145) + INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), "txtSiteTitle", 179, 26, INTEGERS[6], new Short(tabIndex++), 145 }); @@ -652,7 +652,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_LBL, new Object[] { - INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", new Integer(97), new Integer(56), INTEGERS[6], new Short(tabIndex++), new Integer(228) + INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", 97, 56, INTEGERS[6], new Short(tabIndex++), 228 }); @@ -660,35 +660,35 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", new Integer(103), new Integer(72), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", 103, 72, INTEGERS[6], new Short(tabIndex++), 80 }); txtSiteDesc = insertTextField("txtSiteDesc", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", new Integer(179), new Integer(70), INTEGERS[6], new Short(tabIndex++), new Integer(145) + INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", 179, 70, INTEGERS[6], new Short(tabIndex++), 145 }); lblEmail = insertLabel("lblEmail", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblEmail_value, "lblEmail", new Integer(103), new Integer(90), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblEmail_value, "lblEmail", 103, 90, INTEGERS[6], new Short(tabIndex++), 80 }); txtEmail = insertTextField("txtEmail", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", new Integer(179), new Integer(87), INTEGERS[6], new Short(tabIndex++), new Integer(145) + INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", 179, 87, INTEGERS[6], new Short(tabIndex++), 145 }); lblCopyright = insertLabel("lblCopyright", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblCopyright_value, "lblCopyright", new Integer(103), new Integer(108), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblCopyright_value, "lblCopyright", 103, 108, INTEGERS[6], new Short(tabIndex++), 80 }); txtCopyright = insertTextField("txtCopyright", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), "txtCopyright", new Integer(179), new Integer(106), INTEGERS[6], new Short(tabIndex++), new Integer(145) + INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), "txtCopyright", 179, 106, INTEGERS[6], new Short(tabIndex++), 145 }); @@ -696,7 +696,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", new Integer(103), new Integer(126), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", 103, 126, INTEGERS[6], new Short(tabIndex++), 80 }); dateSiteCreated = insertDateField("dateSiteCreated", null, new String[] @@ -705,13 +705,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), "dateSiteCreated", new Integer(179), new Integer(124), INTEGERS[6], new Short(tabIndex++), new Integer(49) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), "dateSiteCreated", 179, 124, INTEGERS[6], new Short(tabIndex++), 49 }); lblSiteUpdated = insertLabel("lblSiteUpdated", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSiteUpdated_value, "lblSiteUpdated", new Integer(103), new Integer(144), INTEGERS[6], new Short(tabIndex++), new Integer(80) + INTEGERS[8], resources.reslblSiteUpdated_value, "lblSiteUpdated", 103, 144, INTEGERS[6], new Short(tabIndex++), 80 }); dateSiteUpdate = insertDateField("dateSiteUpdate", null, @@ -721,7 +721,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), "dateSiteUpdate", new Integer(179), new Integer(142), INTEGERS[6], new Short(tabIndex++), new Integer(49) + Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), "dateSiteUpdate", 179, 142, INTEGERS[6], new Short(tabIndex++), 49 }); @@ -736,92 +736,92 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TITLE, new Object[] { - fontDescriptor4, INTEGER_16, resources.reslblTitlePublish_value, Boolean.TRUE, "lblTitlePublish", new Integer(91), INTEGERS[8], INTEGERS[7], new Short(tabIndex++), new Integer(232) + fontDescriptor4, INTEGER_16, resources.reslblTitlePublish_value, Boolean.TRUE, "lblTitlePublish", 91, INTEGERS[8], INTEGERS[7], new Short(tabIndex++), 232 }); FixedLine1 = insertFixedLine("FixedLine1", PROPNAMES_LBL, new Object[] { - INTEGERS[9], resources.resFixedLine1_value, "FixedLine1", new Integer(97), new Integer(28), INTEGERS[7], new Short(tabIndex++), new Integer(228) + INTEGERS[9], resources.resFixedLine1_value, "FixedLine1", 97, 28, INTEGERS[7], new Short(tabIndex++), 228 }); btnPreview = insertButton("btnPreview", BTNPREVIEW_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), resources.resbtnPreview_value, "btnPreview", new Integer(103), new Integer(40), INTEGERS[7], new Short(tabIndex++), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), resources.resbtnPreview_value, "btnPreview", 103, 40, INTEGERS[7], new Short(tabIndex++), INTEGER_50 }); lblCreateSite = insertFixedLine("lblCreateSite", PROPNAMES_LBL, new Object[] { - INTEGERS[9], resources.reslblCreateSite_value, "lblCreateSite", new Integer(97), new Integer(56), INTEGERS[7], new Short(tabIndex++), new Integer(228) + INTEGERS[9], resources.reslblCreateSite_value, "lblCreateSite", 97, 56, INTEGERS[7], new Short(tabIndex++), 228 }); chkLocalDir = insertCheckBox("chkLocalDir", CHKLOCALDIR_ITEM_CHANGED, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_LOCAL), resources.reschkLocalDir_value, "chkLocalDir", new Integer(103), new Integer(68), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215) + INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_LOCAL), resources.reschkLocalDir_value, "chkLocalDir", 103, 68, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 }); txtLocalDir = insertTextField("txtLocalDir", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", new Integer(113), new Integer(78), INTEGERS[7], new Short(tabIndex++), new Integer(190) + INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", 113, 78, INTEGERS[7], new Short(tabIndex++), 190 }); btnLocalDir = insertButton("btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), resources.resbtnLocalDir_value, "btnLocalDir", new Integer(308), new Integer(77), INTEGERS[7], new Short(tabIndex++), INTEGER_16 + INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), resources.resbtnLocalDir_value, "btnLocalDir", 308, 77, INTEGERS[7], new Short(tabIndex++), INTEGER_16 }); chkZip = insertCheckBox("chkZip", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), resources.reschkZip_value, "chkZip", new Integer(103), new Integer(96), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215) + INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), resources.reschkZip_value, "chkZip", 103, 96, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 }); txtZip = insertTextField("txtZip", null, PROPNAMES_TXT, new Object[] { - INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", new Integer(113), new Integer(108), INTEGERS[7], new Short(tabIndex++), new Integer(190) + INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", 113, 108, INTEGERS[7], new Short(tabIndex++), 190 }); btnZip = insertButton("btnZip", BTNZIP_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_ZIP), resources.resbtnZip_value, "btnZip", new Integer(308), new Integer(107), INTEGERS[7], new Short(tabIndex++), INTEGER_16 + INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_ZIP), resources.resbtnZip_value, "btnZip", 308, 107, INTEGERS[7], new Short(tabIndex++), INTEGER_16 }); chkFTP = insertCheckBox("chkFTP", null, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_FTP), resources.reschkFTP_value, "chkFTP", new Integer(103), new Integer(124), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215) + INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_FTP), resources.reschkFTP_value, "chkFTP", 103, 124, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 }); - Integer FTP_STEP = disableFTP ? new Integer(99) : INTEGERS[7]; + Integer FTP_STEP = disableFTP ? 99 : INTEGERS[7]; lblFTP = insertLabel("lblFTP", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Short((short) 1), INTEGER_12, "txtFTP", new Integer(113), new Integer(134), FTP_STEP, new Short(tabIndex++), new Integer(156) + new Short((short) 1), INTEGER_12, "txtFTP", 113, 134, FTP_STEP, new Short(tabIndex++), 156 }); btnFTP = insertButton("btnFTP", BTNFTP_ACTION_PERFORMED, PROPNAMES_BUTTON, new Object[] { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_FTP), resources.resbtnFTP_value, "btnFTP", new Integer(274), new Integer(133), FTP_STEP, new Short(tabIndex++), INTEGER_50 + INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_FTP), resources.resbtnFTP_value, "btnFTP", 274, 133, FTP_STEP, new Short(tabIndex++), INTEGER_50 }); if (disableFTP) @@ -830,11 +830,11 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC insertImage("imgFTPDisabled", new String[] { - "BackgroundColor", "Border", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + "BackgroundColor", PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(-1), new Short((short) 0), Boolean.FALSE, new Integer(10), exclamationURL, "imgFTPDisabled", new Integer(115), new Integer(135), Boolean.FALSE, INTEGERS[7], new Short(tabIndex++), new Integer(8) + new Integer(-1), new Short((short) 0), Boolean.FALSE, 10, exclamationURL, "imgFTPDisabled", 115, 135, Boolean.FALSE, INTEGERS[7], new Short(tabIndex++), 8 }); insertLabel("lblFTPDisabled", new String[] @@ -843,9 +843,9 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - new Integer(-1), INTEGER_8, resources.reslblFTPDisabled, Boolean.TRUE, "lblFTPDisabled", new Integer(125), new Integer(136), INTEGERS[7], new Short(tabIndex++), new Integer(226) + new Integer(-1), INTEGER_8, resources.reslblFTPDisabled, Boolean.TRUE, "lblFTPDisabled", 125, 136, INTEGERS[7], new Short(tabIndex++), 226 }); - //FTP_STEP = new Integer(99); + //FTP_STEP = 99; } //else @@ -853,19 +853,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TXT, new Object[] { - INTEGERS[2], "", "lnSaveSetting", new Integer(97), new Integer(151), INTEGERS[7], new Short(tabIndex++), new Integer(228) + INTEGERS[2], "", "lnSaveSetting", 97, 151, INTEGERS[7], new Short(tabIndex++), 228 }); chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED, PROPNAMES_CHKBOX, new Object[] { - INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_SAVE), resources.reschkSaveSettings_value, "chkSaveSettings", new Integer(97), new Integer(157), new Short((short) 1), INTEGERS[7], new Short(tabIndex++), new Integer(215) + INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_SAVE), resources.reschkSaveSettings_value, "chkSaveSettings", 97, 157, new Short((short) 1), INTEGERS[7], new Short(tabIndex++), 215 }); lblSaveSettings = insertLabel("lblSaveSettings", PROPNAMES_LBL, new Object[] { - INTEGERS[8], resources.reslblSaveSettings_value, "lblSaveSettings", new Integer(107), new Integer(169), INTEGERS[7], new Short(tabIndex++), new Integer(45) + INTEGERS[8], resources.reslblSaveSettings_value, "lblSaveSettings", 107, 169, INTEGERS[7], new Short(tabIndex++), 45 }); cbSaveSettings = insertComboBox("txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, new String[] @@ -874,7 +874,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_SAVE), new Short((short) 14), "txtSaveSettings", new Integer(179), new Integer(167), INTEGERS[7], new Short(tabIndex++), new Integer(145) + Boolean.TRUE, Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_SAVE), new Short((short) 14), "txtSaveSettings", 179, 167, INTEGERS[7], new Short(tabIndex++), 145 }); } @@ -900,8 +900,8 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC /*for (int i = 0; i<8; i++) imgIconsPrev[i] = insertImage("imgIconPrev" + i, - new String[] { "BackgroundColor","Border",PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, "Tabstop", PropertyNames.PROPERTY_WIDTH}, - new Object[] { new Integer(-1), new Short((short)0),new Integer(14),"file:///c:/bludisk.gif", new Integer(97 + i * 20 + 7 ),new Integer(147),Boolean.FALSE,INTEGERS[5],Boolean.FALSE,new Integer(14)}); + new String[] { "BackgroundColor",PropertyNames.PROPERTY_BORDER,PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, "Tabstop", PropertyNames.PROPERTY_WIDTH}, + new Object[] { new Integer(-1), new Short((short)0),14,"file:///c:/bludisk.gif", new Integer(97 + i * 20 + 7 ),147,Boolean.FALSE,INTEGERS[5],Boolean.FALSE,14}); */ } diff --git a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java index 698bf7f44c53..474ec34e3980 100644 --- a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java +++ b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java @@ -42,9 +42,9 @@ import com.sun.star.wizards.web.data.CGSession; public class ImpressHTMLExporter extends ConfiguredExporter { - private static final Integer SMALL_IMAGE = new Integer(512); - private static final Integer MEDIUM_IMAGE = new Integer(640); - private static final Integer LARGE_IMAGE = new Integer(800); + private static final Integer SMALL_IMAGE = 512; + private static final Integer MEDIUM_IMAGE = 640; + private static final Integer LARGE_IMAGE = 800; public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException { -- cgit From 94c8d24c100c876de416ea51a9330d5b21c1c16b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:04 +0100 Subject: dba34b: removed unused includes --- svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index d7df0a932f9c..8f7e36769318 100755 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -57,8 +57,6 @@ #include /** === end UNO includes === **/ -#include -#include #include #include #include @@ -69,7 +67,6 @@ #include #include -#include #include /* -- cgit From 947f23d3b3890efbc931030bc792ab9c8d5bde87 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 0d2be85f9872..7e53a5dfa5c4 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -865,7 +865,7 @@ namespace drawinglayer // I have now moved describePDFControl to toolkit, thus i can implement the PDF // form control support now as follows ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl; - ::toolkitform::describePDFControl(rXControl, pPDFControl); + ::toolkitform::describePDFControl( rXControl, pPDFControl, *mpPDFExtOutDevData ); if(pPDFControl.get()) { -- cgit From dffb97276ae61aefeb62696bd16dc78ab6b5b5d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- toolkit/inc/toolkit/helper/formpdfexport.hxx | 14 +++---- toolkit/source/helper/formpdfexport.cxx | 58 +++++++++++----------------- vcl/inc/vcl/pdfextoutdevdata.hxx | 34 ++++++++++++++++ vcl/inc/vcl/pdfwriter.hxx | 23 +++++++++++ vcl/source/gdi/pdfextoutdevdata.cxx | 53 +++++++++++++++++++++++-- vcl/source/gdi/pdfwriter.cxx | 4 ++ vcl/source/gdi/pdfwriter_impl.cxx | 7 +++- vcl/source/gdi/pdfwriter_impl.hxx | 4 ++ 8 files changed, 151 insertions(+), 46 deletions(-) diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx index 502f25520145..cafcb5d00d38 100644 --- a/toolkit/inc/toolkit/helper/formpdfexport.hxx +++ b/toolkit/inc/toolkit/helper/formpdfexport.hxx @@ -28,22 +28,21 @@ #ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX -#ifndef TOOLKIT_DLLAPI_H #include -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ #include -#endif /** === end UNO includes === **/ -#ifndef _VCL_PDFWRITER_HXX #include -#endif #include +namespace vcl +{ + class PDFExtOutDevData; +} + //........................................................................ namespace toolkitform { @@ -53,7 +52,8 @@ namespace toolkitform */ void TOOLKIT_DLLPUBLIC describePDFControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, - ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, + ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()); //........................................................................ diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index bff2d6008d10..1bde6f66a3c0 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -28,58 +28,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX #include -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_ #include -#endif /** === end UNO includes === **/ -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include -#endif -#ifndef _VCL_PDFEXTOUTDEVDATA_HXX +#include #include -#endif -#ifndef _SV_OUTDEV_HXX #include -#endif #include #include @@ -315,7 +284,8 @@ namespace toolkitform //-------------------------------------------------------------------- /** creates a PDF compatible control descriptor for the given control */ - void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(()) + void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, + ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor, ::vcl::PDFExtOutDevData& i_pdfExportData ) SAL_THROW(()) { _rpDescriptor.reset( NULL ); OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" ); @@ -529,7 +499,25 @@ namespace toolkitform } else if ( eButtonType == FormButtonType_URL ) { - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL); + ::rtl::OUString sURL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL ); + const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' ); + if ( bDocumentLocalTarget ) + { + const ::rtl::OUString sDestinationName( sURL.copy(1) ); + // Register the destination for for future handling ... + pButtonWidget->Dest = i_pdfExportData.RegisterDest(); + + // and put it into the bookmarks, to ensure the future handling really happens + ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() ); + ::vcl::PDFExtOutDevBookmarkEntry aBookmark; + aBookmark.nDestId = pButtonWidget->Dest; + aBookmark.aBookmark = sURL; + rBookmarks.push_back( aBookmark ); + } + else + pButtonWidget->URL = sURL; + pButtonWidget->Submit = false; } @@ -630,7 +618,7 @@ namespace toolkitform } catch( const Exception& ) { - OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx index 5dda4b0f79fa..1aa9ebcc745e 100644 --- a/vcl/inc/vcl/pdfextoutdevdata.hxx +++ b/vcl/inc/vcl/pdfextoutdevdata.hxx @@ -52,8 +52,24 @@ namespace vcl */ struct PDFExtOutDevBookmarkEntry { + /** ID of the link pointing to the bookmark, or -1 if the entry denotes a destination instead of a link. + */ sal_Int32 nLinkId; + + /** ID of the named destination denoted by the bookmark, or -1 if the entry denotes a link instead of a named destination. + */ + sal_Int32 nDestId; + + /** link target name, respectively destination name + */ rtl::OUString aBookmark; + + PDFExtOutDevBookmarkEntry() + :nLinkId( -1 ) + ,nDestId( -1 ) + ,aBookmark() + { + } }; /* @@ -195,6 +211,24 @@ public : -1 if page id does not exist */ sal_Int32 CreateNamedDest( const String& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + + /** registers a destination for which a destinatin ID needs to be known immediately, instead of later on setting it via + SetLinkDest. + + This is used in contexts where a destination is referenced by means other than a link. + + Later in the export process, a call to DescribeRegisteredDest must be made, providing the information about + the destination. + + @return + the unique Id of the destination + */ + sal_Int32 RegisterDest(); + + /** provides detailed information about a destination range which previously has been registered using RegisterDest. + */ + void DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + //<---i56629 /** Create a new destination to be used in a link diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 27dbbfc80c72..af10cef382bc 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -923,6 +923,29 @@ The following structure describes the permissions used in PDF security -1 if page id does not exist */ sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); + + /** creates a destination which is not intended to be referred to by a link, but by a public destination Id. + + Form widgets, for instance, might refer to a destination, without ever actually creating a source link to + point to this destination. In such cases, a public destination Id will be assigned to the form widget, + and later on, the concrete destination data for this public Id will be registered using RegisterDestReference. + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the internal destination Id. + */ + sal_Int32 RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ ); + + /** Set the destination for a link

will change a URL type link to a dest link if necessary

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 046bc4a8951d..815a3b62c027 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -31,22 +31,25 @@ #include "vcl/graph.hxx" #include "vcl/outdev.hxx" #include "vcl/gfxlink.hxx" +#include "vcl/dllapi.h" #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" #include #include +#include namespace vcl { -struct PDFExtOutDevDataSync +struct SAL_DLLPRIVATE PDFExtOutDevDataSync { enum Action{ CreateNamedDest, CreateDest, CreateLink, SetLinkDest, SetLinkURL, + RegisterDest, CreateOutlineItem, SetOutlineItemParent, SetOutlineItemText, @@ -73,7 +76,15 @@ struct PDFExtOutDevDataSync Action eAct; }; -struct GlobalSyncData +struct SAL_DLLPRIVATE PDFLinkDestination +{ + Rectangle mRect; + MapMode mMapMode; + sal_Int32 mPageNr; + PDFWriter::DestAreaType mAreaType; +}; + +struct SAL_DLLPRIVATE GlobalSyncData { std::deque< PDFExtOutDevDataSync::Action > mActions; std::deque< MapMode > mParaMapModes; @@ -84,6 +95,7 @@ struct GlobalSyncData std::deque< PDFWriter::DestAreaType > mParaDestAreaTypes; std::deque< PDFNote > mParaPDFNotes; std::deque< PDFWriter::PageTransition > mParaPageTransitions; + ::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations; sal_Int32 GetMappedId(); sal_Int32 GetMappedStructId( sal_Int32 ); @@ -145,7 +157,7 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) { switch( *aIter ) { - case PDFExtOutDevDataSync::CreateNamedDest : //i56629 + case PDFExtOutDevDataSync::CreateNamedDest : //i56629 { rWriter.Push( PUSH_MAPMODE ); rWriter.SetMapMode( mParaMapModes.front() ); @@ -197,6 +209,21 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) mParaOUStrings.pop_front(); } break; + case PDFExtOutDevDataSync::RegisterDest : + { + const sal_Int32 nDestId = mParaInts.front(); + mParaInts.pop_front(); + OSL_ENSURE( mFutureDestinations.find( nDestId ) != mFutureDestinations.end(), + "GlobalSyncData::PlayGlobalActions: DescribeRegisteredRequest has not been called for that destination!" ); + + PDFLinkDestination& rDest = mFutureDestinations[ nDestId ]; + + rWriter.Push( PUSH_MAPMODE ); + rWriter.SetMapMode( rDest.mMapMode ); + mParaIds.push_back( rWriter.RegisterDestReference( nDestId, rDest.mRect, rDest.mPageNr, rDest.mAreaType ) ); + rWriter.Pop(); + } + break; case PDFExtOutDevDataSync::CreateOutlineItem : { sal_Int32 nParent = GetMappedId(); @@ -459,6 +486,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM case PDFExtOutDevDataSync::CreateLink: case PDFExtOutDevDataSync::SetLinkDest: case PDFExtOutDevDataSync::SetLinkURL: + case PDFExtOutDevDataSync::RegisterDest: case PDFExtOutDevDataSync::CreateOutlineItem: case PDFExtOutDevDataSync::SetOutlineItemParent: case PDFExtOutDevDataSync::SetOutlineItemText: @@ -617,9 +645,28 @@ sal_Int32 PDFExtOutDevData::CreateNamedDest(const String& sDestName, const Rect mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() ); mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr ); mpGlobalSyncData->mParaDestAreaTypes.push_back( eType ); + return mpGlobalSyncData->mCurId++; } //<---i56629 +sal_Int32 PDFExtOutDevData::RegisterDest() +{ + const sal_Int32 nLinkDestID = mpGlobalSyncData->mCurId++; + mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::RegisterDest ); + mpGlobalSyncData->mParaInts.push_back( nLinkDestID ); + + return nLinkDestID; +} +void PDFExtOutDevData::DescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) +{ + OSL_PRECOND( nDestId != -1, "PDFExtOutDevData::DescribeRegisteredDest: invalid destination Id!" ); + PDFLinkDestination aLinkDestination; + aLinkDestination.mRect = rRect; + aLinkDestination.mMapMode = mrOutDev.GetMapMode(); + aLinkDestination.mPageNr = nPageNr == -1 ? mnPage : nPageNr; + aLinkDestination.mAreaType = eType; + mpGlobalSyncData->mFutureDestinations[ nDestId ] = aLinkDestination; +} sal_Int32 PDFExtOutDevData::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateDest ); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 969bc51b3cac..2b7d66e9837c 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -430,6 +430,10 @@ sal_Int32 PDFWriter::CreateLink( const Rectangle& rRect, sal_Int32 nPageNr ) { return ((PDFWriterImpl*)pImplementation)->createLink( rRect, nPageNr ); } +sal_Int32 PDFWriter::RegisterDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType ) +{ + return ((PDFWriterImpl*)pImplementation)->registerDestReference( nDestId, rRect, nPageNr, eType ); +} //--->i56629 sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 5d75c829da8a..add3aebb270d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5569,7 +5569,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if(!m_bIsPDF_A1) { OStringBuffer aDest; - if( rWidget.m_nDest != -1 && appendDest( rWidget.m_nDest, aDest ) ) + if( rWidget.m_nDest != -1 && appendDest( m_aDestinationIdTranslation[ rWidget.m_nDest ], aDest ) ) { aLine.append( "/AA<= (sal_Int32)m_aLinks.size() ) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 9457aea5f0c2..d21fca75be4f 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -612,6 +612,9 @@ private: dest id is always the dest's position in this vector */ std::vector m_aDests; + /** contains destinations accessible via a public Id, instead of being linked to by an ordinary link + */ + ::std::map< sal_Int32, sal_Int32 > m_aDestinationIdTranslation; /* contains all links ever set during PDF creation, link id is always the link's position in this vector */ @@ -1326,6 +1329,7 @@ public: // links sal_Int32 createLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); sal_Int32 createDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + sal_Int32 registerDestReference( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); sal_Int32 setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); sal_Int32 setLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL ); void setLinkPropertyId( sal_Int32 nLinkId, sal_Int32 nPropertyId ); -- cgit From 310424305e9fc3ff81b9c9c789dff5df3717e53e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- sd/source/ui/unoidl/unomodel.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index e11f76a64baa..722f83f09fe9 100755 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2111,7 +2111,12 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r { sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc ); if ( nPage != -1 ) - pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) ); + { + if ( aIBeg->nLinkId != -1 ) + pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) ); + else + pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::FitRectangle ); + } else pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark ); aIBeg++; -- cgit From 24984aa7a473b53daea4c8b077dc82d79c2b6f10 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- sc/source/ui/unoobj/docuno.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 86a8b4d42530..87153b033788 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1262,7 +1262,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec } if ( nPage >= 0 ) - pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) ); + { + if ( aIter->nLinkId != -1 ) + pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) ); + else + pPDFData->DescribeRegisteredDest( aIter->nDestId, aArea, nPage ); + } } } else -- cgit From 9c3733f6d9da44295996e85187c658fce0f056ac Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 09:57:05 +0100 Subject: dba34b: #i113555# when a button's URL points to a document-local target, properly export this to PDF --- sw/source/core/text/EnhancedPDFExportHelper.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 09c13b8fb250..3c9c4339519b 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -2106,12 +2106,18 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() if ( -1 != nDestPageNum ) { - // Destination Export - const sal_Int32 nDestId = - pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum ); + if ( aIBeg->nLinkId != -1 ) + { + // Destination Export + const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest( rDestRect.SVRect(), nDestPageNum ); - // Connect Link and Destination: - pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId ); + // Connect Link and Destination: + pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, nDestId ); + } + else + { + pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, rDestRect.SVRect(), nDestPageNum ); + } } } else -- cgit From 39345c3f8efa8c33b7f3655bc9a854daf9cc6928 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 1 Dec 2010 12:39:33 +0100 Subject: dba34c: #i114595# don't ask for the Selection control if it doesn't exist --- sfx2/source/dialog/filedlghelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 02b9003f59d2..91f1afacf1a4 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1564,7 +1564,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the item should remain only if it was set by the dialog rpSet->ClearItem( SID_SELECTION ); - if( mbExport ) + if( mbExport && mbHasSelectionBox ) { try { -- cgit From a2fc7d32332e20a3c16836c8362f79b76033bbfd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 2 Dec 2010 09:10:32 +0100 Subject: dba34b: draw cell text in the table designer vertically centered, to prevent jumping of the text when the cell is activated --- dbaccess/source/ui/tabledesign/TEditControl.cxx | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 4d3cdb6652a9..7cbff13154ed 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -443,20 +443,14 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const { DBG_CHKTHIS(OTableEditorCtrl,NULL); - String aText( GetCellText( m_nCurrentPos, nColumnId )); - Point aPos(rRect.TopLeft()); - Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight()); - - if (aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() || - aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom()) - rDev.SetClipRegion( rRect ); - - rDev.DrawText(aPos, aText); - - if (rDev.IsClipRegion()) - rDev.SetClipRegion(); -// rDev.DrawText(rRect.TopLeft(), aText); -// rDev.SetClipRegion( ); + const String aText( GetCellText( m_nCurrentPos, nColumnId )); + const Point aPos(rRect.TopLeft()); + const Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight()); + + rDev.Push( PUSH_CLIPREGION ); + rDev.SetClipRegion( rRect ); + rDev.DrawText( rRect, aText, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER ); + rDev.Pop(); } //------------------------------------------------------------------------------ -- cgit From f9a37be30cbb23c941f519c92ed2de6f9a44f924 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 2 Dec 2010 11:11:43 +0100 Subject: dba34c: #i77025# don't allow closign the app window when a wizard is running --- dbaccess/source/ui/app/AppController.cxx | 98 ++++++++++------- dbaccess/source/ui/app/closeveto.cxx | 180 +++++++++++++++++++++++++++++++ dbaccess/source/ui/app/closeveto.hxx | 67 ++++++++++++ dbaccess/source/ui/app/makefile.mk | 3 +- 4 files changed, 311 insertions(+), 37 deletions(-) create mode 100755 dbaccess/source/ui/app/closeveto.cxx create mode 100755 dbaccess/source/ui/app/closeveto.hxx diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index d75272e796a4..263214125f59 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -32,6 +32,7 @@ #include "dbustrings.hrc" #include "advancedsettingsdlg.hxx" #include "subcomponentmanager.hxx" +#include "closeveto.hxx" /** === begin UNO includes === **/ #include @@ -1953,6 +1954,9 @@ IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType ) // ----------------------------------------------------------------------------- void OApplicationController::newElementWithPilot( ElementType _eType ) { + CloseVeto aKeepDoc( getFrame() ); + // prevent the document being closed while the wizard is open + OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" ); switch ( _eType ) @@ -2714,61 +2718,83 @@ void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); - Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY ); - if ( !xOfficeDoc.is() && _rxModel.is() ) + const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY ); + const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY ); + if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() ) { DBG_ERROR( "OApplicationController::attachModel: invalid model!" ); return sal_False; } - DBG_ASSERT( !( m_xModel.is() && ( m_xModel != _rxModel ) ), - "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" ); - // at least: remove as property change listener from the old model/data source + if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) ) + { + OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" ); + // we'd need to completely update our view here, close sub components, and the like + return sal_False; + } + + const ::rtl::OUString aPropertyNames[] = + { + PROPERTY_URL, PROPERTY_USER + }; + + // disconnect from old model + try + { + if ( m_xDataSource.is() ) + { + for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + { + m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this ); + } + } + + Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY ); + if ( xBroadcaster.is() ) + xBroadcaster->removeModifyListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } m_xModel = _rxModel; - if ( m_xModel.is() ) + m_xDocumentModify = xDocModify; + m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY ); + + // connect to new model + try { - m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW ); + if ( m_xDataSource.is() ) + { + for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + { + m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this ); + } + } + + Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW ); + xBroadcaster->addModifyListener( this ); + } - else + catch( const Exception& ) { - m_xDocumentModify.clear(); + DBG_UNHANDLED_EXCEPTION(); } - m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference(),UNO_QUERY); + // initial preview mode if ( m_xDataSource.is() ) { try { - m_xDataSource->addPropertyChangeListener(PROPERTY_INFO, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_URL, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_TABLEFILTER, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_TABLETYPEFILTER, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_USER, this); // to get the 'modified' for the data source - Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY); - if ( xBroadcaster.is() ) - xBroadcaster->addModifyListener(static_cast(this)); - - Sequence aFields; - m_xDataSource->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aFields; - PropertyValue *pIter = aFields.getArray(); - PropertyValue *pEnd = pIter + aFields.getLength(); - for (; pIter != pEnd && pIter->Name != INFO_PREVIEW; ++pIter) - ; - - if ( pIter != pEnd ) + ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); + if ( aLayoutInfo.has( (rtl::OUString)INFO_PREVIEW ) ) { - sal_Int32 nValue = 0; - pIter->Value >>= nValue; - m_ePreviewMode = static_cast(nValue); + const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( (rtl::OUString)INFO_PREVIEW, (sal_Int32)0 ) ); + m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); if ( getView() ) - { - getContainer()->switchPreview(m_ePreviewMode); - } + getContainer()->switchPreview( m_ePreviewMode ); } } catch( const Exception& ) diff --git a/dbaccess/source/ui/app/closeveto.cxx b/dbaccess/source/ui/app/closeveto.cxx new file mode 100755 index 000000000000..558df26b643e --- /dev/null +++ b/dbaccess/source/ui/app/closeveto.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_dbaccess.hxx" + +#include "closeveto.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include +#include +#include + +//...................................................................................................................... +namespace dbaui +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::util::XCloseable; + using ::com::sun::star::util::XCloseListener; + using ::com::sun::star::util::CloseVetoException; + using ::com::sun::star::lang::EventObject; + /** === end UNO using === **/ + + //================================================================================================================== + //= CloseListener_Impl + //================================================================================================================== + typedef ::cppu::WeakImplHelper1 < XCloseListener + > CloseListener_Base; + class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base + { + public: + CloseListener_Impl() + :m_bHasOwnership( false ) + { + } + + // XCloseListener + virtual void SAL_CALL queryClosing( const EventObject& Source, ::sal_Bool GetsOwnership ) throw (CloseVetoException, RuntimeException); + virtual void SAL_CALL notifyClosing( const EventObject& Source ) throw (RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const EventObject& Source) throw (RuntimeException); + + bool hasOwnership() const { return m_bHasOwnership; } + + protected: + ~CloseListener_Impl() + { + } + + private: + bool m_bHasOwnership; + }; + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::queryClosing( const EventObject& i_source, ::sal_Bool i_deliverOwnership ) throw (CloseVetoException, RuntimeException) + { + (void)i_source; + + if ( !m_bHasOwnership ) + m_bHasOwnership = i_deliverOwnership; + + throw CloseVetoException(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::notifyClosing( const EventObject& i_source ) throw (RuntimeException) + { + (void)i_source; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::disposing( const EventObject& i_source ) throw (RuntimeException) + { + (void)i_source; + } + + //================================================================================================================== + //= CloseVeto_Data + //================================================================================================================== + struct DBACCESS_DLLPRIVATE CloseVeto_Data + { + Reference< XCloseable > xCloseable; + ::rtl::Reference< CloseListener_Impl > pListener; + }; + + //================================================================================================================== + //= operations + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable ) + { + i_data.xCloseable.set( i_closeable, UNO_QUERY ); + ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" ); + + i_data.pListener = new CloseListener_Impl; + i_data.xCloseable->addCloseListener( i_data.pListener.get() ); + } + + //-------------------------------------------------------------------------------------------------------------- + void lcl_deinit( CloseVeto_Data& i_data ) + { + if ( !i_data.xCloseable.is() ) + return; + + i_data.xCloseable->removeCloseListener( i_data.pListener.get() ); + if ( i_data.pListener->hasOwnership() ) + { + try + { + i_data.xCloseable->close( sal_True ); + } + catch( const CloseVetoException& ) { } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + //================================================================================================================== + //= CloseVeto + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable ) + :m_pData( new CloseVeto_Data ) + { + lcl_init( *m_pData, i_closeable ); + } + + //------------------------------------------------------------------------------------------------------------------ + CloseVeto::~CloseVeto() + { + lcl_deinit( *m_pData ); + } + +//...................................................................................................................... +} // namespace dbaui +//...................................................................................................................... diff --git a/dbaccess/source/ui/app/closeveto.hxx b/dbaccess/source/ui/app/closeveto.hxx new file mode 100755 index 000000000000..f7e1c83644d1 --- /dev/null +++ b/dbaccess/source/ui/app/closeveto.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef DBACCESS_CLOSEVETO_HXX +#define DBACCESS_CLOSEVETO_HXX + +#include "dbaccessdllapi.h" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace dbaui +{ +//...................................................................................................................... + + //================================================================================================================== + //= CloseVeto + //================================================================================================================== + struct CloseVeto_Data; + /** will add a XCloseListener to a given component, and veto its closing as long as the CloseVeto + instance is alive. + + If closing has been requested and vetoed while the CloseVeto instance is alive, and the ownership + went to the CloseVeto instance, then it will close the component in its dtor. + */ + class DBACCESS_DLLPRIVATE CloseVeto + { + public: + CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable ); + ~CloseVeto(); + + private: + ::boost::scoped_ptr< CloseVeto_Data > m_pData; + }; + +//...................................................................................................................... +} // namespace dbaui +//...................................................................................................................... + +#endif // DBACCESS_CLOSEVETO_HXX diff --git a/dbaccess/source/ui/app/makefile.mk b/dbaccess/source/ui/app/makefile.mk index a7097b4330e1..e26927d99628 100644 --- a/dbaccess/source/ui/app/makefile.mk +++ b/dbaccess/source/ui/app/makefile.mk @@ -48,7 +48,8 @@ EXCEPTIONSFILES=\ $(SLO)$/AppSwapWindow.obj \ $(SLO)$/AppTitleWindow.obj \ $(SLO)$/AppView.obj \ - $(SLO)$/subcomponentmanager.obj + $(SLO)$/subcomponentmanager.obj \ + $(SLO)$/closeveto.obj SLOFILES =\ -- cgit From 1ae17f5b03cc14844fb600ca3573a96deb37ab3b Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 13:16:48 +0100 Subject: dba34c: #i102625# only fetch rows when the view moves outside the scope of the rowset window --- dbaccess/source/core/api/CacheSet.cxx | 14 +++++++ dbaccess/source/core/api/CacheSet.hxx | 3 ++ dbaccess/source/core/api/KeySet.cxx | 39 ++++++++++++++++--- dbaccess/source/core/api/KeySet.hxx | 5 +++ dbaccess/source/core/api/RowSetCache.cxx | 67 ++++++++++++++++++-------------- dbaccess/source/ui/inc/dbu_qry.hrc | 4 +- dbaccess/source/ui/querydesign/query.src | 8 ---- 7 files changed, 96 insertions(+), 44 deletions(-) diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 783c93f56593..1c21ed2dbfa0 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -691,6 +691,20 @@ sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException) m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->previous(); } +sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/) +{ + return last(); +} +// ------------------------------------------------------------------------- +sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ ) +{ + return previous(); +} +// ------------------------------------------------------------------------- +sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ ) +{ + return absolute(row); +} // ------------------------------------------------------------------------- void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException) { diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index 70905c444610..f4486239e540 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -174,6 +174,9 @@ namespace dbaccess virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow); virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector& i_aChangedColumns); virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const; + virtual sal_Bool previous_checked( sal_Bool i_bFetchRow ); + virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ); + virtual sal_Bool last_checked( sal_Bool i_bFetchRow); }; } #endif //DBACCESS_CORE_API_CACHESET_HXX diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 8df84766575c..932314b72fbe 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1167,6 +1167,12 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row if(m_aKeyIter == m_aKeyMap.end() && !fetchRow()) m_aKeyIter = m_aKeyMap.end(); + else + { + //m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get()); + m_xRow.set(m_xDriverRow,UNO_QUERY_THROW); + return !isAfterLast(); + } } else if(!isAfterLast()) ++m_aKeyIter; @@ -1240,13 +1246,19 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last" ); + return last_checked(sal_True); +} + +sal_Bool OKeySet::last_checked( sal_Bool i_bFetchRow) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last_checked" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aKeyIter = m_aKeyMap.end(); --m_aKeyIter; - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } // ----------------------------------------------------------------------------- @@ -1260,6 +1272,10 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + return absolute_checked(row,sal_True); +} +sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; @@ -1281,6 +1297,11 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime sal_Bool bNext = sal_True; for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i) bNext = fetchRow(); + if ( bNext ) + { + m_xRow.set(m_xDriverRow,UNO_QUERY_THROW); + return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); + } } else m_aKeyIter = m_aKeyMap.end(); @@ -1292,7 +1313,8 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime ++m_aKeyIter; } } - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } @@ -1308,17 +1330,24 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim return absolute(getRow()+rows); } // ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) +sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(m_aKeyIter != m_aKeyMap.begin()) { --m_aKeyIter; - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); } return m_aKeyIter != m_aKeyMap.begin(); } +// ----------------------------------------------------------------------------- +sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) +{ + return previous_checked(sal_True); +} + // ----------------------------------------------------------------------------- void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 597f659f1d94..c002288bd9de 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -228,6 +228,11 @@ namespace dbaccess virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + + virtual sal_Bool previous_checked( sal_Bool i_bFetchRow ); + virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ); + virtual sal_Bool last_checked( sal_Bool i_bFetchRow); }; } #endif // DBACCESS_CORE_API_KEYSET_HXX diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 0ca34e11b66b..1380c436ff0e 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -441,6 +441,13 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize) m_nStartPos = 0; m_nEndPos = _nSize; } + else if (m_nStartPos < m_nPosition && m_nPosition < m_nEndPos) + { + sal_Int32 nNewSt = -1; + fillMatrix(nNewSt,_nSize+1); + m_nStartPos = 0; + m_nEndPos = _nSize; + } } // ------------------------------------------------------------------------- @@ -654,34 +661,26 @@ sal_Bool ORowSetCache::next( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isBeforeFirst( ) { - // return !m_nPosition; - return m_bBeforeFirst; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isAfterLast( ) { - return m_bAfterLast; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isFirst( ) { - return m_nPosition == 1; // ask resultset for } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::isLast( ) { - // return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast(); - return m_nPosition == m_nRowCount; } // ------------------------------------------------------------------------- sal_Bool ORowSetCache::beforeFirst( ) { - - if(!m_bBeforeFirst) { m_bAfterLast = sal_False; @@ -696,8 +695,6 @@ sal_Bool ORowSetCache::beforeFirst( ) // ------------------------------------------------------------------------- sal_Bool ORowSetCache::afterLast( ) { - - if(!m_bAfterLast) { m_bBeforeFirst = sal_False; @@ -705,7 +702,7 @@ sal_Bool ORowSetCache::afterLast( ) if(!m_bRowCountFinal) { - m_pCacheSet->last(); + m_pCacheSet->last_checked(sal_False); m_bRowCountFinal = sal_True; m_nRowCount = m_pCacheSet->getRow();// + 1 removed } @@ -721,10 +718,22 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos { OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!"); // fill the whole window with new data - ORowSetMatrix::iterator aIter = m_pMatrix->begin(); - sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to + ORowSetMatrix::iterator aIter; + sal_Int32 i; + sal_Bool bCheck; + if ( _nNewStartPos == -1 ) + { + aIter = m_pMatrix->begin() + m_nEndPos; + i = m_nEndPos+1; + } + else + { + aIter = m_pMatrix->begin(); + i = _nNewStartPos; + } + bCheck = m_pCacheSet->absolute(i); // -1 no need to + - sal_Int32 i=_nNewStartPos; for(;i<_nNewEndPos;++i,++aIter) { if(bCheck) @@ -738,7 +747,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if(!m_bRowCountFinal) { - if(m_pCacheSet->previous()) // because we stand after the last row + if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row m_nRowCount = m_pCacheSet->getRow(); // here we have the row count if(!m_nRowCount) m_nRowCount = i-1; // it can be that getRow return zero @@ -767,16 +776,18 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos } break; } - bCheck = m_pCacheSet->next(); + if ( i < (_nNewEndPos-1) ) + bCheck = m_pCacheSet->next(); } // m_nStartPos = _nNewStartPos; - // we have to read one row forward to enshure that we know when we are on last row + // we have to read one row forward to ensure that we know when we are on last row // but only when we don't know it already + /* if(!m_bRowCountFinal) { if(!m_pCacheSet->next()) { - if(m_pCacheSet->previous()) // because we stand after the last row + if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row m_nRowCount = m_pCacheSet->getRow(); // here we have the row count m_bRowCountFinal = sal_True; } @@ -784,6 +795,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos m_nRowCount = std::max(i,m_nRowCount); } + */ return bCheck; } // ------------------------------------------------------------------------- @@ -921,19 +933,16 @@ sal_Bool ORowSetCache::moveWindow() // but only when we don't know it already if ( !m_bRowCountFinal ) { - bOk = m_pCacheSet->absolute( m_nPosition + 1 ); + bOk = m_pCacheSet->absolute_checked( m_nPosition + 1,sal_False ); if ( bOk ) m_nRowCount = std::max(sal_Int32(m_nPosition+1),m_nRowCount); } } - if(!bOk) + if(!bOk && !m_bRowCountFinal) { - if(!m_bRowCountFinal) - { - // because we stand after the last row - m_nRowCount = m_pCacheSet->previous() ? m_pCacheSet->getRow() : 0;// + 1 removed - m_bRowCountFinal = sal_True; - } + // because we stand after the last row + m_nRowCount = m_pCacheSet->previous_checked(sal_False) ? m_pCacheSet->getRow() : 0;// + 1 removed + m_bRowCountFinal = sal_True; } } } @@ -967,7 +976,7 @@ sal_Bool ORowSetCache::moveWindow() // now I can say how many rows we have if(!bOk) { - m_pCacheSet->previous(); // because we stand after the last row + m_pCacheSet->previous_checked(sal_False); // because we stand after the last row m_nRowCount = nPos; // here we have the row count m_bRowCountFinal = sal_True; } @@ -985,7 +994,7 @@ sal_Bool ORowSetCache::moveWindow() if ( !m_bRowCountFinal ) { - m_pCacheSet->previous(); // because we stand after the last row + m_pCacheSet->previous_checked(sal_False); // because we stand after the last row m_nRowCount = std::max(m_nRowCount,--nPos); // here we have the row count OSL_ENSURE(nPos == m_pCacheSet->getRow(),"nPos isn't valid!"); m_bRowCountFinal = sal_True; @@ -1001,7 +1010,7 @@ sal_Bool ORowSetCache::moveWindow() aIter = m_pMatrix->begin(); nPos = m_nStartPos; - bCheck = m_pCacheSet->absolute(m_nStartPos); + bCheck = m_pCacheSet->absolute_checked(m_nStartPos,sal_False); for(; !aIter->isValid() && bCheck;++aIter) { OSL_ENSURE(aIter != m_pMatrix->end(),"Invalid iterator"); diff --git a/dbaccess/source/ui/inc/dbu_qry.hrc b/dbaccess/source/ui/inc/dbu_qry.hrc index 26bd4c82b374..bf09f2356de4 100644 --- a/dbaccess/source/ui/inc/dbu_qry.hrc +++ b/dbaccess/source/ui/inc/dbu_qry.hrc @@ -56,8 +56,8 @@ #define STR_QUERY_NOTABLE RID_STR_QRY_START + 21 #define STR_QRY_ORDERBY_UNRELATED RID_STR_QRY_START + 22 #define STR_QUERY_HANDLETEXT RID_STR_QRY_START + 23 -#define STR_QUERY_FALSE RID_STR_QRY_START + 24 -#define STR_QUERY_TRUE RID_STR_QRY_START + 25 +// free +// free #define STR_QRY_TOO_MANY_COLUMNS RID_STR_QRY_START + 26 #define STR_SVT_SQL_SYNTAX_ERROR RID_STR_QRY_START + 27 #define STR_QUERYDESIGN_NO_VIEW_SUPPORT RID_STR_QRY_START + 28 diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src index d8a2162e1d14..01e4182e72ff 100644 --- a/dbaccess/source/ui/querydesign/query.src +++ b/dbaccess/source/ui/querydesign/query.src @@ -281,14 +281,6 @@ ErrorBox ERR_QRY_ORDERBY_ON_ASTERISK { Message [ en-US ] = "[*] cannot be used as a sort criterion."; }; -String STR_QUERY_TRUE -{ - Text [ en-US ] = "TRUE" ; -}; -String STR_QUERY_FALSE -{ - Text [ en-US ] = "FALSE" ; -}; String STR_QRY_TOO_MANY_TABLES { Text [ en-US ] = "There are too many tables."; -- cgit From 6697a4827b4dd0aee507840c4c1ebf6e19186282 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 13:16:48 +0100 Subject: dba34c: #i102625# only fetch rows when the view moves outside the scope of the rowset window --- forms/source/component/DatabaseForm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 154ed4b00272..31f933f136bc 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2905,7 +2905,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs // a database form always uses caching // we use starting fetchsize with at least 10 rows if (bConnected) - m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10)); + m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40)); // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded" // so we don't need to execute the statement again, this was already done -- cgit From 2e082fe92cc64f6abee53440be67ff39bc83e433 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 2 Dec 2010 14:16:42 +0100 Subject: dba34c: #i115876# --- svx/source/form/fmobj.cxx | 4 +++- svx/source/form/fmpgeimp.cxx | 33 ++++++++++++++++++++++++++++----- svx/source/inc/fmpgeimp.hxx | 1 + 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index e679779887a2..ba2fba4f40f3 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -650,7 +650,9 @@ void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XContr { SdrUnoObj::SetUnoControlModel( _rxModel ); - // TODO: call something like formObjectInserted at the form page, to tell it the new model + FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetPage() ); + if ( pFormPage ) + pFormPage->GetImpl().formModelAssigned( *this ); impl_checkRefDevice_nothrow( true ); } diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 3ade4bdd3091..ceafd55566e2 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -275,7 +275,7 @@ namespace _map->put( makeAny( xControlModel ), makeAny( xControlShape ) ); } - static void lcl_removeFormObject( const FmFormObj& _object, const Reference< XMap >& _map ) + static void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map, bool i_ignoreNonExistence = false ) { // the control model Reference< XControlModel > xControlModel( _object.GetUnoControlModel(), UNO_QUERY ); @@ -287,8 +287,11 @@ namespace Any aOldAssignment = #endif _map->remove( makeAny( xControlModel ) ); - OSL_ENSURE( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ), - "lcl_removeFormObject: map was inconsistent!" ); + (void)aOldAssignment; + OSL_ENSURE( !i_ignoreNonExistence || + ( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ) ), + "lcl_removeFormObject: map was inconsistent!" ); + (void)i_ignoreNonExistence; } } @@ -703,7 +706,26 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource( return sName; } -//------------------------------------------------------------------ +//---------------------------------------------------------------------------------------------------------------------- +void FmFormPageImpl::formModelAssigned( const FmFormObj& _object ) +{ + Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY ); + if ( !xControlShapeMap.is() ) + // our map does not exist -> not interested in this event + return; + + try + { + lcl_removeFormObject_throw( _object, xControlShapeMap, false ); + lcl_insertFormObject_throw( _object, xControlShapeMap ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//---------------------------------------------------------------------------------------------------------------------- void FmFormPageImpl::formObjectInserted( const FmFormObj& _object ) { Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY ); @@ -721,6 +743,7 @@ void FmFormPageImpl::formObjectInserted( const FmFormObj& _object ) } } +//---------------------------------------------------------------------------------------------------------------------- void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object ) { Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY ); @@ -730,7 +753,7 @@ void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object ) try { - lcl_removeFormObject( _object, xControlShapeMap ); + lcl_removeFormObject_throw( _object, xControlShapeMap ); } catch( const Exception& ) { diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx index 755c754853dc..d5061af70bdf 100644 --- a/svx/source/inc/fmpgeimp.hxx +++ b/svx/source/inc/fmpgeimp.hxx @@ -135,6 +135,7 @@ public: void formObjectInserted( const FmFormObj& _object ); void formObjectRemoved( const FmFormObj& _object ); + void formModelAssigned( const FmFormObj& _object ); /** returns an object mapping from control models to drawing shapes. */ -- cgit From b8cfdece629a509bd668a9b6196a839518551cfd Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 14:18:45 +0100 Subject: dba34c: #i99979# check if international --- connectivity/source/parse/sqlnode.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index b8bcd5334787..f9f348592a6f 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -2467,7 +2467,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode if (rString.getLength()) rString.appendAscii(" "); - const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext); + const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL); rString.append(::rtl::OUString(sT,sT.getLength(),RTL_TEXTENCODING_UTF8)); } break; case SQL_NODE_STRING: -- cgit From f43f0131fae5fc74680fceeef1ef26a3dd631201 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 14:39:01 +0100 Subject: dba34c: #i103425# allow datediff with 2 args as well --- connectivity/source/parse/sqlbison.y | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 9709d33fdf76..947da78b8f62 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -271,7 +271,7 @@ using namespace connectivity; %type form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist %type /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source %type function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument -%type date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument date_function_3Argument +%type date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument %type all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/ %type /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist %type column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement @@ -1851,10 +1851,10 @@ function_name12: ; function_name23: SQL_TOKEN_LOCATE + | SQL_TOKEN_DATEDIFF ; function_name3: string_function_3Argument - | date_function_3Argument ; function_name: string_function @@ -1912,8 +1912,6 @@ date_function_1Argument: | SQL_TOKEN_TIMEVALUE | SQL_TOKEN_DATEVALUE ; -date_function_3Argument: - SQL_TOKEN_DATEDIFF date_function: SQL_TOKEN_TIMESTAMPADD -- cgit From a785deda745a1d77187d9f83d7448015a91e67d1 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 14:54:34 +0100 Subject: dba34c: #i104351# fix name of dialog to correspond to menu entry --- dbaccess/source/ui/app/app.src | 6 +++--- dbaccess/source/ui/dlg/advancedsettings.src | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src index 4af2bdb70521..529e6ac55009 100644 --- a/dbaccess/source/ui/app/app.src +++ b/dbaccess/source/ui/app/app.src @@ -261,19 +261,19 @@ Menu RID_MENU_APP_EDIT MenuItem { Identifier = SID_DB_APP_DSPROPS; - Text[ en-US ] = "Properties"; + Text[ en-US ] = "Properties..."; Command = ".uno:DBDSProperties"; }; MenuItem { Identifier = SID_DB_APP_DSCONNECTION_TYPE; - Text[ en-US ] = "Connection Type"; + Text[ en-US ] = "Connection Type..."; Command = ".uno:DBDSConnectionType"; }; MenuItem { Identifier = SID_DB_APP_DSADVANCED_SETTINGS; - Text[ en-US ] = "Advanced Settings"; + Text[ en-US ] = "Advanced Settings..."; Command = ".uno:DBDSAdvancedSettings"; }; }; diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index 6d144890b415..f30b451025aa 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -383,5 +383,5 @@ TabDialog DLG_DATABASE_ADVANCED Text [ en-US ] = "Special Settings"; }; - Text [ en-US ] = "Advanced Properties" ; + Text [ en-US ] = "Advanced Settings" ; }; -- cgit From 3ae1e51873cf2cd2a56edceda14e702a806f68c8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 2 Dec 2010 15:29:46 +0100 Subject: dba34c: spelling --- sfx2/source/control/unoctitm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index e53f1766b7b9..90aaeca680cc 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -131,7 +131,7 @@ void SfxUnoControllerItem::UnBind() void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - DBG_ASSERT( pCtrlItem, "Dispatch hat den StatusListener nicht entfern!" ); + DBG_ASSERT( pCtrlItem, "dispatch implementation didn't respect our previous removeStatusListener call!" ); if ( rEvent.Requery ) { -- cgit From ea6c7c0d73e7d898d6e4759cb33997b7a48d2bd7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 2 Dec 2010 15:29:46 +0100 Subject: dba34c: FmFormPageImpl needs late init, else the 'copy-ctor' crashs after the previous change --- svx/source/form/fmpage.cxx | 5 ++++- svx/source/form/fmpgeimp.cxx | 13 +++++-------- svx/source/inc/fmpgeimp.hxx | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index 0a5c7da9ea3c..94c6e80dcc07 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -105,12 +105,15 @@ FmFormPage::FmFormPage(FmFormModel& rModel, StarBASIC* _pBasic, FASTBOOL bMaster FmFormPage::FmFormPage(const FmFormPage& rPage) :SdrPage(rPage) #ifndef SVX_LIGHT - ,m_pImpl(new FmFormPageImpl( *this, rPage.GetImpl() ) ) + ,m_pImpl(new FmFormPageImpl( *this ) ) #else ,m_pImpl(NULL) #endif ,m_pBasic(0) { +#ifndef SVX_LIGHT + m_pImpl->initFrom( rPage.GetImpl() ); +#endif RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::FmFormPage" ); m_sPageName = rPage.m_sPageName; } diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index ceafd55566e2..ec612e2ea782 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -167,19 +167,16 @@ namespace } //------------------------------------------------------------------------------ -FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl ) - :m_rPage( _rPage ) - ,m_bFirstActivation( sal_True ) - ,m_bAttemptedFormCreation( false ) +void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl ) { DBG_CTOR(FmFormPageImpl,NULL); // clone the Forms collection - Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( rImpl ).getForms( false ), UNO_QUERY ); + Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ), UNO_QUERY ); if ( !xCloneable.is() ) { // great, nothing to do - OSL_ENSURE( !const_cast< FmFormPageImpl& >( rImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" ); + OSL_ENSURE( !const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" ); return; } try @@ -196,7 +193,7 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl aVisitor.process( FormComponentPair( xCloneable, m_xForms ), aAssignmentProcessor ); // assign the cloned models to their SdrObjects - SdrObjListIter aForeignIter( rImpl.m_rPage ); + SdrObjListIter aForeignIter( i_foreignImpl.m_rPage ); SdrObjListIter aOwnIter( m_rPage ); OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" ); @@ -230,7 +227,7 @@ FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel ); OSL_ENSURE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" ); if ( assignment == aModelAssignment.end() ) - // the source SdrObject has a model, but it is not part of the model hierarchy in rImpl.getForms(). + // the source SdrObject has a model, but it is not part of the model hierarchy in i_foreignImpl.getForms(). // Pathological, too ... continue; diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx index d5061af70bdf..9eb91c809d66 100644 --- a/svx/source/inc/fmpgeimp.hxx +++ b/svx/source/inc/fmpgeimp.hxx @@ -81,9 +81,10 @@ protected: public: FmFormPageImpl( FmFormPage& _rPage ); - FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl ); ~FmFormPageImpl(); + void initFrom( FmFormPageImpl& i_foreignImpl ); + // nur wichtig fuer den DesignMode void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm); ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm(); -- cgit From 9fb23bfdf0dbff9f08a445a460284454a39936f0 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 2 Dec 2010 19:34:20 +0100 Subject: dr78: #i51508# use the correct MapMode for EditEngine when formatting for screen --- sc/inc/document.hxx | 4 ++- sc/source/core/data/column2.cxx | 27 ++++++++++++----- sc/source/core/data/documen2.cxx | 19 ++++-------- sc/source/core/data/documen9.cxx | 7 +++++ sc/source/ui/app/inputhdl.cxx | 11 +++++-- sc/source/ui/inc/output.hxx | 3 ++ sc/source/ui/view/output2.cxx | 63 ++++++++++++++-------------------------- sc/source/ui/view/printfun.cxx | 6 ++-- 8 files changed, 72 insertions(+), 68 deletions(-) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index bd4770177ae4..b68585f27a8e 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -119,6 +119,7 @@ class ScViewOptions; class ScStrCollection; class TypedScStrCollection; class ScChangeTrack; +class ScEditEngineDefaulter; class ScFieldEditEngine; class ScNoteEditEngine; struct ScConsolidateParam; @@ -1576,6 +1577,8 @@ public: BOOL IsValidAsianKerning() const; void SetAsianKerning(BOOL bNew); + void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine); + BYTE GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;} @@ -1770,7 +1773,6 @@ public: SC_DLLPUBLIC SfxItemPool* GetEnginePool() const; SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine(); SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine(); -//UNUSED2009-05 SfxItemPool& GetNoteItemPool(); ScRefreshTimerControl* GetRefreshTimerControl() const { return pRefreshTimerControl; } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 2adf6d926f0f..71e89c9d3b10 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -427,12 +427,17 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev, ScFieldEditEngine* pEngine = pDocument->CreateFieldEditEngine(); pEngine->SetUpdateMode( FALSE ); + BOOL bTextWysiwyg = ( pDev->GetOutDevType() == OUTDEV_PRINTER ); + ULONG nCtrl = pEngine->GetControlWord(); + if ( bTextWysiwyg ) + nCtrl |= EE_CNTRL_FORMAT100; + else + nCtrl &= ~EE_CNTRL_FORMAT100; + pEngine->SetControlWord( nCtrl ); MapMode aOld = pDev->GetMapMode(); pDev->SetMapMode( aHMMMode ); pEngine->SetRefDevice( pDev ); - pEngine->SetForbiddenCharsTable( pDocument->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDocument->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDocument->GetAsianKerning() ); + pDocument->ApplyAsianEditSettings( *pEngine ); SfxItemSet* pSet = new SfxItemSet( pEngine->GetEmptyItemSet() ); pPattern->FillEditItemSet( pSet, pCondSet ); @@ -451,7 +456,6 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev, else if (bBreak) { double fWidthFactor = nPPTX; - BOOL bTextWysiwyg = ( pDev->GetOutDevType() == OUTDEV_PRINTER ); if ( bTextWysiwyg ) { // #95593# if text is formatted for printer, don't use PixelToLogic, @@ -564,6 +568,17 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev, { nValue = pDev->LogicToPixel(Size( 0, pEngine->GetTextHeight() ), aHMMMode).Height(); + + // With non-100% zoom and several lines or paragraphs, don't shrink below the result with FORMAT100 set + if ( !bTextWysiwyg && ( rZoomY.GetNumerator() != 1 || rZoomY.GetDenominator() != 1 ) && + ( pEngine->GetParagraphCount() > 1 || ( bBreak && pEngine->GetLineCount(0) > 1 ) ) ) + { + pEngine->SetControlWord( nCtrl | EE_CNTRL_FORMAT100 ); + pEngine->QuickFormatDoc( sal_True ); + long nSecondValue = pDev->LogicToPixel(Size( 0, pEngine->GetTextHeight() ), aHMMMode).Height(); + if ( nSecondValue > nValue ) + nValue = nSecondValue; + } } if ( nValue && bAddMargin ) @@ -1042,9 +1057,7 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow ) pEngine = new ScFieldEditEngine( pDocument->GetEditPool() ); // EE_CNTRL_ONLINESPELLING falls schon Fehler drin sind pEngine->SetControlWord( pEngine->GetControlWord() | EE_CNTRL_ONLINESPELLING ); - pEngine->SetForbiddenCharsTable( pDocument->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDocument->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDocument->GetAsianKerning() ); + pDocument->ApplyAsianEditSettings( *pEngine ); } pEngine->SetText( *pData ); USHORT nParCount = pEngine->GetParagraphCount(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index d2c99c75a95e..881e90e2c909 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -531,7 +531,7 @@ ScFieldEditEngine& ScDocument::GetEditEngine() pEditEngine->SetUpdateMode( FALSE ); pEditEngine->EnableUndo( FALSE ); pEditEngine->SetRefMapMode( MAP_100TH_MM ); - pEditEngine->SetForbiddenCharsTable( xForbiddenCharacters ); + ApplyAsianEditSettings( *pEditEngine ); } return *pEditEngine; } @@ -544,22 +544,15 @@ ScNoteEditEngine& ScDocument::GetNoteEngine() pNoteEngine->SetUpdateMode( FALSE ); pNoteEngine->EnableUndo( FALSE ); pNoteEngine->SetRefMapMode( MAP_100TH_MM ); - pNoteEngine->SetForbiddenCharsTable( xForbiddenCharacters ); - const SfxItemSet& rItemSet = GetDefPattern()->GetItemSet(); - SfxItemSet* pEEItemSet = new SfxItemSet( pNoteEngine->GetEmptyItemSet() ); - ScPatternAttr::FillToEditItemSet( *pEEItemSet, rItemSet ); - pNoteEngine->SetDefaults( pEEItemSet ); // edit engine takes ownership + ApplyAsianEditSettings( *pNoteEngine ); + const SfxItemSet& rItemSet = GetDefPattern()->GetItemSet(); + SfxItemSet* pEEItemSet = new SfxItemSet( pNoteEngine->GetEmptyItemSet() ); + ScPatternAttr::FillToEditItemSet( *pEEItemSet, rItemSet ); + pNoteEngine->SetDefaults( pEEItemSet ); // edit engine takes ownership } return *pNoteEngine; } -//UNUSED2009-05 SfxItemPool& ScDocument::GetNoteItemPool() -//UNUSED2009-05 { -//UNUSED2009-05 if ( !pNoteItemPool ) -//UNUSED2009-05 pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool()); -//UNUSED2009-05 return *pNoteItemPool; -//UNUSED2009-05 } - void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks ) { if (bIsClip) diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 37b3c830bb30..e330b3fa84f5 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -818,3 +818,10 @@ void ScDocument::SetAsianKerning(BOOL bNew) pDrawLayer->SetKernAsianPunctuation( (BOOL)nAsianKerning ); } +void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter& rEngine ) +{ + rEngine.SetForbiddenCharsTable( xForbiddenCharacters ); + rEngine.SetAsianCompressionMode( GetAsianCompression() ); + rEngine.SetKernAsianPunctuation( GetAsianKerning() ); +} + diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 55aa0986d2ec..fc6e6947f958 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -514,6 +514,13 @@ void ScInputHandler::UpdateRefDevice() return; BOOL bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); + bool bInPlace = pActiveViewSh && pActiveViewSh->GetViewFrame()->GetFrame().IsInPlace(); + ULONG nCtrl = pEngine->GetControlWord(); + if ( bTextWysiwyg || bInPlace ) + nCtrl |= EE_CNTRL_FORMAT100; // EditEngine default: always format for 100% + else + nCtrl &= ~EE_CNTRL_FORMAT100; // when formatting for screen, use the actual MapMode + pEngine->SetControlWord( nCtrl ); if ( bTextWysiwyg && pActiveViewSh ) pEngine->SetRefDevice( pActiveViewSh->GetViewData()->GetDocument()->GetPrinter() ); else @@ -601,9 +608,7 @@ void ScInputHandler::UpdateSpellSettings( BOOL bFromStartTab ) pEngine->SetControlWord(nCntrl); ScDocument* pDoc = pViewData->GetDocument(); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); + pDoc->ApplyAsianEditSettings( *pEngine ); pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)pDoc->GetEditTextDirection( pViewData->GetTabNo() ) ); pEngine->SetFirstWordCapitalization( FALSE ); diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 42844513af92..afb45929fb5a 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -50,6 +50,7 @@ struct ScTableInfo; class ScTabViewShell; class ScPageBreakData; class FmFormView; +class ScFieldEditEngine; // #i74769# SdrPaintWindow predefine class SdrPaintWindow; @@ -182,6 +183,8 @@ private: void DrawRotatedFrame( const Color* pForceColor ); // pixel + ScFieldEditEngine* CreateOutputEditEngine(); + public: ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, ScTableInfo& rTabInfo, ScDocument* pNewDoc, diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 61289cc7f931..8ad645aed14e 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1896,6 +1896,26 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic ) // ------------------------------------------------------------------------------- +ScFieldEditEngine* ScOutputData::CreateOutputEditEngine() +{ + ScFieldEditEngine* pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); + pEngine->SetUpdateMode( FALSE ); + // a RefDevice always has to be set, otherwise EditEngine would create a VirtualDevice + pEngine->SetRefDevice( pFmtDevice ); + ULONG nCtrl = pEngine->GetControlWord(); + if ( bShowSpellErrors ) + nCtrl |= EE_CNTRL_ONLINESPELLING; + if ( eType == OUTTYPE_PRINTER ) + nCtrl &= ~EE_CNTRL_MARKFIELDS; + if ( eType == OUTTYPE_WINDOW && pRefDevice == pFmtDevice ) + nCtrl &= ~EE_CNTRL_FORMAT100; // use the actual MapMode + pEngine->SetControlWord( nCtrl ); + pDoc->ApplyAsianEditSettings( *pEngine ); + pEngine->EnableAutoColor( bUseStyleColor ); + pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); + return pEngine; +} + void lcl_ClearEdit( EditEngine& rEngine ) // Text und Attribute { rEngine.SetUpdateMode( FALSE ); @@ -2212,29 +2232,10 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic) // if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( FALSE ); - pEngine->SetRefDevice( pFmtDevice ); // always set - ULONG nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(FALSE) - BOOL bCellIsValue = lcl_SafeIsValue(pCell); SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) @@ -2276,8 +2277,6 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic) eHorJust = SVX_HOR_JUSTIFY_RIGHT; } - - SvxCellHorJustify eOutHorJust = ( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust : ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT ); @@ -3045,25 +3044,7 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic) if (!bHidden) { if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( FALSE ); - pEngine->SetRefDevice( pFmtDevice ); // always set - ULONG nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(FALSE) diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index fa962a589b77..9f5a3da6966c 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -1720,6 +1720,7 @@ void ScPrintFunc::MakeEditEngine() pEditEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) ); pEditEngine->SetControlWord( pEditEngine->GetControlWord() & ~EE_CNTRL_RTFSTYLESHEETS ); + pDoc->ApplyAsianEditSettings( *pEditEngine ); pEditEngine->EnableAutoColor( bUseStyleColor ); // Default-Set fuer Ausrichtung @@ -2412,9 +2413,8 @@ void ScPrintFunc::SetExclusivelyDrawOleAndDrawObjects() aTableParam.bNotes = false; aTableParam.bGrid = false; aTableParam.bHeaders = false; - aTableParam.bFormulas = false;; - aTableParam.bNullVals = false;; - aTableParam.bNullVals = false;; + aTableParam.bFormulas = false; + aTableParam.bNullVals = false; } // -- cgit From 199fe597e9506cdeec27c444cab9c9fe06177429 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Fri, 3 Dec 2010 09:25:36 +0100 Subject: dba34c: #i115398# add autoincrement to special type --- dbaccess/source/ui/tabledesign/FieldDescriptions.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index bb0231ba30b0..b11a18c8de74 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -629,6 +629,7 @@ TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const *pSpecialType = *m_pType; pSpecialType->nPrecision = GetPrecision(); pSpecialType->nMaximumScale = static_cast(GetScale()); + pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob return pSpecialType; } // ----------------------------------------------------------------------------- -- cgit From 455c3c0ca387adde8aeafe598cb49f730d655bd9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 10:20:34 +0100 Subject: dba34c: #i115880# removed assertion - it does not really indicate a problem, and preventing it otherwise would be unreasonably expensive --- svx/source/form/fmpgeimp.cxx | 34 ++++++++------------- svx/source/svdraw/svdouno.cxx | 71 +++++++++---------------------------------- 2 files changed, 27 insertions(+), 78 deletions(-) diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index ec612e2ea782..a582d97d8d15 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -169,16 +169,16 @@ namespace //------------------------------------------------------------------------------ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl ) { - DBG_CTOR(FmFormPageImpl,NULL); - // clone the Forms collection - Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ), UNO_QUERY ); + const Reference< XNameContainer > xForeignForms( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ) ); + const Reference< XCloneable > xCloneable( xForeignForms, UNO_QUERY ); if ( !xCloneable.is() ) { // great, nothing to do - OSL_ENSURE( !const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" ); + OSL_ENSURE( !xForeignForms.is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" ); return; } + try { m_xForms.set( xCloneable->createClone(), UNO_QUERY_THROW ); @@ -205,31 +205,23 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl ) bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == FmFormInventor ); bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == FmFormInventor ); - if ( bForeignIsForm != bOwnIsForm ) - { - OSL_ENSURE( false, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" ); - // don't attempt to do further assignments, something's completely messed up - break; - } + ENSURE_OR_BREAK( bForeignIsForm == bOwnIsForm, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" ); + // if this fires, don't attempt to do further assignments, something's completely messed up + if ( !bForeignIsForm ) // no form control -> next round continue; Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() ); - OSL_ENSURE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" ); - if ( !xForeignModel.is() ) - // the SdrObject does not have a UNO Control Model. This is pathological, but well ... So the cloned - // SdrObject will also not have a UNO Control Model. - continue; - - OSL_ENSURE( !pOwnObj->GetUnoControlModel().is(), "FmFormPageImpl::FmFormPageImpl: there already is a control model for the target object!" ); + ENSURE_OR_CONTINUE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" ); + // if this fires, the SdrObject does not have a UNO Control Model. This is pathological, but well ... + // So the cloned SdrObject will also not have a UNO Control Model. MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel ); - OSL_ENSURE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" ); - if ( assignment == aModelAssignment.end() ) - // the source SdrObject has a model, but it is not part of the model hierarchy in i_foreignImpl.getForms(). + ENSURE_OR_CONTINUE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" ); + // if this fires, the source SdrObject has a model, but it is not part of the model hierarchy in + // i_foreignImpl.getForms(). // Pathological, too ... - continue; pOwnObj->SetUnoControlModel( assignment->second ); } diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index b98e5ba5c1c6..eeae4d8079a8 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -318,68 +318,25 @@ void SdrUnoObj::operator = (const SdrObject& rObj) SdrRectObj::operator = (rObj); // release the reference to the current control model - SetUnoControlModel(uno::Reference< awt::XControlModel >()); + SetUnoControlModel( NULL ); - aUnoControlModelTypeName = ((SdrUnoObj&) rObj).aUnoControlModelTypeName; - aUnoControlTypeName = ((SdrUnoObj&) rObj).aUnoControlTypeName; + const SdrUnoObj& rUnoObj = dynamic_cast< const SdrUnoObj& >( rObj ); - // copy the uno control model - uno::Reference< awt::XControlModel > xCtrl( ((SdrUnoObj&) rObj).GetUnoControlModel(), uno::UNO_QUERY ); - uno::Reference< util::XCloneable > xClone( xCtrl, uno::UNO_QUERY ); + aUnoControlModelTypeName = rUnoObj.aUnoControlModelTypeName; + aUnoControlTypeName = rUnoObj.aUnoControlTypeName; - if ( xClone.is() ) - { - // copy the model by cloning - uno::Reference< awt::XControlModel > xNewModel( xClone->createClone(), uno::UNO_QUERY ); - DBG_ASSERT( xNewModel.is(), "SdrUnoObj::operator =, no control model!"); - xUnoControlModel = xNewModel; - } - else + // copy the uno control model + const uno::Reference< awt::XControlModel > xSourceControlModel( rUnoObj.GetUnoControlModel(), uno::UNO_QUERY ); + if ( xSourceControlModel.is() ) { - // copy the model by streaming - uno::Reference< io::XPersistObject > xObj( xCtrl, uno::UNO_QUERY ); - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - - if ( xObj.is() && xFactory.is() ) + try { - // creating a pipe - uno::Reference< io::XOutputStream > xOutPipe(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), uno::UNO_QUERY); - uno::Reference< io::XInputStream > xInPipe(xOutPipe, uno::UNO_QUERY); - - // creating the mark streams - uno::Reference< io::XInputStream > xMarkIn(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), uno::UNO_QUERY); - uno::Reference< io::XActiveDataSink > xMarkSink(xMarkIn, uno::UNO_QUERY); - - uno::Reference< io::XOutputStream > xMarkOut(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), uno::UNO_QUERY); - uno::Reference< io::XActiveDataSource > xMarkSource(xMarkOut, uno::UNO_QUERY); - - // connect mark and sink - uno::Reference< io::XActiveDataSink > xSink(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), uno::UNO_QUERY); - - // connect mark and source - uno::Reference< io::XActiveDataSource > xSource(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), uno::UNO_QUERY); - - uno::Reference< io::XObjectOutputStream > xOutStrm(xSource, uno::UNO_QUERY); - uno::Reference< io::XObjectInputStream > xInStrm(xSink, uno::UNO_QUERY); - - if (xMarkSink.is() && xMarkSource.is() && xSink.is() && xSource.is()) - { - xMarkSink->setInputStream(xInPipe); - xMarkSource->setOutputStream(xOutPipe); - xSink->setInputStream(xMarkIn); - xSource->setOutputStream(xMarkOut); - - // write the object to source - xOutStrm->writeObject(xObj); - xOutStrm->closeOutput(); - // read the object - uno::Reference< awt::XControlModel > xModel(xInStrm->readObject(), uno::UNO_QUERY); - xInStrm->closeInput(); - - DBG_ASSERT(xModel.is(), "SdrUnoObj::operator =, keine Model erzeugt"); - - xUnoControlModel = xModel; - } + uno::Reference< util::XCloneable > xClone( xSourceControlModel, uno::UNO_QUERY_THROW ); + xUnoControlModel.set( xClone->createClone(), uno::UNO_QUERY_THROW ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } } -- cgit From fb27484748b468884d640ab754124cd8cc668db7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 14:00:17 +0100 Subject: dba34c: when asserting left-over top windows, also report the Window ptr --- vcl/source/app/svmain.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 4efa2b659e7c..2f82cf61ccec 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -368,7 +368,9 @@ void DeInitVCL() aBuf.append( rtl::OUStringToOString( pWin->GetText(), osl_getThreadTextEncoding() ) ); aBuf.append( "\" type = \"" ); aBuf.append( typeid(*pWin).name() ); - aBuf.append( "\"\n" ); + aBuf.append( "\", ptr = 0x" ); + aBuf.append( sal_Int64( pWin ), 16 ); + aBuf.append( "\n" ); } } DBG_ASSERT( nBadTopWindows==0, aBuf.getStr() ); -- cgit From a9e0f5a1220582e0dac2f6505be70d465f01d055 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 14:27:32 +0100 Subject: dba34c: #i115901#: dispose the local pane's window (after clearing the cache, which will dispose the windows currently anchored to the pane) --- sd/source/ui/framework/factories/BasicViewFactory.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 2dd7689f2b39..b7e5d72b9e6c 100755 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -152,6 +153,20 @@ BasicViewFactory::BasicViewFactory ( BasicViewFactory::~BasicViewFactory (void) { + mpViewCache.reset(); + + Reference< awt::XWindow > xLocalPaneWindow( mxLocalPane->getWindow() ); + try + { + const Reference< XComponent > xLocalPaneComponent( mxLocalPane, UNO_QUERY_THROW ); + xLocalPaneComponent->dispose(); + const Reference< XComponent > xWindowComponent( xLocalPaneWindow, UNO_QUERY_THROW ); + xWindowComponent->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } -- cgit From b4a5fc894e64aeb5c7cd0ddd5efd4c78b55cc883 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 14:29:06 +0100 Subject: dba34c: during #i115901#: do not use an own static WorkWindow, but the Application-provided one, this is ensure to be cleaned up properly upon application termination --- toolkit/source/controls/unocontrol.cxx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 075080906900..9529791db067 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -91,17 +91,6 @@ static const LanguageDependentProp aLanguageDependentProp[] = { 0, 0 } }; -WorkWindow* lcl_GetDefaultWindow() -{ - static WorkWindow* pW = NULL; - if ( !pW ) - { - pW = new WorkWindow( NULL, 0 ); - pW->EnableChildTransparentMode(); - } - return pW; -} - static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel ) { Sequence< ::rtl::OUString> aNames; @@ -218,14 +207,15 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE Reference< XControl > xMe; OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe; - WorkWindow* pWW; + Window* pParentWindow( NULL ); { osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() ); - pWW = lcl_GetDefaultWindow(); + pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() ); + ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" ); } try { - xMe->createPeer( NULL, pWW->GetComponentInterface( sal_True ) ); + xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) ); } catch( const Exception& ) { -- cgit From be8d00fe05ad77bdf4aa86e37faab84b35fb8da8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 3 Dec 2010 14:46:39 +0100 Subject: dba34c: #i104347# DisableSelectionOnFocus for multi line edit controls --- svtools/source/uno/unoiface.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 18ab6f804d0c..51914a3f48d6 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -82,6 +82,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: if ( pParent ) { pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB); + static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus(); *ppNewComp = new VCLXMultiLineEdit; } else -- cgit From 0119d59c6598a8d18ebcd770787d8c9c780f5ba2 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 3 Dec 2010 16:07:43 +0100 Subject: dr78: #i91870# PMT accuracy; patch from --- sc/source/core/tool/interpr2.cxx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 404eaf763a51..df21ed87eecf 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -1122,24 +1122,23 @@ void ScInterpreter::ScLIA() } } -double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw, - double fZw, double fF) +double ScInterpreter::ScGetRmz(double fRate, double fNper, double fPv, + double fFv, double fPaytype) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetRmz" ); - double fRmz; - if (fZins == 0.0) - fRmz = (fBw + fZw) / fZzr; + double fPayment; + if (fRate == 0.0) + fPayment = (fPv + fFv) / fNper; else { - double fTerm = pow(1.0 + fZins, fZzr); - if (fF > 0.0) - fRmz = (fZw * fZins / (fTerm - 1.0) - + fBw * fZins / (1.0 - 1.0 / fTerm)) / (1.0+fZins); - else - fRmz = fZw * fZins / (fTerm - 1.0) - + fBw * fZins / (1.0 - 1.0 / fTerm); + if (fPaytype > 0.0) // payment in advance + fPayment = (fFv + fPv * exp( fNper * ::rtl::math::log1p(fRate) ) ) * fRate / + (::rtl::math::expm1( (fNper + 1) * ::rtl::math::log1p(fRate) ) - fRate); + else // payment in arrear + fPayment = (fFv + fPv * exp(fNper * ::rtl::math::log1p(fRate) ) ) * fRate / + ::rtl::math::expm1( fNper * ::rtl::math::log1p(fRate) ); } - return -fRmz; + return -fPayment; } void ScInterpreter::ScRMZ() -- cgit From 0238cbe385543d674f8bea99ccf5344eca868587 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 3 Dec 2010 16:47:27 +0100 Subject: dr78: #i95280# read Excel view options in FillRenderMarkData if not done before --- sc/source/ui/unoobj/docuno.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c92525b8ca57..1e703347a799 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -87,6 +87,7 @@ #include "rangeutl.hxx" #include "markdata.hxx" #include "docoptio.hxx" +#include "scextopt.hxx" #include "unoguard.hxx" #include "unonames.hxx" #include "shapeuno.hxx" @@ -897,6 +898,16 @@ BOOL ScModelObj::FillRenderMarkData( const uno::Any& aSelection, ScTabViewShell* pViewSh = pViewObj->GetViewShell(); if (pViewSh) { + // #i95280# when printing from the shell, the view is never activated, + // so Excel view settings must also be evaluated here. + ScExtDocOptions* pExtOpt = pDocShell->GetDocument()->GetExtDocOptions(); + if ( pExtOpt && pExtOpt->IsChanged() ) + { + pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings + pViewSh->SetTabNo( pViewSh->GetViewData()->GetTabNo(), TRUE ); + pExtOpt->SetChanged( false ); + } + const ScMarkData& rViewMark = pViewSh->GetViewData()->GetMarkData(); SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); for (SCTAB nTab = 0; nTab < nTabCount; nTab++) -- cgit From 687e7e41406a5a9a707816daa89a079a5f803b3d Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 3 Dec 2010 17:05:12 +0100 Subject: dr78: #i113511# don't include SID_VALIDITY_REFERENCE in UI configuration --- sc/sdi/scalc.sdi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 1e42ce5fb1dc..2455b02c9a9e 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -2795,10 +2795,10 @@ SfxVoidItem ValidityReference SID_VALIDITY_REFERENCE Synchron; /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, + AccelConfig = FALSE, + MenuConfig = FALSE, StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, + ToolBoxConfig = FALSE, GroupId = GID_OPTIONS; ] //-->Added by PengYunQuan for Validity Cell Range Picker -- cgit From 64edf5e725f6d5fe53c078019baa76bf20b47843 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 3 Dec 2010 17:47:13 +0100 Subject: dr78: #i111413# new ODFF interpreter functions SEC, SECH, CSC, CSCH; patch from , slightly reworked --- sc/inc/helpids.h | 4 ++ sc/source/core/inc/interpre.hxx | 4 ++ sc/source/core/tool/interpr1.cxx | 24 ++++++++++ sc/source/core/tool/interpr4.cxx | 4 ++ sc/source/ui/src/scfuncs.src | 99 ++++++++++++++++++++++++++++++++++++++++ sc/util/hidother.src | 4 ++ 6 files changed, 139 insertions(+) diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index f1803639cba2..25f8ebb2fbe3 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -515,6 +515,10 @@ #define HID_FUNC_COTHYP "SC_HID_FUNC_COTHYP" #define HID_FUNC_TANHYP "SC_HID_FUNC_TANHYP" #define HID_FUNC_ARCTAN2 "SC_HID_FUNC_ARCTAN2" +#define HID_FUNC_COSECANT "SC_HID_FUNC_COSECANT" +#define HID_FUNC_SECANT "SC_HID_FUNC_SECANT" +#define HID_FUNC_SECANTHYP "SC_HID_FUNC_SECANTHYP" +#define HID_FUNC_COSECANTHYP "SC_HID_FUNC_COSECANTHYP" #define HID_FUNC_DEG "SC_HID_FUNC_DEG" #define HID_FUNC_RAD "SC_HID_FUNC_RAD" #define HID_FUNC_EXP "SC_HID_FUNC_EXP" diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 93c4c23588d1..ce7a7bf15a1a 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -411,6 +411,10 @@ void ScArcSinHyp(); void ScArcCosHyp(); void ScArcTanHyp(); void ScArcCotHyp(); +void ScCosecant(); +void ScSecant(); +void ScCosecantHyp(); +void ScSecantHyp(); void ScExp(); void ScLn(); void ScLog10(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fcc7a24e7a42..1f9fdbb436a1 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1579,6 +1579,30 @@ void ScInterpreter::ScArcCotHyp() PushDouble(0.5 * log((nVal + 1.0) / (nVal - 1.0))); } +void ScInterpreter::ScCosecant() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScCosecant" ); + PushDouble(1.0 / ::rtl::math::sin(GetDouble())); +} + +void ScInterpreter::ScSecant() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScSecant" ); + PushDouble(1.0 / ::rtl::math::cos(GetDouble())); +} + +void ScInterpreter::ScCosecantHyp() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScCosecantHyp" ); + PushDouble(1.0 / sinh(GetDouble())); +} + +void ScInterpreter::ScSecantHyp() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "regina", "ScInterpreter::ScSecantHyp" ); + PushDouble(1.0 / cosh(GetDouble())); +} + void ScInterpreter::ScExp() { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index f0a0e9fa495a..d768bfe2c094 100755 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3465,6 +3465,10 @@ StackVar ScInterpreter::Interpret() case ocArcCosHyp : ScArcCosHyp(); break; case ocArcTanHyp : ScArcTanHyp(); break; case ocArcCotHyp : ScArcCotHyp(); break; + case ocCosecant : ScCosecant(); break; + case ocSecant : ScSecant(); break; + case ocCosecantHyp : ScCosecantHyp(); break; + case ocSecantHyp : ScSecantHyp(); break; case ocExp : ScExp(); break; case ocLn : ScLn(); break; case ocLog10 : ScLog10(); break; diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 129ed62a6c15..c01b4b081ee8 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -3468,6 +3468,105 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 Text [ en-US ] = "The value for the y coordinate." ; }; }; + + // -=*# Resource for function CSC #*=- + Resource SC_OPCODE_COSECANT + { + String 1 // Description + { + Text [ en-US ] = "Return the cosecant of an angle. CSC(x)=1/SIN(x)" ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_MATH; + U2S( HID_FUNC_COSECANT ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Angle" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The angle in radians for which the cosecant is to be calculated." ; + }; + }; + + // -=*# Resource for function SEC #*=- + Resource SC_OPCODE_SECANT + { + String 1 // Description + { + Text [ en-US ] = "Return the secant of an angle. SEC(x)=1/COS(x)" ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_MATH; + U2S( HID_FUNC_SECANT ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Angle" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The angle in radians for which the secant is to be calculated." ; + }; + }; + // -=*# Resource for function CSCH #*=- + Resource SC_OPCODE_COSECANT_HYP + { + String 1 // Description + { + Text [ en-US ] = "Return the hyperbolic cosecant of a hyperbolic angle. CSCH(x)=1/SINH(x)" ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_MATH; + U2S( HID_FUNC_COSECANTHYP ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Angle" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic cosecant is to be calculated." ; + }; + }; + // -=*# Resource for function SECH #*=- + Resource SC_OPCODE_SECANT_HYP + { + String 1 // Description + { + Text [ en-US ] = "Return the hyperbolic secant of a hyperbolic angle. SECH(x)=1/COSH(x)" ; + }; + ExtraData = + { + 0; + ID_FUNCTION_GRP_MATH; + U2S( HID_FUNC_SECANTHYP ); + 1; 0; + 0; + }; + String 2 // Name of Parameter 1 + { + Text [ en-US ] = "Angle" ; + }; + String 3 // Description of Parameter 1 + { + Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic secant is to be calculated." ; + }; + }; + // -=*# Resource for function DEG #*=- Resource SC_OPCODE_DEG { diff --git a/sc/util/hidother.src b/sc/util/hidother.src index d575580228bd..1f3072303402 100644 --- a/sc/util/hidother.src +++ b/sc/util/hidother.src @@ -191,6 +191,10 @@ hidspecial HID_FUNC_SINHYP { HelpID = HID_FUNC_SINHYP; }; hidspecial HID_FUNC_COTHYP { HelpID = HID_FUNC_COTHYP; }; hidspecial HID_FUNC_TANHYP { HelpID = HID_FUNC_TANHYP; }; hidspecial HID_FUNC_ARCTAN2 { HelpID = HID_FUNC_ARCTAN2; }; +hidspecial HID_FUNC_COSECANT { HelpID = HID_FUNC_COSECANT; }; +hidspecial HID_FUNC_SECANT { HelpID = HID_FUNC_SECANT; }; +hidspecial HID_FUNC_COSECANTHYP { HelpID = HID_FUNC_COSECANTHYP; }; +hidspecial HID_FUNC_SECANTHYP { HelpID = HID_FUNC_SECANTHYP; }; hidspecial HID_FUNC_DEG { HelpID = HID_FUNC_DEG; }; hidspecial HID_FUNC_RAD { HelpID = HID_FUNC_RAD; }; hidspecial HID_FUNC_EXP { HelpID = HID_FUNC_EXP; }; -- cgit From 1e3e411b54b2d556ee1df8b903d8ff311419dc99 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 3 Dec 2010 17:47:13 +0100 Subject: dr78: #i111413# new ODFF interpreter functions SEC, SECH, CSC, CSCH; patch from , slightly reworked --- formula/inc/formula/compiler.hrc | 126 +++++++++++++------------ formula/inc/formula/opcode.hxx | 4 + formula/source/core/resource/core_resource.src | 24 +++++ 3 files changed, 93 insertions(+), 61 deletions(-) diff --git a/formula/inc/formula/compiler.hrc b/formula/inc/formula/compiler.hrc index e4dc05aca4e9..5c58d9d3e068 100644 --- a/formula/inc/formula/compiler.hrc +++ b/formula/inc/formula/compiler.hrc @@ -130,67 +130,71 @@ #define SC_OPCODE_ARC_COS_HYP 95 #define SC_OPCODE_ARC_TAN_HYP 96 #define SC_OPCODE_ARC_COT_HYP 97 -#define SC_OPCODE_EXP 98 -#define SC_OPCODE_LN 99 -#define SC_OPCODE_SQRT 100 -#define SC_OPCODE_FACT 101 -#define SC_OPCODE_GET_YEAR 102 /* date and time */ -#define SC_OPCODE_GET_MONTH 103 -#define SC_OPCODE_GET_DAY 104 -#define SC_OPCODE_GET_HOUR 105 -#define SC_OPCODE_GET_MIN 106 -#define SC_OPCODE_GET_SEC 107 -#define SC_OPCODE_PLUS_MINUS 108 /* miscellaneous */ -#define SC_OPCODE_ABS 109 -#define SC_OPCODE_INT 110 -#define SC_OPCODE_PHI 111 -#define SC_OPCODE_GAUSS 112 -#define SC_OPCODE_IS_EMPTY 113 /* obtain type */ -#define SC_OPCODE_IS_STRING 114 -#define SC_OPCODE_IS_NON_STRING 115 -#define SC_OPCODE_IS_LOGICAL 116 -#define SC_OPCODE_TYPE 117 -#define SC_OPCODE_IS_REF 118 -#define SC_OPCODE_IS_VALUE 119 -#define SC_OPCODE_IS_FORMULA 120 -#define SC_OPCODE_IS_NV 121 -#define SC_OPCODE_IS_ERR 122 -#define SC_OPCODE_IS_ERROR 123 -#define SC_OPCODE_IS_EVEN 124 -#define SC_OPCODE_IS_ODD 125 -#define SC_OPCODE_N 126 -#define SC_OPCODE_GET_DATE_VALUE 127 /* string functions */ -#define SC_OPCODE_GET_TIME_VALUE 128 -#define SC_OPCODE_CODE 129 -#define SC_OPCODE_TRIM 130 -#define SC_OPCODE_UPPER 131 -#define SC_OPCODE_PROPPER 132 -#define SC_OPCODE_LOWER 133 -#define SC_OPCODE_LEN 134 -#define SC_OPCODE_T 135 /* miscellaneous, part 21 */ -#define SC_OPCODE_VALUE 136 -#define SC_OPCODE_CLEAN 137 -#define SC_OPCODE_CHAR 138 -#define SC_OPCODE_LOG10 139 -#define SC_OPCODE_EVEN 140 -#define SC_OPCODE_ODD 141 -#define SC_OPCODE_STD_NORM_DIST 142 -#define SC_OPCODE_FISHER 143 -#define SC_OPCODE_FISHER_INV 144 -#define SC_OPCODE_S_NORM_INV 145 -#define SC_OPCODE_GAMMA_LN 146 -#define SC_OPCODE_ERROR_TYPE 147 -#define SC_OPCODE_ERR_CELL 148 -#define SC_OPCODE_FORMULA 149 -#define SC_OPCODE_ARABIC 150 -#define SC_OPCODE_INFO 151 -#define SC_OPCODE_BAHTTEXT 152 -#define SC_OPCODE_JIS 153 -#define SC_OPCODE_ASC 154 -#define SC_OPCODE_UNICODE 155 -#define SC_OPCODE_UNICHAR 156 -#define SC_OPCODE_GAMMA 157 -#define SC_OPCODE_STOP_1_PAR 158 +#define SC_OPCODE_COSECANT 98 +#define SC_OPCODE_SECANT 99 +#define SC_OPCODE_COSECANT_HYP 100 +#define SC_OPCODE_SECANT_HYP 101 +#define SC_OPCODE_EXP 102 +#define SC_OPCODE_LN 103 +#define SC_OPCODE_SQRT 104 +#define SC_OPCODE_FACT 105 +#define SC_OPCODE_GET_YEAR 106 /* date and time */ +#define SC_OPCODE_GET_MONTH 107 +#define SC_OPCODE_GET_DAY 108 +#define SC_OPCODE_GET_HOUR 109 +#define SC_OPCODE_GET_MIN 110 +#define SC_OPCODE_GET_SEC 111 +#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */ +#define SC_OPCODE_ABS 113 +#define SC_OPCODE_INT 114 +#define SC_OPCODE_PHI 115 +#define SC_OPCODE_GAUSS 116 +#define SC_OPCODE_IS_EMPTY 117 /* obtain type */ +#define SC_OPCODE_IS_STRING 118 +#define SC_OPCODE_IS_NON_STRING 119 +#define SC_OPCODE_IS_LOGICAL 120 +#define SC_OPCODE_TYPE 121 +#define SC_OPCODE_IS_REF 122 +#define SC_OPCODE_IS_VALUE 123 +#define SC_OPCODE_IS_FORMULA 124 +#define SC_OPCODE_IS_NV 125 +#define SC_OPCODE_IS_ERR 126 +#define SC_OPCODE_IS_ERROR 127 +#define SC_OPCODE_IS_EVEN 128 +#define SC_OPCODE_IS_ODD 129 +#define SC_OPCODE_N 130 +#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */ +#define SC_OPCODE_GET_TIME_VALUE 132 +#define SC_OPCODE_CODE 133 +#define SC_OPCODE_TRIM 134 +#define SC_OPCODE_UPPER 135 +#define SC_OPCODE_PROPPER 136 +#define SC_OPCODE_LOWER 137 +#define SC_OPCODE_LEN 138 +#define SC_OPCODE_T 139 /* miscellaneous, part 21 */ +#define SC_OPCODE_VALUE 140 +#define SC_OPCODE_CLEAN 141 +#define SC_OPCODE_CHAR 142 +#define SC_OPCODE_LOG10 143 +#define SC_OPCODE_EVEN 144 +#define SC_OPCODE_ODD 145 +#define SC_OPCODE_STD_NORM_DIST 146 +#define SC_OPCODE_FISHER 147 +#define SC_OPCODE_FISHER_INV 148 +#define SC_OPCODE_S_NORM_INV 149 +#define SC_OPCODE_GAMMA_LN 150 +#define SC_OPCODE_ERROR_TYPE 151 +#define SC_OPCODE_ERR_CELL 152 +#define SC_OPCODE_FORMULA 153 +#define SC_OPCODE_ARABIC 154 +#define SC_OPCODE_INFO 155 +#define SC_OPCODE_BAHTTEXT 156 +#define SC_OPCODE_JIS 157 +#define SC_OPCODE_ASC 158 +#define SC_OPCODE_UNICODE 159 +#define SC_OPCODE_UNICHAR 160 +#define SC_OPCODE_GAMMA 161 +#define SC_OPCODE_STOP_1_PAR 162 /*** Functions with more than one parameters ***/ #define SC_OPCODE_START_2_PAR 201 diff --git a/formula/inc/formula/opcode.hxx b/formula/inc/formula/opcode.hxx index 390ab21048d3..09c621df1ef1 100644 --- a/formula/inc/formula/opcode.hxx +++ b/formula/inc/formula/opcode.hxx @@ -121,6 +121,10 @@ enum OpCodeEnum ocArcCosHyp = SC_OPCODE_ARC_COS_HYP, ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP, ocArcCotHyp = SC_OPCODE_ARC_COT_HYP, + ocCosecant = SC_OPCODE_COSECANT, + ocSecant = SC_OPCODE_SECANT, + ocCosecantHyp = SC_OPCODE_COSECANT_HYP, + ocSecantHyp = SC_OPCODE_SECANT_HYP, ocExp = SC_OPCODE_EXP, ocLn = SC_OPCODE_LN, ocSqrt = SC_OPCODE_SQRT, diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index d2996e78fba7..f7cd137d08a5 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -88,6 +88,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; }; String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; }; String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; }; + String SC_OPCODE_COSECANT { Text = "CSC" ; }; + String SC_OPCODE_SECANT { Text = "SEC" ; }; + String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; }; + String SC_OPCODE_SECANT_HYP { Text = "SECH" ; }; String SC_OPCODE_EXP { Text = "EXP" ; }; String SC_OPCODE_LN { Text = "LN" ; }; String SC_OPCODE_SQRT { Text = "SQRT" ; }; @@ -412,6 +416,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; }; String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; }; String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; }; + String SC_OPCODE_COSECANT { Text = "CSC" ; }; + String SC_OPCODE_SECANT { Text = "SEC" ; }; + String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; }; + String SC_OPCODE_SECANT_HYP { Text = "SECH" ; }; String SC_OPCODE_EXP { Text = "EXP" ; }; String SC_OPCODE_LN { Text = "LN" ; }; String SC_OPCODE_SQRT { Text = "SQRT" ; }; @@ -830,6 +838,22 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "ACOTH" ; }; + String SC_OPCODE_COSECANT + { + Text [ en-US ] = "CSC" ; + }; + String SC_OPCODE_SECANT + { + Text [ en-US ] = "SEC" ; + }; + String SC_OPCODE_COSECANT_HYP + { + Text [ en-US ] = "CSCH" ; + }; + String SC_OPCODE_SECANT_HYP + { + Text [ en-US ] = "SECH" ; + }; String SC_OPCODE_EXP { Text [ en-US ] = "EXP"; -- cgit From 1b5da40f6d69a68e3b3a1baaacb9151e0fd99d11 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 3 Dec 2010 18:48:31 +0100 Subject: dr78: #i97169 TIME returns values [0,1) --- sc/source/core/tool/interpr2.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index df21ed87eecf..419a968e1210 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -297,7 +297,11 @@ void ScInterpreter::ScGetTime() double nSec = GetDouble(); double nMin = GetDouble(); double nHour = GetDouble(); - PushDouble( ( (nHour * 3600) + (nMin * 60) + nSec ) / D_TIMEFACTOR ); + double fTime = fmod( (nHour * 3600) + (nMin * 60) + nSec, D_TIMEFACTOR) / D_TIMEFACTOR; + if (fTime < 0) + PushIllegalArgument(); + else + PushDouble( fTime); } } -- cgit From 8e4d860c7f8cb3ee9eae24a9925fe614f997f555 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 3 Dec 2010 22:09:17 +0100 Subject: dr78: #i92774# NPV evaluates arguments row-wise; ScHorizontalValueIterator; patch from with little modifications --- sc/inc/column.hxx | 1 + sc/inc/dociter.hxx | 36 ++++++++ sc/inc/document.hxx | 1 + sc/inc/table.hxx | 1 + sc/source/core/data/dociter.cxx | 182 ++++++++++++++++++++++++++++++++++++--- sc/source/core/tool/interpr2.cxx | 23 ++--- 6 files changed, 223 insertions(+), 21 deletions(-) diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index af6292bbd830..63924cc1310d 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -110,6 +110,7 @@ private: friend class ScDocument; // fuer FillInfo friend class ScDocumentIterator; friend class ScValueIterator; +friend class ScHorizontalValueIterator; friend class ScDBQueryDataIterator; friend class ScColumnIterator; friend class ScQueryCellIterator; diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index d995550a2f1d..9b8deb509634 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -423,6 +423,7 @@ private: SCTAB nTab; SCCOL nStartCol; SCCOL nEndCol; + SCROW nStartRow; SCROW nEndRow; SCROW* pNextRows; SCSIZE* pNextIndices; @@ -437,12 +438,47 @@ public: ScBaseCell* GetNext( SCCOL& rCol, SCROW& rRow ); BOOL ReturnNext( SCCOL& rCol, SCROW& rRow ); + /// Set a(nother) sheet and (re)init. + void SetTab( SCTAB nTab ); private: void Advance(); }; +/** Row-wise value iterator. */ +class ScHorizontalValueIterator +{ +private: + ScDocument *pDoc; + const ScAttrArray *pAttrArray; + ScHorizontalCellIterator *pCellIter; + ULONG nNumFormat; // for CalcAsShown + ULONG nNumFmtIndex; + SCTAB nEndTab; + SCCOL nCurCol; + SCROW nCurRow; + SCTAB nCurTab; + SCROW nAttrEndRow; + short nNumFmtType; + bool bNumValid; + bool bSubTotal; + bool bCalcAsShown; + bool bTextAsZero; + +public: + + ScHorizontalValueIterator( ScDocument* pDocument, + const ScRange& rRange, + bool bSTotal = false, + bool bTextAsZero = false ); + ~ScHorizontalValueIterator(); + void GetCurNumFmtInfo( short& nType, ULONG& nIndex ); + /// Does NOT reset rValue if no value found! + bool GetNext( double& rValue, USHORT& rErr ); +}; + + // // gibt alle Bereiche mit nicht-Default-Formatierung zurueck (horizontal) // diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b68585f27a8e..d3623a7d84c4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -241,6 +241,7 @@ class ScDocument { friend class ScDocumentIterator; friend class ScValueIterator; +friend class ScHorizontalValueIterator; friend class ScDBQueryDataIterator; friend class ScCellIterator; friend class ScQueryCellIterator; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 63cefe22626a..9551db58eb91 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -185,6 +185,7 @@ private: friend class ScDocument; // fuer FillInfo friend class ScDocumentIterator; friend class ScValueIterator; +friend class ScHorizontalValueIterator; friend class ScDBQueryDataIterator; friend class ScCellIterator; friend class ScQueryCellIterator; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 83a502422e2e..132263dd3d43 100755 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1674,22 +1674,38 @@ ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument* pDocument, SCTAB nTab( nTable ), nStartCol( nCol1 ), nEndCol( nCol2 ), + nStartRow( nRow1 ), nEndRow( nRow2 ), nCol( nCol1 ), nRow( nRow1 ), bMore( TRUE ) { - SCCOL i; - SCSIZE nIndex; pNextRows = new SCROW[ nCol2-nCol1+1 ]; pNextIndices = new SCSIZE[ nCol2-nCol1+1 ]; - for (i=nStartCol; i<=nEndCol; i++) + SetTab( nTab ); +} + +ScHorizontalCellIterator::~ScHorizontalCellIterator() +{ + delete [] pNextRows; + delete [] pNextIndices; +} + +void ScHorizontalCellIterator::SetTab( SCTAB nTabP ) +{ + nTab = nTabP; + nRow = nStartRow; + nCol = nStartCol; + bMore = TRUE; + + for (SCCOL i=nStartCol; i<=nEndCol; i++) { ScColumn* pCol = &pDoc->pTab[nTab]->aCol[i]; - pCol->Search( nRow1, nIndex ); + SCSIZE nIndex; + pCol->Search( nStartRow, nIndex ); if ( nIndex < pCol->nCount ) { pNextRows[i-nStartCol] = pCol->pItems[nIndex].nRow; @@ -1702,16 +1718,10 @@ ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument* pDocument, SCTAB } } - if (pNextRows[0] != nRow1) + if (pNextRows[0] != nStartRow) Advance(); } -ScHorizontalCellIterator::~ScHorizontalCellIterator() -{ - delete [] pNextRows; - delete [] pNextIndices; -} - ScBaseCell* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow ) { if ( bMore ) @@ -1781,6 +1791,156 @@ void ScHorizontalCellIterator::Advance() bMore = FALSE; } +//------------------------------------------------------------------------ + +ScHorizontalValueIterator::ScHorizontalValueIterator( ScDocument* pDocument, + const ScRange& rRange, bool bSTotal, bool bTextZero ) : + pDoc( pDocument ), + nNumFmtIndex(0), + nEndTab( rRange.aEnd.Tab() ), + nNumFmtType( NUMBERFORMAT_UNDEFINED ), + bNumValid( false ), + bSubTotal( bSTotal ), + bCalcAsShown( pDocument->GetDocOptions().IsCalcAsShown() ), + bTextAsZero( bTextZero ) +{ + SCCOL nStartCol = rRange.aStart.Col(); + SCROW nStartRow = rRange.aStart.Row(); + SCTAB nStartTab = rRange.aStart.Tab(); + SCCOL nEndCol = rRange.aEnd.Col(); + SCROW nEndRow = rRange.aEnd.Row(); + PutInOrder( nStartCol, nEndCol); + PutInOrder( nStartRow, nEndRow); + PutInOrder( nStartTab, nEndTab ); + + if (!ValidCol(nStartCol)) nStartCol = MAXCOL; + if (!ValidCol(nEndCol)) nEndCol = MAXCOL; + if (!ValidRow(nStartRow)) nStartRow = MAXROW; + if (!ValidRow(nEndRow)) nEndRow = MAXROW; + if (!ValidTab(nStartTab)) nStartTab = MAXTAB; + if (!ValidTab(nEndTab)) nEndTab = MAXTAB; + + nCurCol = nStartCol; + nCurRow = nStartRow; + nCurTab = nStartTab; + + nNumFormat = 0; // will be initialized in GetNumberFormat() + pAttrArray = 0; + nAttrEndRow = 0; + + pCellIter = new ScHorizontalCellIterator( pDoc, nStartTab, nStartCol, + nStartRow, nEndCol, nEndRow ); +} + +ScHorizontalValueIterator::~ScHorizontalValueIterator() +{ + delete pCellIter; +} + +bool ScHorizontalValueIterator::GetNext( double& rValue, USHORT& rErr ) +{ + bool bFound = false; + while ( !bFound ) + { + ScBaseCell* pCell = pCellIter->GetNext( nCurCol, nCurRow ); + while ( !pCell ) + { + if ( nCurTab < nEndTab ) + { + pCellIter->SetTab( ++nCurTab); + pCell = pCellIter->GetNext( nCurCol, nCurRow ); + } + else + return false; + } + if ( !bSubTotal || !pDoc->pTab[nCurTab]->RowFiltered( nCurRow ) ) + { + switch (pCell->GetCellType()) + { + case CELLTYPE_VALUE: + { + bNumValid = false; + rValue = ((ScValueCell*)pCell)->GetValue(); + rErr = 0; + if ( bCalcAsShown ) + { + ScColumn* pCol = &pDoc->pTab[nCurTab]->aCol[nCurCol]; + lcl_IterGetNumberFormat( nNumFormat, pAttrArray, + nAttrEndRow, pCol->pAttrArray, nCurRow, pDoc ); + rValue = pDoc->RoundValueAsShown( rValue, nNumFormat ); + } + bFound = true; + } + break; + case CELLTYPE_FORMULA: + { + if (!bSubTotal || !((ScFormulaCell*)pCell)->IsSubTotal()) + { + rErr = ((ScFormulaCell*)pCell)->GetErrCode(); + if ( rErr || ((ScFormulaCell*)pCell)->IsValue() ) + { + rValue = ((ScFormulaCell*)pCell)->GetValue(); + bNumValid = false; + bFound = true; + } + else if ( bTextAsZero ) + { + rValue = 0.0; + bNumValid = false; + bFound = true; + } + } + } + break; + case CELLTYPE_STRING : + case CELLTYPE_EDIT : + { + if ( bTextAsZero ) + { + rErr = 0; + rValue = 0.0; + nNumFmtType = NUMBERFORMAT_NUMBER; + nNumFmtIndex = 0; + bNumValid = true; + bFound = true; + } + } + break; + default: + ; // nothing + } + } + } + return bFound; +} + +void ScHorizontalValueIterator::GetCurNumFmtInfo( short& nType, ULONG& nIndex ) +{ + if (!bNumValid) + { + const ScColumn* pCol = &(pDoc->pTab[nCurTab])->aCol[nCurCol]; + nNumFmtIndex = pCol->GetNumberFormat( nCurRow ); + if ( (nNumFmtIndex % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) + { + const ScBaseCell* pCell; + SCSIZE nCurIndex; + if ( pCol->Search( nCurRow, nCurIndex ) ) + pCell = pCol->pItems[nCurIndex].pCell; + else + pCell = NULL; + if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA ) + ((const ScFormulaCell*)pCell)->GetFormatInfo( nNumFmtType, nNumFmtIndex ); + else + nNumFmtType = pDoc->GetFormatTable()->GetType( nNumFmtIndex ); + } + else + nNumFmtType = pDoc->GetFormatTable()->GetType( nNumFmtIndex ); + bNumValid = true; + } + nType = nNumFmtType; + nIndex = nNumFmtIndex; +} + //------------------------------------------------------------------------------- ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB nTable, diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 419a968e1210..6384ff5680e8 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -654,8 +654,15 @@ void ScInterpreter::ScNPV() break; case svSingleRef : { - nVal += (GetDouble() / pow(1.0 + nZins, (double)nCount)); - nCount++; + ScAddress aAdr; + PopSingleRef( aAdr ); + ScBaseCell* pCell = GetCell( aAdr ); + if (!HasCellEmptyData(pCell) && HasCellValueData(pCell)) + { + double nCellVal = GetCellValue( aAdr, pCell ); + nVal += (nCellVal / pow(1.0 + nZins, (double)nCount)); + nCount++; + } } break; case svDoubleRef : @@ -664,18 +671,14 @@ void ScInterpreter::ScNPV() USHORT nErr = 0; double nCellVal; PopDoubleRef( aRange, nParamCount, nRefInList); - ScValueIterator aValIter(pDok, aRange, glSubTotal); - if (aValIter.GetFirst(nCellVal, nErr)) + ScHorizontalValueIterator aValIter( pDok, aRange, glSubTotal); + while ((nErr == 0) && aValIter.GetNext(nCellVal, nErr)) { nVal += (nCellVal / pow(1.0 + nZins, (double)nCount)); nCount++; - while ((nErr == 0) && aValIter.GetNext(nCellVal, nErr)) - { - nVal += (nCellVal / pow(1.0 + nZins, (double)nCount)); - nCount++; - } - SetError(nErr); } + if ( nErr != 0 ) + SetError(nErr); } break; default : SetError(errIllegalParameter); break; -- cgit From 26ba737561921fc0758e5f6274dbd701657cbcbb Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 6 Dec 2010 13:23:08 +0100 Subject: dr78: #i106108# SetDocumentModified also for page margins --- sc/source/ui/view/preview.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index ede1e2dc81a7..bbea547831c6 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -1068,6 +1068,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) } if( bMoveRulerAction ) { + ScDocShellModificator aModificator( *pDocShell ); if( bLeftRulerChange && bLeftRulerMove ) { aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS )); @@ -1096,6 +1097,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) Rectangle aRect(0,0,10000,10000); Paint( aRect ); + aModificator.SetDocumentModified(); bLeftRulerChange = FALSE; bRightRulerChange = FALSE; } @@ -1128,6 +1130,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) DBG_ASSERT( pStyleSheet, "PageStyle not found" ); if ( pStyleSheet ) { + ScDocShellModificator aModificator( *pDocShell ); ScStyleSaveData aOldData; if( bUndo ) aOldData.InitFromStyle( pStyleSheet ); @@ -1192,6 +1195,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) Rectangle aRect(0,0,10000,10000); Paint( aRect ); + aModificator.SetDocumentModified(); bTopRulerChange = FALSE; bBottomRulerChange = FALSE; bHeaderRulerChange = FALSE; -- cgit From 54d04ab5c2bd2a86852b238d4297b0af92087277 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 6 Dec 2010 17:17:03 +0100 Subject: dr78: #i95280# avoid repeated progress bars in ScPrintFuncCache for all sheets --- sc/source/ui/unoobj/docuno.cxx | 5 ----- sc/source/ui/view/pfuncache.cxx | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1e703347a799..6c04e4764304 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1081,11 +1081,6 @@ uno::Sequence SAL_CALL ScModelObj::getRenderer( sal_Int32 pArray[2].Value <<= aRangeAddress; } - #if 0 - const ScPrintOptions& rPrintOpt = - #endif - // FIXME: is this for side effects ? - SC_MOD()->GetPrintOptions(); if( ! pPrinterOptions ) pPrinterOptions = new ScPrintUIOptions; else diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index b503d3a73fb7..97061b365da6 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -64,6 +64,11 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, ScDocument* pDoc = pDocSh->GetDocument(); SCTAB nTabCount = pDoc->GetTableCount(); + + // avoid repeated progress bars if row heights for all sheets are needed + if ( nTabCount > 1 && rMark.GetSelectCount() == nTabCount ) + pDocSh->UpdatePendingRowHeights( nTabCount-1, true ); + SCTAB nTab; for ( nTab=0; nTab Date: Tue, 7 Dec 2010 12:19:33 +0100 Subject: dba34c: some slots can be enabled in alive mode as well --- svx/source/form/fmshell.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 96bdd27d62e1..cb376a1b4acd 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -905,19 +905,19 @@ void FmFormShell::GetState(SfxItemSet &rSet) case SID_FM_USE_WIZARDS: if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); - else if (!m_bDesignMode || !GetFormModel()) + else if (!GetFormModel()) rSet.DisableItem( nWhich ); else rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) ); break; case SID_FM_AUTOCONTROLFOCUS: - if (!m_bDesignMode || !GetFormModel()) + if (!GetFormModel()) rSet.DisableItem( nWhich ); else rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) ); break; case SID_FM_OPEN_READONLY: - if (!m_bDesignMode || !GetFormModel()) + if (!GetFormModel()) rSet.DisableItem( nWhich ); else rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) ); -- cgit From f01cd8248f9968c8851b4a02474dc483055e4814 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Tue, 7 Dec 2010 16:45:14 +0100 Subject: dr78: #i115951# set ScColumn::bDoubleAlloc in DBaseImport --- sc/source/ui/docshell/docsh8.cxx | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index cb9d625da70c..fc2869182a6a 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -251,6 +251,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, { ULONG nErr = eERR_OK; long i; + long nColCount = 0; try { @@ -262,14 +263,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); - long nRowCount = 0; - if ( nRowCount < 0 ) - { - DBG_ERROR("can't get row count"); - nRowCount = 0; - } - - ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount ); + ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), 0 ); uno::Reference xFactory = comphelper::getProcessServiceFactory(); uno::Reference xRowSet( xFactory->createInstance( rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), @@ -296,7 +290,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, xRowSet->execute(); - long nColCount = 0; uno::Reference xMeta; uno::Reference xMetaSupp( xRowSet, uno::UNO_QUERY ); if ( xMetaSupp.is() ) @@ -310,10 +303,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning } - if ( nColCount > 0 ) - aDocument.DoColResize( 0, 0, static_cast(nColCount) - 1, - static_cast(nRowCount) + 1 ); - uno::Reference xRow( xRowSet, uno::UNO_QUERY ); DBG_ASSERT( xRow.is(), "can't get Row" ); if (!xRow.is()) return SCERR_IMPORT_CONNECT; @@ -327,6 +316,9 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, // read column names //! add type descriptions + aProgress.SetState( 0 ); + ScColumn::bDoubleAlloc = TRUE; // row count isn't readily available in advance + for (i=0; igetColumnLabel( i+1 ); @@ -384,9 +376,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, bEnd = TRUE; // don't continue nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning message } - - if ( nRowCount ) - aProgress.SetStateOnPercent( nRow ); } } catch ( sdbc::SQLException& ) @@ -399,6 +388,10 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, nErr = ERRCODE_IO_GENERAL; } + ScColumn::bDoubleAlloc = FALSE; + if ( nColCount > 0 ) + aDocument.DoColResize( 0, 0, static_cast(nColCount) - 1, 0 ); + return nErr; } -- cgit From 26dc810e5b6ff7b63be8b3d856c86200167dccd6 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 8 Dec 2010 12:27:11 +0100 Subject: dr78: remove unused member --- sc/inc/dpobject.hxx | 4 ---- sc/source/core/data/dpobject.cxx | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index e1b88919dad6..008a2e29fab5 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -106,7 +106,6 @@ private: ScDPOutput* pOutput; BOOL bSettingsChanged; BOOL bAlive; // FALSE if only used to hold settings - sal_uInt16 mnAutoFormatIndex; BOOL bAllowMove; long nHeaderRows; // page fields plus filter button bool mbHeaderLayout; // TRUE : grid, FALSE : standard @@ -150,9 +149,6 @@ public: void SetOutRange(const ScRange& rRange); const ScRange& GetOutRange() const { return aOutRange; } - void SetAutoFormatIndex (const sal_uInt16 nIndex); - sal_uInt16 GetAutoFormatIndex() const; - void SetHeaderLayout(bool bUseGrid); bool GetHeaderLayout() const; diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 29ba9f15dc92..ffa47e293aa6 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -171,7 +171,6 @@ ScDPObject::ScDPObject( ScDocument* pD ) : pOutput( NULL ), bSettingsChanged( FALSE ), bAlive( FALSE ), - mnAutoFormatIndex( 65535 ), bAllowMove( FALSE ), nHeaderRows( 0 ), mbHeaderLayout(false), @@ -194,7 +193,6 @@ ScDPObject::ScDPObject(const ScDPObject& r) : pOutput( NULL ), bSettingsChanged( FALSE ), bAlive( FALSE ), - mnAutoFormatIndex( r.mnAutoFormatIndex ), bAllowMove( FALSE ), nHeaderRows( r.nHeaderRows ), mbHeaderLayout( r.mbHeaderLayout ), @@ -256,16 +254,6 @@ void ScDPObject::SetSaveData(const ScDPSaveData& rData) InvalidateData(); // re-init source from SaveData } -void ScDPObject::SetAutoFormatIndex(const sal_uInt16 nIndex) -{ - mnAutoFormatIndex = nIndex; -} - -sal_uInt16 ScDPObject::GetAutoFormatIndex() const -{ - return mnAutoFormatIndex; -} - void ScDPObject::SetHeaderLayout (bool bUseGrid) { mbHeaderLayout = bUseGrid; -- cgit From aeb27fad06d190d0808461702742a708809ba9e6 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 8 Dec 2010 15:41:52 +0100 Subject: dr78: #i111413# export secant functions to BIFF --- sc/source/filter/excel/xeformula.cxx | 8 ++++++++ sc/source/filter/excel/xlformula.cxx | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 34e48671a3bc..dd5b26b2529f 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1439,7 +1439,11 @@ void XclExpFmlaCompImpl::PrepareFunction( XclExpFuncData& rFuncData ) { switch( rFuncData.GetOpCode() ) { + case ocCosecant: // simulate CSC(x) by (1/SIN(x)) + case ocSecant: // simulate SEC(x) by (1/COS(x)) case ocCot: // simulate COT(x) by (1/TAN(x)) + case ocCosecantHyp: // simulate CSCH(x) by (1/SINH(x)) + case ocSecantHyp: // simulate SECH(x) by (1/COSH(x)) case ocCotHyp: // simulate COTH(x) by (1/TANH(x)) AppendIntToken( 1 ); break; @@ -1489,7 +1493,11 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC FinishChooseFunction( rFuncData ); break; + case ocCosecant: // simulate CSC(x) by (1/SIN(x)) + case ocSecant: // simulate SEC(x) by (1/COS(x)) case ocCot: // simulate COT(x) by (1/TAN(x)) + case ocCosecantHyp: // simulate CSCH(x) by (1/SINH(x)) + case ocSecantHyp: // simulate SECH(x) by (1/COSH(x)) case ocCotHyp: // simulate COTH(x) by (1/TANH(x)) AppendBinaryOperatorToken( EXC_TOKID_DIV, true ); AppendParenToken(); diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index d613f1279242..e75364ab9fc7 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -93,7 +93,9 @@ static const XclFunctionInfo saFuncTable_2[] = { ocCurrency, 13, 1, 2, V, { VR }, 0, 0 }, { ocFixed, 14, 1, 2, V, { VR, VR, C }, 0, 0 }, { ocSin, 15, 1, 1, V, { VR }, 0, 0 }, + { ocCosecant, 15, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocCos, 16, 1, 1, V, { VR }, 0, 0 }, + { ocSecant, 16, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocTan, 17, 1, 1, V, { VR }, 0, 0 }, { ocCot, 17, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocArcTan, 18, 1, 1, V, { VR }, 0, 0 }, @@ -230,7 +232,9 @@ static const XclFunctionInfo saFuncTable_3[] = { ocMedian, 227, 1, MX, V, { RX }, 0, 0 }, { ocSumProduct, 228, 1, MX, V, { VA }, 0, 0 }, { ocSinHyp, 229, 1, 1, V, { VR }, 0, 0 }, + { ocCosecantHyp, 229, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocCosHyp, 230, 1, 1, V, { VR }, 0, 0 }, + { ocSecantHyp, 230, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocTanHyp, 231, 1, 1, V, { VR }, 0, 0 }, { ocCotHyp, 231, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocArcSinHyp, 232, 1, 1, V, { VR }, 0, 0 }, -- cgit From 518771d95e7dec96e7636719c5da8a74b692cddd Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 8 Dec 2010 15:41:52 +0100 Subject: dr78: #i111413# export secant functions to BIFF --- oox/source/dump/biffdumper.ini | 2 +- oox/source/xls/formulabase.cxx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index d4b862825b3c..97685c850515 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -358,7 +358,7 @@ multilist=RECORD-NAMES-BIFF5 # chart records exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B 0x1040=CHRADARAREA,CHAXESSET,,CHLEGENDENTRY,CHPROPERTIES,CHSERGROUP,CHUSEDAXESSETS, - 0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHFRAMEPOS + 0x1048=CHPIVOTRANGE,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHFRAMEPOS 0x1050=CHFORMATRUNS,CHSOURCELINK,,,,,, 0x1058=,,,CHSERERRORBAR,,CHSERIESFORMAT,, end diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index ea353bb48558..5e1ed6b35141 100644 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -308,7 +308,9 @@ static const FunctionData saFuncTableBiff2[] = { "DOLLAR", "DOLLAR", 13, 13, 1, 2, V, { VR }, 0 }, { "FIXED", "FIXED", 14, 14, 1, 2, V, { VR, VR, C }, 0 }, { "SIN", "SIN", 15, 15, 1, 1, V, { VR }, 0 }, + { "CSC", "SIN", 15, 15, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "COS", "COS", 16, 16, 1, 1, V, { VR }, 0 }, + { "SEC", "COS", 16, 16, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "TAN", "TAN", 17, 17, 1, 1, V, { VR }, 0 }, { "COT", "TAN", 17, 17, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "ATAN", "ATAN", 18, 18, 1, 1, V, { VR }, 0 }, @@ -468,7 +470,9 @@ static const FunctionData saFuncTableBiff3[] = { "MEDIAN", "MEDIAN", 227, 227, 1, MX, V, { RX }, 0 }, { "SUMPRODUCT", "SUMPRODUCT", 228, 228, 1, MX, V, { VA }, 0 }, { "SINH", "SINH", 229, 229, 1, 1, V, { VR }, 0 }, + { "CSCH", "SINH", 229, 229, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "COSH", "COSH", 230, 230, 1, 1, V, { VR }, 0 }, + { "SECH", "COSH", 230, 230, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "TANH", "TANH", 231, 231, 1, 1, V, { VR }, 0 }, { "COTH", "TANH", 231, 231, 1, 1, V, { VR }, FUNCFLAG_EXPORTONLY }, { "ASINH", "ASINH", 232, 232, 1, 1, V, { VR }, 0 }, -- cgit From 047ed727986cb7f0703af85d14602c71ce28d477 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 9 Dec 2010 13:57:20 +0100 Subject: dr78: cleanup --- sc/source/filter/excel/xeformula.cxx | 8 ++------ sc/source/filter/excel/xiescher.cxx | 2 +- sc/source/filter/excel/xistyle.cxx | 2 +- sc/source/filter/excel/xlchart.cxx | 18 +++++++++--------- sc/source/filter/excel/xlformula.cxx | 12 ++++++------ sc/source/filter/excel/xlpage.cxx | 4 ++-- sc/source/filter/excel/xlstyle.cxx | 10 +++++----- sc/source/filter/excel/xltools.cxx | 20 ++++++++++---------- sc/source/filter/inc/ftools.hxx | 5 ----- sc/source/filter/xml/XMLConverter.cxx | 2 +- 10 files changed, 37 insertions(+), 46 deletions(-) mode change 100644 => 100755 sc/source/filter/excel/xlchart.cxx diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index dd5b26b2529f..cb728d106a33 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -28,11 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -// XXX xelink.hxx MUST be included before xeformula.hxx because of the -// redifinition of the CREATE_OUSTRING() macro, which is in oox/helper.hxx -// (indirectly included via xelink.hxx) and ../inc/ftools.hxx (indirectly -// included via xeformula.hxx) that does an undef first. Ugly. -#include "xelink.hxx" #include "xeformula.hxx" #include @@ -46,6 +41,7 @@ #include "token.hxx" #include "tokenarray.hxx" #include "xehelper.hxx" +#include "xelink.hxx" #include "xename.hxx" #include "xestream.hxx" @@ -508,7 +504,7 @@ XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) : mnMaxRowMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Row() ) ) { // build the configuration map - for( const XclExpCompConfig* pEntry = spConfigTable; pEntry != STATIC_TABLE_END( spConfigTable ); ++pEntry ) + for( const XclExpCompConfig* pEntry = spConfigTable; pEntry != STATIC_ARRAY_END( spConfigTable ); ++pEntry ) maCfgMap[ pEntry->meType ] = *pEntry; } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 8d09cae60941..167c5e27cdfb 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -653,7 +653,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 }, { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 } }; - const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_TABLE_SIZE( sppnPatterns ) ) ]; + const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_ARRAY_SIZE( sppnPatterns ) ) ]; // create 2-colored 8x8 DIB SvMemoryStream aMemStrm; aMemStrm << sal_uInt32( 12 ) << sal_Int16( 8 ) << sal_Int16( 8 ) << sal_uInt16( 1 ) << sal_uInt16( 1 ); diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 1559ef5530f5..f09da83d2adb 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -833,7 +833,7 @@ bool lclConvertBorderLine( SvxBorderLine& rLine, const XclImpPalette& rPalette, if( nXclLine == EXC_LINE_NONE ) return false; - if( nXclLine >= STATIC_TABLE_SIZE( ppnLineParam ) ) + if( nXclLine >= STATIC_ARRAY_SIZE( ppnLineParam ) ) nXclLine = EXC_LINE_THIN; rLine.SetColor( rPalette.GetColor( nXclColor ) ); diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx old mode 100644 new mode 100755 index 10a0657c7899..5e0a3884317c --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -404,7 +404,7 @@ sal_uInt16 XclChartHelper::GetSeriesLineAutoColorIdx( sal_uInt16 nFormatIdx ) 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 63 }; - return spnLineColors[ nFormatIdx % STATIC_TABLE_SIZE( spnLineColors ) ]; + return spnLineColors[ nFormatIdx % STATIC_ARRAY_SIZE( spnLineColors ) ]; } sal_uInt16 XclChartHelper::GetSeriesFillAutoColorIdx( sal_uInt16 nFormatIdx ) @@ -419,13 +419,13 @@ sal_uInt16 XclChartHelper::GetSeriesFillAutoColorIdx( sal_uInt16 nFormatIdx ) 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; - return spnFillColors[ nFormatIdx % STATIC_TABLE_SIZE( spnFillColors ) ]; + return spnFillColors[ nFormatIdx % STATIC_ARRAY_SIZE( spnFillColors ) ]; } sal_uInt8 XclChartHelper::GetSeriesFillAutoTransp( sal_uInt16 nFormatIdx ) { static const sal_uInt8 spnTrans[] = { 0x00, 0x40, 0x20, 0x60, 0x70 }; - return spnTrans[ (nFormatIdx / 56) % STATIC_TABLE_SIZE( spnTrans ) ]; + return spnTrans[ (nFormatIdx / 56) % STATIC_ARRAY_SIZE( spnTrans ) ]; } sal_uInt16 XclChartHelper::GetAutoMarkerType( sal_uInt16 nFormatIdx ) @@ -434,14 +434,14 @@ sal_uInt16 XclChartHelper::GetAutoMarkerType( sal_uInt16 nFormatIdx ) EXC_CHMARKERFORMAT_DIAMOND, EXC_CHMARKERFORMAT_SQUARE, EXC_CHMARKERFORMAT_TRIANGLE, EXC_CHMARKERFORMAT_CROSS, EXC_CHMARKERFORMAT_STAR, EXC_CHMARKERFORMAT_CIRCLE, EXC_CHMARKERFORMAT_PLUS, EXC_CHMARKERFORMAT_DOWJ, EXC_CHMARKERFORMAT_STDDEV }; - return spnSymbols[ nFormatIdx % STATIC_TABLE_SIZE( spnSymbols ) ]; + return spnSymbols[ nFormatIdx % STATIC_ARRAY_SIZE( spnSymbols ) ]; } bool XclChartHelper::HasMarkerFillColor( sal_uInt16 nMarkerType ) { static const bool spbFilled[] = { false, true, true, true, false, false, false, false, true, false }; - return (nMarkerType < STATIC_TABLE_SIZE( spbFilled )) && spbFilled[ nMarkerType ]; + return (nMarkerType < STATIC_ARRAY_SIZE( spbFilled )) && spbFilled[ nMarkerType ]; } OUString XclChartHelper::GetErrorBarValuesRole( sal_uInt8 nBarType ) @@ -488,7 +488,7 @@ static const XclChFormatInfo spFmtInfos[] = XclChFormatInfoProvider::XclChFormatInfoProvider() { - const XclChFormatInfo* pEnd = STATIC_TABLE_END( spFmtInfos ); + const XclChFormatInfo* pEnd = STATIC_ARRAY_END( spFmtInfos ); for( const XclChFormatInfo* pIt = spFmtInfos; pIt != pEnd; ++pIt ) maInfoMap[ pIt->meObjType ] = pIt; } @@ -557,7 +557,7 @@ void XclChExtTypeInfo::Set( const XclChTypeInfo& rTypeInfo, bool b3dChart, bool XclChTypeInfoProvider::XclChTypeInfoProvider() { - const XclChTypeInfo* pEnd = STATIC_TABLE_END( spTypeInfos ); + const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) maInfoMap[ pIt->meTypeId ] = pIt; } @@ -571,7 +571,7 @@ const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfo( XclChTypeId eTypeId ) c const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromRecId( sal_uInt16 nRecId ) const { - const XclChTypeInfo* pEnd = STATIC_TABLE_END( spTypeInfos ); + const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) if( pIt->mnRecId == nRecId ) return *pIt; @@ -581,7 +581,7 @@ const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromRecId( sal_uInt16 nRe const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromService( const OUString& rServiceName ) const { - const XclChTypeInfo* pEnd = STATIC_TABLE_END( spTypeInfos ); + const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) if( rServiceName.equalsAscii( pIt->mpcServiceName ) ) return *pIt; diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index e75364ab9fc7..66fd74f2a64e 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -419,16 +419,16 @@ XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot ) from earlier tables. */ XclBiff eBiff = rRoot.GetBiff(); if( eBiff >= EXC_BIFF2 ) - (this->*pFillFunc)( saFuncTable_2, STATIC_TABLE_END( saFuncTable_2 ) ); + (this->*pFillFunc)( saFuncTable_2, STATIC_ARRAY_END( saFuncTable_2 ) ); if( eBiff >= EXC_BIFF3 ) - (this->*pFillFunc)( saFuncTable_3, STATIC_TABLE_END( saFuncTable_3 ) ); + (this->*pFillFunc)( saFuncTable_3, STATIC_ARRAY_END( saFuncTable_3 ) ); if( eBiff >= EXC_BIFF4 ) - (this->*pFillFunc)( saFuncTable_4, STATIC_TABLE_END( saFuncTable_4 ) ); + (this->*pFillFunc)( saFuncTable_4, STATIC_ARRAY_END( saFuncTable_4 ) ); if( eBiff >= EXC_BIFF5 ) - (this->*pFillFunc)( saFuncTable_5, STATIC_TABLE_END( saFuncTable_5 ) ); + (this->*pFillFunc)( saFuncTable_5, STATIC_ARRAY_END( saFuncTable_5 ) ); if( eBiff >= EXC_BIFF8 ) - (this->*pFillFunc)( saFuncTable_8, STATIC_TABLE_END( saFuncTable_8 ) ); - (this->*pFillFunc)( saFuncTable_Odf, STATIC_TABLE_END( saFuncTable_Odf ) ); + (this->*pFillFunc)( saFuncTable_8, STATIC_ARRAY_END( saFuncTable_8 ) ); + (this->*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) ); } const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx index a59c6f761667..36b451e17f65 100644 --- a/sc/source/filter/excel/xlpage.cxx +++ b/sc/source/filter/excel/xlpage.cxx @@ -203,7 +203,7 @@ void XclPageData::SetDefaults() Size XclPageData::GetScPaperSize() const { const XclPaperSize* pEntry = pPaperSizeTable; - if( mnPaperSize < STATIC_TABLE_SIZE( pPaperSizeTable ) ) + if( mnPaperSize < STATIC_ARRAY_SIZE( pPaperSizeTable ) ) pEntry += mnPaperSize; Size aSize; @@ -230,7 +230,7 @@ void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait ) long nHeight = bPortrait ? rSize.Height() : rSize.Width(); long nMaxWDiff = 80; long nMaxHDiff = 50; - for( const XclPaperSize* pEntry = pPaperSizeTable; pEntry != STATIC_TABLE_END( pPaperSizeTable ); ++pEntry ) + for( const XclPaperSize* pEntry = pPaperSizeTable; pEntry != STATIC_ARRAY_END( pPaperSizeTable ); ++pEntry ) { long nWDiff = Abs( pEntry->mnWidth - nWidth ); long nHDiff = Abs( pEntry->mnHeight - nHeight ); diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx index 4a48584da7fa..a6d94e5efc31 100644 --- a/sc/source/filter/excel/xlstyle.cxx +++ b/sc/source/filter/excel/xlstyle.cxx @@ -111,20 +111,20 @@ XclDefaultPalette::XclDefaultPalette( const XclRoot& rRoot ) : { case EXC_BIFF2: mpnColorTable = spnDefColorTable2; - mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable2 ); + mnTableSize = STATIC_ARRAY_SIZE( spnDefColorTable2 ); break; case EXC_BIFF3: case EXC_BIFF4: mpnColorTable = spnDefColorTable3; - mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable3 ); + mnTableSize = STATIC_ARRAY_SIZE( spnDefColorTable3 ); break; case EXC_BIFF5: mpnColorTable = spnDefColorTable5; - mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable5 ); + mnTableSize = STATIC_ARRAY_SIZE( spnDefColorTable5 ); break; case EXC_BIFF8: mpnColorTable = spnDefColorTable8; - mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable8 ); + mnTableSize = STATIC_ARRAY_SIZE( spnDefColorTable8 ); break; default: DBG_ERROR_BIFF(); @@ -1513,7 +1513,7 @@ void XclNumFmtBuffer::InsertBuiltinFormats() typedef ::std::map< LanguageType, const XclBuiltInFormatTable* > XclBuiltInMap; XclBuiltInMap aBuiltInMap; for( const XclBuiltInFormatTable* pTable = spBuiltInFormatTables; - pTable != STATIC_TABLE_END( spBuiltInFormatTables ); ++pTable ) + pTable != STATIC_ARRAY_END( spBuiltInFormatTables ); ++pTable ) aBuiltInMap[ pTable->meLanguage ] = pTable; // build a list of table pointers for the current language, with all parent tables diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 0dd988d67586..19ffea370cef 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -53,7 +53,7 @@ using ::rtl::OUString; XclGuid::XclGuid() { - ::std::fill( mpnData, STATIC_TABLE_END( mpnData ), 0 ); + ::std::fill( mpnData, STATIC_ARRAY_END( mpnData ), 0 ); } XclGuid::XclGuid( @@ -77,14 +77,14 @@ XclGuid::XclGuid( bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 ) { - return ::std::equal( rCmp1.mpnData, STATIC_TABLE_END( rCmp1.mpnData ), rCmp2.mpnData ); + return ::std::equal( rCmp1.mpnData, STATIC_ARRAY_END( rCmp1.mpnData ), rCmp2.mpnData ); } bool operator<( const XclGuid& rCmp1, const XclGuid& rCmp2 ) { return ::std::lexicographical_compare( - rCmp1.mpnData, STATIC_TABLE_END( rCmp1.mpnData ), - rCmp2.mpnData, STATIC_TABLE_END( rCmp2.mpnData ) ); + rCmp1.mpnData, STATIC_ARRAY_END( rCmp1.mpnData ), + rCmp2.mpnData, STATIC_ARRAY_END( rCmp2.mpnData ) ); } XclImpStream& operator>>( XclImpStream& rStrm, XclGuid& rGuid ) @@ -357,7 +357,7 @@ Color XclTools::GetPatternColor( const Color& rPattColor, const Color& rBackColo 0x40, 0x40, 0x20, 0x60, 0x60, 0x60, 0x60, 0x48, // 08 - 15 0x50, 0x70, 0x78 // 16 - 18 }; - return (nXclPattern < STATIC_TABLE_SIZE( pnRatioTable )) ? + return (nXclPattern < STATIC_ARRAY_SIZE( pnRatioTable )) ? ScfTools::GetMixedColor( rPattColor, rBackColor, pnRatioTable[ nXclPattern ] ) : rPattColor; } @@ -409,7 +409,7 @@ pCodePageTable[] = { 32768, RTL_TEXTENCODING_APPLE_ROMAN }, // Apple Roman { 32769, RTL_TEXTENCODING_MS_1252 } // MS Windows Latin I (BIFF2-BIFF3) }; -const XclCodePageEntry* const pCodePageTableEnd = STATIC_TABLE_END( pCodePageTable ); +const XclCodePageEntry* const pCodePageTableEnd = STATIC_ARRAY_END( pCodePageTable ); struct XclCodePageEntry_CPPred { @@ -487,10 +487,10 @@ static const sal_Char* const ppcDefNames[] = String XclTools::GetXclBuiltInDefName( sal_Unicode cBuiltIn ) { - DBG_ASSERT( STATIC_TABLE_SIZE( ppcDefNames ) == EXC_BUILTIN_UNKNOWN, + DBG_ASSERT( STATIC_ARRAY_SIZE( ppcDefNames ) == EXC_BUILTIN_UNKNOWN, "XclTools::GetXclBuiltInDefName - built-in defined name list modified" ); String aDefName; - if( cBuiltIn < STATIC_TABLE_SIZE( ppcDefNames ) ) + if( cBuiltIn < STATIC_ARRAY_SIZE( ppcDefNames ) ) aDefName.AssignAscii( ppcDefNames[ cBuiltIn ] ); else aDefName = String::CreateFromInt32( cBuiltIn ); @@ -554,7 +554,7 @@ String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, s else { aStyleName = maStyleNamePrefix1; - if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) ) + if( nStyleId < STATIC_ARRAY_SIZE( ppcStyleNames ) ) aStyleName.AppendAscii( ppcStyleNames[ nStyleId ] ); else if( rName.Len() > 0 ) aStyleName.Append( rName ); @@ -594,7 +594,7 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI if( nPrefixLen > 0 ) { String aShortName; - for( sal_uInt8 nId = 0; nId < STATIC_TABLE_SIZE( ppcStyleNames ); ++nId ) + for( sal_uInt8 nId = 0; nId < STATIC_ARRAY_SIZE( ppcStyleNames ); ++nId ) { if( nId != EXC_STYLE_NORMAL ) { diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index c17aaa70445c..8b357514811f 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -41,11 +41,6 @@ // Common macros ============================================================== -/** Expands to the size of a STATIC data array. */ -#define STATIC_TABLE_SIZE( array ) (sizeof(array)/sizeof(*(array))) -/** Expands to a pointer behind the last element of a STATIC data array (like STL end()). */ -#define STATIC_TABLE_END( array ) ((array)+STATIC_TABLE_SIZE(array)) - /** Expands to a temporary String, created from an ASCII character array. */ #define CREATE_STRING( ascii ) String( RTL_CONSTASCII_USTRINGPARAM( ascii ) ) diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index 4de6246f4f28..a23a80c9d9ac 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -436,7 +436,7 @@ const ScXMLConditionInfo* lclGetConditionInfo( const sal_Unicode*& rpcString, co // search the table for an entry if( nLength > 0 ) - for( const ScXMLConditionInfo* pInfo = spConditionInfos; pInfo < STATIC_TABLE_END( spConditionInfos ); ++pInfo ) + for( const ScXMLConditionInfo* pInfo = spConditionInfos; pInfo < STATIC_ARRAY_END( spConditionInfos ); ++pInfo ) if( (nLength == pInfo->mnIdentLength) && (::rtl_ustr_ascii_shortenedCompare_WithLength( pcIdStart, nLength, pInfo->mpcIdentifier, nLength ) == 0) ) return pInfo; -- cgit From a80192ef0304302e650b80f071489a73803412b7 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 9 Dec 2010 19:53:09 +0100 Subject: dr78: remove unused member --- sc/source/filter/xml/xmldpimp.cxx | 2 -- sc/source/filter/xml/xmldpimp.hxx | 1 - 2 files changed, 3 deletions(-) diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index ba107347b46a..2aff43393f4b 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -128,7 +128,6 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport, pDPDimSaveData(NULL), sDataPilotTableName(), sApplicationData(), - sGrandTotal(GetXMLToken(XML_BOTH)), mnRowFieldCount(0), mnColFieldCount(0), mnPageFieldCount(0), @@ -165,7 +164,6 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport, break; case XML_TOK_DATA_PILOT_TABLE_ATTR_GRAND_TOTAL : { - sGrandTotal = sValue; if (IsXMLToken(sValue, XML_BOTH)) { maRowGrandTotal.mbVisible = true; diff --git a/sc/source/filter/xml/xmldpimp.hxx b/sc/source/filter/xml/xmldpimp.hxx index 32300138bc3b..2310ceac673d 100644 --- a/sc/source/filter/xml/xmldpimp.hxx +++ b/sc/source/filter/xml/xmldpimp.hxx @@ -96,7 +96,6 @@ class ScXMLDataPilotTableContext : public SvXMLImportContext GrandTotalItem maColGrandTotal; rtl::OUString sDataPilotTableName; rtl::OUString sApplicationData; - rtl::OUString sGrandTotal; rtl::OUString sDatabaseName; rtl::OUString sSourceObject; rtl::OUString sServiceName; -- cgit From a9467d1caf28feb4905433dc08d6f2a08984ef63 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 10 Dec 2010 17:22:41 +0100 Subject: dr78: #i57431# correct property descriptions --- offapi/com/sun/star/sheet/DataPilotDescriptor.idl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl index 992afdef5ed9..6da2733981e6 100644 --- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl +++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl @@ -107,25 +107,26 @@ published service DataPilotDescriptor //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty rows in the source data are ignored. */ [optional, property] boolean IgnoreEmptyRows; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty category cells in the source data should be treated + as repetition of the content from the previous row. */ [optional, property] boolean RepeatIfEmpty; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if columns for grand total results are created. */ [optional, property] boolean ColumnGrand; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if rows for grand total results are created. */ [optional, property] boolean RowGrand; -- cgit From 30ba7425bae370b7555497f7c07910dae2ca6eda Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 10 Dec 2010 17:59:07 +0100 Subject: dr78: #i116044# correct handling of DataPilot grand total name --- sc/source/filter/xml/XMLExportDataPilot.cxx | 2 +- sc/source/filter/xml/xmldpimp.cxx | 5 +++-- sc/source/filter/xml/xmlimprt.cxx | 1 + sc/source/filter/xml/xmlimprt.hxx | 1 + sc/source/ui/dbgui/pvlaydlg.cxx | 8 ++++++++ sc/source/ui/unoobj/dapiuno.cxx | 22 +++++++++++++--------- 6 files changed, 27 insertions(+), 12 deletions(-) mode change 100755 => 100644 sc/source/ui/unoobj/dapiuno.cxx diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index f8cba5ecf6c3..07d1250a76aa 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -743,7 +743,7 @@ void ScXMLExportDataPilot::WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient if (pGrandTotal) rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pGrandTotal); - SvXMLElementExport aElemGrandTotal(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, sal_True, sal_True); + SvXMLElementExport aElemGrandTotal(rExport, XML_NAMESPACE_TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL, sal_True, sal_True); } void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference & /* xSpreadDoc */) diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index 2aff43393f4b..512e1efa424b 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -264,6 +264,7 @@ SvXMLImportContext *ScXMLDataPilotTableContext::CreateChildContext( USHORT nPref } break; case XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL: + case XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT: { pContext = new ScXMLDataPilotGrandTotalContext(GetScImport(), nPrefix, rLName, xAttrList, this); } @@ -792,9 +793,9 @@ ScXMLDataPilotGrandTotalContext::~ScXMLDataPilotGrandTotalContext() } SvXMLImportContext* ScXMLDataPilotGrandTotalContext::CreateChildContext( - USHORT /*nPrefix*/, const ::rtl::OUString& /*rLocalName*/, const Reference& /*xAttrList*/ ) + USHORT nPrefix, const ::rtl::OUString& rLocalName, const Reference& /*xAttrList*/ ) { - return NULL; + return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); } void ScXMLDataPilotGrandTotalContext::EndElement() diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 269e1dd9a7e4..2c59a261e35b 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1347,6 +1347,7 @@ const SvXMLTokenMap& ScXMLImport::GetDataPilotTableElemTokenMap() { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL }, { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE }, { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL }, + { XML_NAMESPACE_TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT }, { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY }, { XML_NAMESPACE_TABLE, XML_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE }, { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE }, diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index 9771655ebd4b..bce59cefab14 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -489,6 +489,7 @@ enum ScXMLDataPilotTableElemTokens XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL, + XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE, diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index 56d7e3550cda..62b3665ab27b 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -1626,6 +1626,14 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG ) } } + // also transfer grand total name + if (pOldSaveData) + { + const OUString* pGrandTotalName = pOldSaveData->GetGrandTotalName(); + if (pGrandTotalName) + aSaveData.SetGrandTotalName(*pGrandTotalName); + } + USHORT nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE ); ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable ); diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx old mode 100755 new mode 100644 index c7bf89671161..a19d251699eb --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -108,6 +108,7 @@ const SfxItemPropertyMapEntry* lcl_GetDataPilotDescriptorBaseMap() { {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_DRILLDOWN), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_GRANDTOTAL_NAME),0,&getCppuType((rtl::OUString*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS), 0, &getBooleanCppuType(), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_IMPORTDESC), 0, &getCppuType((uno::Sequence*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 }, @@ -343,8 +344,6 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd if ( pColl ) { // count tables on this sheet - // api only handles sheet data at this time - //! allow all data sources!!! sal_Int32 nFound = 0; USHORT nCount = pColl->GetCount(); for (USHORT i=0; iGetCount(); @@ -557,8 +554,6 @@ Sequence SAL_CALL ScDataPilotTablesObj::getElementNames() if ( pColl ) { // count tables on this sheet - // api only handles sheet data at this time - //! allow all data sources!!! USHORT nFound = 0; USHORT nCount = pColl->GetCount(); @@ -600,9 +595,6 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) USHORT nCount = pColl->GetCount(); for (USHORT i=0; iGetOutRange().aStart.Tab() == nTab && pDPObj->GetName() == aNamStr ) @@ -824,6 +816,12 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp { aNewData.SetDrillDown(::cppu::any2bool( aValue )); } + else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) ) + { + rtl::OUString aStrVal; + if ( aValue >>= aStrVal ) + aNewData.SetGrandTotalName(aStrVal); + } else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) ) { uno::Sequence aArgSeq; @@ -967,6 +965,12 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope { aRet = ::cppu::bool2any( aNewData.GetDrillDown() ); } + else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) ) + { + const rtl::OUString* pGrandTotalName = aNewData.GetGrandTotalName(); + if (pGrandTotalName) + aRet <<= *pGrandTotalName; // same behavior as in ScDPSource + } else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) ) { const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc(); -- cgit From 7a95aae89febbc37b9f73be444058dfb70240f72 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 10 Dec 2010 17:59:07 +0100 Subject: dr78: #i116044# correct handling of DataPilot grand total name --- offapi/com/sun/star/sheet/DataPilotDescriptor.idl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl index 6da2733981e6..89db817d5324 100644 --- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl +++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl @@ -143,6 +143,14 @@ published service DataPilotDescriptor [optional, property] boolean DrillDownOnDoubleClick; //------------------------------------------------------------------------- + + /** specifies a label for grand total results. + + @since OOo 3.4 + */ + [optional, property] string GrandTotalName; + + //------------------------------------------------------------------------- }; //============================================================================= -- cgit From 9664063f4ec126bf5679a8d4c7a3ea92ac1b0215 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Sat, 11 Dec 2010 16:08:03 +0100 Subject: dr78: #i115906# obtain correct data range for external references * Apparently ScTable::GetFirstDataPos() never worked as intended and selected the first non-empty row of the first non-empty column instead of also taking following columns into account where non-empty rows may be on top of that. * Caller of ScDocument::ShrinkToDataArea() must check the return value, if false there is no data in the area passed and the values obtained may be out of bounds, not in order or unmodified. * In ScExternalRefMgr a call of ScDocument::ShrinkToUsedDataArea() was intended instead of ScDocument::ShrinkToDataArea(). For this changed the return of ShrinkToUsedDataArea() to flag if there is any data and added an out parameter to flag if the area was shrunk. * Sanitized arguments and slightly optimized ScTable::ShrinkToUsedDataArea() to not have to check for >0 and ShrinkToUsedDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly); + } + return pTab[nTab]->ShrinkToUsedDataArea( o_bShrunk, rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly); } // zusammenhaengender Bereich diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index e534bb9dfb78..34fd2fd121af 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -742,18 +742,28 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S } -bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, +bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const { - bool bRet = false; - bool bChanged; + o_bShrunk = false; + + PutInOrder( rStartCol, rEndCol); + PutInOrder( rStartRow, rEndRow); + if (rStartCol < 0) + rStartCol = 0, o_bShrunk = true; + if (rStartRow < 0) + rStartRow = 0, o_bShrunk = true; + if (rEndCol > MAXCOL) + rEndCol = MAXCOL, o_bShrunk = true; + if (rEndRow > MAXROW) + rEndRow = MAXROW, o_bShrunk = true; + bool bChanged; do { bChanged = false; - bool bCont = true; - while (rEndCol > 0 && bCont && rStartCol < rEndCol) + while (rStartCol < rEndCol) { if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow)) { @@ -761,11 +771,10 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, bChanged = true; } else - bCont = false; + break; // while } - bCont = true; - while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol) + while (rStartCol < rEndCol) { if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow)) { @@ -773,12 +782,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, bChanged = true; } else - bCont = false; + break; // while } if (!bColumnsOnly) { - if (rStartRow < MAXROW && rStartRow < rEndRow) + if (rStartRow < rEndRow) { bool bFound = false; for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) @@ -791,7 +800,7 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, } } - if (rEndRow > 0 && rStartRow < rEndRow) + if (rStartRow < rEndRow) { bool bFound = false; for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) @@ -806,9 +815,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, } if (bChanged) - bRet = true; + o_bShrunk = true; } while( bChanged ); - return bRet; + + return rStartCol != rEndCol || (bColumnsOnly ? + !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) : + (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow))); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 9bb22b68d2ad..e3f04f95e35c 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1135,10 +1135,16 @@ ScBaseCell* ScTable::GetCell( SCCOL nCol, SCROW nRow ) const void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const { rCol = 0; - rRow = 0; + rRow = MAXROW+1; while (aCol[rCol].IsEmptyData() && rCol < MAXCOL) ++rCol; - rRow = aCol[rCol].GetFirstDataPos(); + SCCOL nCol = rCol; + while (nCol <= MAXCOL && rRow > 0) + { + if (!aCol[nCol].IsEmptyData()) + rRow = ::std::min( rRow, aCol[nCol].GetFirstDataPos()); + ++nCol; + } } void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const @@ -1148,11 +1154,8 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const while (aCol[rCol].IsEmptyData() && (rCol > 0)) rCol--; SCCOL nCol = rCol; - while ((SCsCOL)nCol >= 0) - { - rRow = Max(rRow, aCol[nCol].GetLastDataPos()); - nCol--; - } + while (nCol >= 0 && rRow < MAXROW) + rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos()); } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 7fa31246275a..ba39316768b7 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -1392,7 +1392,8 @@ static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, ScRange& rRang // Only loop within the data area. SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2; SCROW nDataRow1 = nRow1, nDataRow2 = nRow2; - if (!pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2)) + bool bShrunk; + if (!pSrcDoc->ShrinkToUsedDataArea( bShrunk, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, false)) // no data within specified range. continue; @@ -1708,8 +1709,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken( SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL; SCROW nDataRow1 = 0, nDataRow2 = MAXROW; - pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2); - if (rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row()) + bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2); + if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row()) { // requested cell is outside the data area. Don't even bother caching // this data, but add it to the cached range to prevent accessing the diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 1e5a6b9da4ae..f2a277b987df 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -159,7 +159,10 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection e ScDocument* pDoc = pDocSh->GetDocument(); SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); - if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly)) + bool bShrunk; + pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(), + nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly); + if (bShrunk) { aRange.aStart.SetCol(nCol1); aRange.aEnd.SetCol(nCol2); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index c0af39226c3f..6034ac81ecba 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -97,7 +97,9 @@ String __EXPORT ScTabViewShell::GetSelectionText( BOOL bWholeWord ) SCROW nRow1, nRow2; SCTAB nTab1, nTab2; aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); - if (pDoc->ShrinkToUsedDataArea( nTab1, nCol1, nRow1, nCol2, nRow2, false)) + bool bShrunk; + pDoc->ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false); + if (bShrunk) { aRange.aStart.SetCol( nCol1 ); aRange.aStart.SetRow( nRow1 ); -- cgit From 5350e05fa5eda4517b28c1e0e3a7ac4833452ba5 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 13 Dec 2010 16:09:31 +0100 Subject: dr78: #i115474# use correct defaults for clipboard text import options --- sc/source/ui/dbgui/scuiasciiopt.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 42f2a2d86933..a8cf020b195f 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -201,7 +201,7 @@ static void save_Separators( // ---------------------------------------------------------------------------- ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, - SvStream* pInStream, sal_Unicode /*cSep*/ ) : + SvStream* pInStream, sal_Unicode cSep ) : ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ), mpDatStream ( pInStream ), mnStreamPos( pInStream ? pInStream->Tell() : 0 ), @@ -268,7 +268,6 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, } SetText( aName ); - OUString sFieldSeparators; OUString sTextSeparators; bool bMergeDelimiters = false; @@ -282,6 +281,12 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, // load separators only when importing csv files. load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage); + else + { + // #i115474# otherwise use sensible defaults + sFieldSeparators = OUString( cSep ); + sTextSeparators = OUString( ScAsciiOptions::cDefaultTextSep ); + } maFieldSeparators = String(sFieldSeparators); if( bMergeDelimiters ) -- cgit From 4e7a88638a1293491fb06f3d1d4c0e22cd4c7631 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 14 Dec 2010 14:40:00 +0100 Subject: dr78: simplified handling of external add-in functions, changed handling of empty function parameters --- oox/inc/oox/xls/formulabase.hxx | 4 ++-- oox/inc/oox/xls/formulaparser.hxx | 1 + oox/source/xls/formulabase.cxx | 15 ++++++-------- oox/source/xls/formulaparser.cxx | 42 +++++++++++++++++++++++++++++++++------ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx index 510404d2b662..fe4533680424 100644 --- a/oox/inc/oox/xls/formulabase.hxx +++ b/oox/inc/oox/xls/formulabase.hxx @@ -473,8 +473,8 @@ struct FunctionParamInfo containing supported sheet functions. */ enum FunctionLibraryType { - FUNCLIB_EUROTOOL, /// EuroTool add-in with EUROCONVERT function. - FUNCLIB_UNKNOWN /// Unknown library. + FUNCLIB_UNKNOWN = 0, /// Unknown library (must be zero). + FUNCLIB_EUROTOOL /// EuroTool add-in with EUROCONVERT function. }; // ---------------------------------------------------------------------------- diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx index 0227e8efee6d..fc3fee3ba43c 100644 --- a/oox/inc/oox/xls/formulaparser.hxx +++ b/oox/inc/oox/xls/formulaparser.hxx @@ -87,6 +87,7 @@ private: const ApiToken* getSingleToken( const ApiToken* pToken, const ApiToken* pTokenEnd ) const; const ApiToken* skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const; const ApiToken* findParameters( ParameterPosVector& rParams, const ApiToken* pToken, const ApiToken* pTokenEnd ) const; + void appendEmptyParameter( const FunctionInfo& rFuncInfo, size_t nParam ); void appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam ); void appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount ); diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index 5e1ed6b35141..c7a11c7c1cdd 100644 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -237,8 +237,10 @@ const sal_uInt16 FUNCFLAG_MACROCMD = 0x0080; /// Function is a macro- const sal_uInt16 FUNCFLAG_ALWAYSVAR = 0x0100; /// Function is always represented by a tFuncVar token. const sal_uInt16 FUNCFLAG_PARAMPAIRS = 0x0200; /// Optional parameters are expected to appear in pairs. -const sal_uInt16 FUNCFLAG_FUNCLIBMASK = 0xF000; /// Mask for function library bits. -const sal_uInt16 FUNCFLAG_EUROTOOL = 0x1000; /// Function is part of the EuroTool add-in. +/// Converts a function library index (value of enum FunctionLibraryType) to function flags. +#define FUNCLIB_TO_FUNCFLAGS( funclib_index ) static_cast< sal_uInt16 >( static_cast< sal_uInt8 >( funclib_index ) << 12 ) +/// Extracts a function library index (value of enum FunctionLibraryType) from function flags. +#define FUNCFLAGS_TO_FUNCLIB( func_flags ) extractValue< FunctionLibraryType >( func_flags, 12, 4 ) typedef ::boost::shared_ptr< FunctionInfo > FunctionInfoRef; @@ -688,7 +690,7 @@ static const FunctionData saFuncTableBiff5[] = // *** EuroTool add-in *** - { "EUROCONVERT", "EUROCONVERT", NOID, NOID, 3, 5, V, { VR }, FUNCFLAG_EUROTOOL }, + { "EUROCONVERT", "EUROCONVERT", NOID, NOID, 3, 5, V, { VR }, FUNCLIB_TO_FUNCFLAGS( FUNCLIB_EUROTOOL ) }, // *** macro sheet commands *** @@ -925,12 +927,7 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfnodf." ) + xFuncInfo->maOdfFuncName; } - switch( rFuncData.mnFlags & FUNCFLAG_FUNCLIBMASK ) - { - case FUNCFLAG_EUROTOOL: xFuncInfo->meFuncLibType = FUNCLIB_EUROTOOL; break; - default: xFuncInfo->meFuncLibType = FUNCLIB_UNKNOWN; - } - + xFuncInfo->meFuncLibType = FUNCFLAGS_TO_FUNCLIB( rFuncData.mnFlags ); xFuncInfo->mnApiOpCode = -1; xFuncInfo->mnOobFuncId = rFuncData.mnOobFuncId; xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId; diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index 12deadecd695..bc5d30bc98c4 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -126,7 +126,6 @@ const FunctionInfo* FormulaFinalizer::getFunctionInfo( ApiToken& orFuncToken ) // no success - return null return 0; - } const FunctionInfo* FormulaFinalizer::getExternCallInfo( ApiToken& orFuncToken, const ApiToken& rECToken ) @@ -248,17 +247,29 @@ const ApiToken* FormulaFinalizer::processParameters( if( !aParamInfoIt.isExcelOnlyParam() ) { - // replace empty second and third parameter in IF function with zeros - if( (pRealFuncInfo->mnOobFuncId == OOBIN_FUNC_IF) && ((nParam == 1) || (nParam == 2)) && bIsEmpty ) + // handle empty parameters + if( bIsEmpty ) { - maTokens.append< double >( OPCODE_PUSH, 0.0 ); - bIsEmpty = false; + // append leading space tokens from original token array + while( (pParamBegin < pParamEnd) && (pParamBegin->OpCode == OPCODE_SPACES) ) + maTokens.push_back( *pParamBegin++ ); + // add default values for some empty parameters, or the OPCODE_MISSING token + appendEmptyParameter( *pRealFuncInfo, nParam ); + // reset bIsEmpty flag, if something has been appended in appendEmptyParameter() + bIsEmpty = maTokens.back().OpCode == OPCODE_MISSING; + // skip OPCODE_MISSING token in the original token array + OSL_ENSURE( (pParamBegin == pParamEnd) || (pParamBegin->OpCode == OPCODE_MISSING), "FormulaFinalizer::processParameters - OPCODE_MISSING expected" ); + if( pParamBegin < pParamEnd ) ++pParamBegin; + // append trailing space tokens from original token array + while( (pParamBegin < pParamEnd) && (pParamBegin->OpCode == OPCODE_SPACES) ) + maTokens.push_back( *pParamBegin++ ); } else { - // process all tokens of the parameter + // if parameter is not empty, process all tokens of the parameter processTokens( pParamBegin, pParamEnd ); } + // append parameter separator token maTokens.append( OPCODE_SEP ); } @@ -365,6 +376,25 @@ const ApiToken* FormulaFinalizer::findParameters( ParameterPosVector& rParams, return (pToken < pTokenEnd) ? (pToken + 1) : pTokenEnd; } +void FormulaFinalizer::appendEmptyParameter( const FunctionInfo& rFuncInfo, size_t nParam ) +{ + // remeber old size of the token array + size_t nTokenArraySize = maTokens.size(); + + switch( rFuncInfo.mnOobFuncId ) + { + case OOBIN_FUNC_IF: + if( (nParam == 1) || (nParam == 2) ) + maTokens.append< double >( OPCODE_PUSH, 0.0 ); + break; + default:; + } + + // if no token has been added, append a OPCODE_MISSING token + if( nTokenArraySize == maTokens.size() ) + maTokens.append( OPCODE_MISSING ); +} + void FormulaFinalizer::appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam ) { (void)nParam; // prevent 'unused' warning -- cgit From 71a1872a71f28b6f1951206bdfd5e172a8f90409 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 14 Dec 2010 14:46:13 +0100 Subject: dr78: correct include guard --- oox/inc/oox/core/relations.hxx | 6 +++--- oox/inc/oox/core/relationshandler.hxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx index 4ca8ca3899e7..a7c2fbf963b6 100644 --- a/oox/inc/oox/core/relations.hxx +++ b/oox/inc/oox/core/relations.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef OOX_CORE_RELATIONS -#define OOX_CORE_RELATIONS +#ifndef OOX_CORE_RELATIONS_HXX +#define OOX_CORE_RELATIONS_HXX #include #include @@ -98,5 +98,5 @@ private: } // namespace core } // namespace oox -#endif // OOX_CORE_RELATIONS +#endif diff --git a/oox/inc/oox/core/relationshandler.hxx b/oox/inc/oox/core/relationshandler.hxx index 3211888ecc9f..b3dbe7557d72 100644 --- a/oox/inc/oox/core/relationshandler.hxx +++ b/oox/inc/oox/core/relationshandler.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef OOX_CORE_RELATIONSHANDLER -#define OOX_CORE_RELATIONSHANDLER +#ifndef OOX_CORE_RELATIONSHANDLER_HXX +#define OOX_CORE_RELATIONSHANDLER_HXX #include "oox/core/fragmenthandler.hxx" @@ -57,5 +57,5 @@ private: } // namespace core } // namespace oox -#endif // OOX_CORE_RELATIONSHANDLER +#endif -- cgit From e1a7b5e79ef6ab714395bbde2d8534bc4ea75ea8 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 14 Dec 2010 17:38:44 +0100 Subject: dr78: #i115659# check validity of member and dimension settings --- sc/inc/dpsave.hxx | 10 +++++----- sc/source/filter/excel/xepivot.cxx | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx index 8272b850b27e..b79b15024969 100644 --- a/sc/inc/dpsave.hxx +++ b/sc/inc/dpsave.hxx @@ -69,16 +69,16 @@ public: BOOL operator== ( const ScDPSaveMember& r ) const; const String& GetName() const { return aName; } - BOOL HasIsVisible() const; - SC_DLLPUBLIC void SetIsVisible(BOOL bSet); + SC_DLLPUBLIC BOOL HasIsVisible() const; + SC_DLLPUBLIC void SetIsVisible(BOOL bSet); BOOL GetIsVisible() const { return BOOL(nVisibleMode); } - BOOL HasShowDetails() const; - SC_DLLPUBLIC void SetShowDetails(BOOL bSet); + SC_DLLPUBLIC BOOL HasShowDetails() const; + SC_DLLPUBLIC void SetShowDetails(BOOL bSet); BOOL GetShowDetails() const { return BOOL(nShowDetailsMode); } void SetName( const String& rNew ); // used if the source member was renamed (groups) - SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName ); + SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName ); SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const; void RemoveLayoutName(); diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index ddcdb3243167..75f9235ee61e 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -976,8 +976,10 @@ const String& XclExpPTItem::GetItemName() const void XclExpPTItem::SetPropertiesFromMember( const ScDPSaveMember& rSaveMem ) { - ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDDEN, !rSaveMem.GetIsVisible() ); - ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, !rSaveMem.GetShowDetails() ); + // #i115659# GetIsVisible() is not valid if HasIsVisible() returns false, default is true then + ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDDEN, !rSaveMem.HasIsVisible() || !rSaveMem.GetIsVisible() ); + // #i115659# GetShowDetails() is not valid if HasShowDetails() returns false, default is true then + ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, !rSaveMem.HasShowDetails() || !rSaveMem.GetShowDetails() ); // visible name const OUString* pVisName = rSaveMem.GetLayoutName(); @@ -1072,8 +1074,8 @@ void XclExpPTField::SetPropertiesFromDim( const ScDPSaveDimension& rSaveDim ) DBG_ASSERT( eOrient != DataPilotFieldOrientation_DATA, "XclExpPTField::SetPropertiesFromDim - called for data field" ); maFieldInfo.AddApiOrient( eOrient ); - // show empty items - ::set_flag( maFieldExtInfo.mnFlags, EXC_SXVDEX_SHOWALL, rSaveDim.GetShowEmpty() ); + // show empty items (#i115659# GetShowEmpty() is not valid if HasShowEmpty() returns false, default is false then) + ::set_flag( maFieldExtInfo.mnFlags, EXC_SXVDEX_SHOWALL, rSaveDim.HasShowEmpty() && rSaveDim.GetShowEmpty() ); // visible name const OUString* pLayoutName = rSaveDim.GetLayoutName(); -- cgit From 30917c830ac34cf3a5c5e853b8f3baf8166edfac Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 14 Dec 2010 18:06:15 +0100 Subject: dr78: #i115659# fix borked boolean logic --- sc/source/filter/excel/xepivot.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 75f9235ee61e..1e4a6f30e743 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -976,10 +976,10 @@ const String& XclExpPTItem::GetItemName() const void XclExpPTItem::SetPropertiesFromMember( const ScDPSaveMember& rSaveMem ) { - // #i115659# GetIsVisible() is not valid if HasIsVisible() returns false, default is true then - ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDDEN, !rSaveMem.HasIsVisible() || !rSaveMem.GetIsVisible() ); - // #i115659# GetShowDetails() is not valid if HasShowDetails() returns false, default is true then - ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, !rSaveMem.HasShowDetails() || !rSaveMem.GetShowDetails() ); + // #i115659# GetIsVisible() is not valid if HasIsVisible() returns false, default is 'visible' then + ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDDEN, rSaveMem.HasIsVisible() && !rSaveMem.GetIsVisible() ); + // #i115659# GetShowDetails() is not valid if HasShowDetails() returns false, default is 'show detail' then + ::set_flag( maItemInfo.mnFlags, EXC_SXVI_HIDEDETAIL, rSaveMem.HasShowDetails() && !rSaveMem.GetShowDetails() ); // visible name const OUString* pVisName = rSaveMem.GetLayoutName(); -- cgit From ca822d2265131318e1376194f91bcdd469e8c6ae Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 15 Dec 2010 16:52:27 +0100 Subject: dr78: #i66100# call resize handler for dialogs directly (without timer) --- vcl/source/window/winproc.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index c964ad0d739b..376c6b835722 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1647,7 +1647,13 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ) // #i42750# presentation wants to be informed about resize // as early as possible WorkWindow* pWorkWindow = dynamic_cast(pWindow->ImplGetWindowImpl()->mpClientWindow); - if( pWorkWindow && pWorkWindow->IsPresentationMode() ) + if( ! pWorkWindow || pWorkWindow->IsPresentationMode() ) + bStartTimer = false; + } + else + { + WorkWindow* pWorkWindow = dynamic_cast(pWindow); + if( ! pWorkWindow || pWorkWindow->IsPresentationMode() ) bStartTimer = false; } } -- cgit From 81791d120be82d5387064759e42c5bb318db7cde Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 15 Dec 2010 17:43:27 +0100 Subject: dr78: #i71810# rework import of fill bitmap mode: ignore CHPICFORMAT record except for bar chart series/points and for 3D walls/floor --- sc/source/filter/excel/xechart.cxx | 2 +- sc/source/filter/excel/xichart.cxx | 54 ++++++++++++++++++++++---------------- sc/source/filter/excel/xlchart.cxx | 15 ++++++----- sc/source/filter/inc/xichart.hxx | 16 ++++++----- sc/source/filter/inc/xlchart.hxx | 15 ++++------- 5 files changed, 55 insertions(+), 47 deletions(-) mode change 100644 => 100755 sc/source/filter/inc/xlchart.hxx diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index b6b136da4b1e..ec616b4e6027 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -663,7 +663,7 @@ bool XclExpChEscherFormat::HasSubRecords() const void XclExpChEscherFormat::WriteSubRecords( XclExpStream& rStrm ) { rStrm.StartRecord( EXC_ID_CHPICFORMAT, 14 ); - rStrm << maPicFmt.mnBmpMode << maPicFmt.mnFormat << maPicFmt.mnFlags << maPicFmt.mfScale; + rStrm << maPicFmt.mnBmpMode << sal_uInt16( 0 ) << maPicFmt.mnFlags << maPicFmt.mfScale; rStrm.EndRecord(); } diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 7cbd74a836d2..1c623724d8f0 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -316,12 +316,12 @@ void XclImpChRoot::ConvertAreaFormat( ScfPropertySet& rPropSet, } void XclImpChRoot::ConvertEscherFormat( ScfPropertySet& rPropSet, - const XclChEscherFormat& rEscherFmt, const XclChPicFormat& rPicFmt, - XclChPropertyMode ePropMode ) const + const XclChEscherFormat& rEscherFmt, const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().WriteEscherProperties( rPropSet, *mxChData->mxGradientTable, *mxChData->mxHatchTable, *mxChData->mxBitmapTable, - rEscherFmt, rPicFmt, ePropMode ); + rEscherFmt, pPicFmt, nDffFillType, ePropMode ); } void XclImpChRoot::ConvertFont( ScfPropertySet& rPropSet, @@ -469,7 +469,8 @@ void XclImpChAreaFormat::Convert( const XclImpChRoot& rRoot, // ---------------------------------------------------------------------------- -XclImpChEscherFormat::XclImpChEscherFormat( const XclImpRoot& rRoot ) +XclImpChEscherFormat::XclImpChEscherFormat( const XclImpRoot& rRoot ) : + mnDffFillType( mso_fillSolid ) { maData.mxItemSet.reset( new SfxItemSet( rRoot.GetDoc().GetDrawLayer()->GetItemPool() ) ); @@ -483,9 +484,8 @@ void XclImpChEscherFormat::ReadHeaderRecord( XclImpStream& rStrm ) rStrm >> aPropSet; // get the data aPropSet.FillToItemSet( *maData.mxItemSet ); - // get bitmap mode from DFF item set - sal_uInt32 nType = aPropSet.GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); - maPicFmt.mnBmpMode = (nType == mso_fillPicture) ? EXC_CHPICFORMAT_STRETCH : EXC_CHPICFORMAT_STACK; + // get fill type from DFF property set + mnDffFillType = aPropSet.GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); } void XclImpChEscherFormat::ReadSubRecord( XclImpStream& rStrm ) @@ -493,16 +493,18 @@ void XclImpChEscherFormat::ReadSubRecord( XclImpStream& rStrm ) switch( rStrm.GetRecId() ) { case EXC_ID_CHPICFORMAT: - rStrm >> maPicFmt.mnBmpMode >> maPicFmt.mnFormat >> maPicFmt.mnFlags >> maPicFmt.mfScale; + rStrm >> maPicFmt.mnBmpMode; + rStrm.Ignore( 2 ); + rStrm >> maPicFmt.mnFlags >> maPicFmt.mfScale; break; } } void XclImpChEscherFormat::Convert( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, bool bUsePicFmt ) const { const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType ); - rRoot.ConvertEscherFormat( rPropSet, maData, maPicFmt, rFmtInfo.mePropMode ); + rRoot.ConvertEscherFormat( rPropSet, maData, bUsePicFmt ? &maPicFmt : 0, mnDffFillType, rFmtInfo.mePropMode ); } // ---------------------------------------------------------------------------- @@ -563,23 +565,23 @@ void XclImpChFrameBase::ConvertLineBase( const XclImpChRoot& rRoot, } void XclImpChFrameBase::ConvertAreaBase( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { if( rRoot.GetFormatInfo( eObjType ).mbIsFrame ) { // CHESCHERFORMAT overrides CHAREAFORMAT (even if it is auto) if( mxEscherFmt.is() ) - mxEscherFmt->Convert( rRoot, rPropSet, eObjType ); + mxEscherFmt->Convert( rRoot, rPropSet, eObjType, bUsePicFmt ); else if( mxAreaFmt.is() ) mxAreaFmt->Convert( rRoot, rPropSet, eObjType, nFormatIdx ); } } void XclImpChFrameBase::ConvertFrameBase( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { ConvertLineBase( rRoot, rPropSet, eObjType, nFormatIdx ); - ConvertAreaBase( rRoot, rPropSet, eObjType, nFormatIdx ); + ConvertAreaBase( rRoot, rPropSet, eObjType, nFormatIdx, bUsePicFmt ); } // ---------------------------------------------------------------------------- @@ -642,9 +644,9 @@ void XclImpChFrame::UpdateObjFrame( const XclObjLineData& rLineData, const XclOb } } -void XclImpChFrame::Convert( ScfPropertySet& rPropSet ) const +void XclImpChFrame::Convert( ScfPropertySet& rPropSet, bool bUsePicFmt ) const { - ConvertFrameBase( GetChRoot(), rPropSet, meObjType ); + ConvertFrameBase( GetChRoot(), rPropSet, meObjType, EXC_CHDATAFORMAT_UNKNOWN, bUsePicFmt ); } // Source links =============================================================== @@ -1463,8 +1465,15 @@ void XclImpChDataFormat::UpdateTrendLineFormat() void XclImpChDataFormat::Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo ) const { - // line and area format - ConvertFrameBase( GetChRoot(), rPropSet, rTypeInfo.GetSeriesObjectType(), maData.mnFormatIdx ); + /* Line and area format. + #i71810# If the data points are filled with bitmaps, textures, or + patterns, then only bar charts will use the CHPICFORMAT record to + determine stacking/streching mode. All other chart types ignore this + record and always use the property 'fill-type' from the DFF property + set (streched for bitmaps, and stacked for textures and patterns). */ + bool bUsePicFmt = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR; + ConvertFrameBase( GetChRoot(), rPropSet, rTypeInfo.GetSeriesObjectType(), maData.mnFormatIdx, bUsePicFmt ); + #if EXC_CHART2_3DBAR_HAIRLINES_ONLY // #i83151# only hair lines in 3D charts with filled data points if( rTypeInfo.mb3dChart && rTypeInfo.IsSeriesFrameFormat() && mxLineFmt.is() && mxLineFmt->HasLine() ) @@ -1496,9 +1505,9 @@ void XclImpChDataFormat::ConvertLine( ScfPropertySet& rPropSet, XclChObjectType ConvertLineBase( GetChRoot(), rPropSet, eObjType ); } -void XclImpChDataFormat::ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx ) const +void XclImpChDataFormat::ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { - ConvertAreaBase( GetChRoot(), rPropSet, EXC_CHOBJTYPE_FILLEDSERIES, nFormatIdx ); + ConvertAreaBase( GetChRoot(), rPropSet, EXC_CHOBJTYPE_FILLEDSERIES, nFormatIdx, bUsePicFmt ); } void XclImpChDataFormat::RemoveUnusedFormats( const XclChExtTypeInfo& rTypeInfo ) @@ -1942,7 +1951,7 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const for( sal_uInt16 nPointIdx = 0, nPointCount = mxValueLink->GetCellCount(); nPointIdx < nPointCount; ++nPointIdx ) { ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIdx ); - mxSeriesFmt->ConvertArea( aPointProp, bVarPointFmt ? nPointIdx : mnSeriesIdx ); + mxSeriesFmt->ConvertArea( aPointProp, bVarPointFmt ? nPointIdx : mnSeriesIdx, false ); } } @@ -3212,8 +3221,9 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup void XclImpChAxis::ConvertWall( ScfPropertySet& rPropSet ) const { + // #i71810# walls and floor in 3D charts use the CHPICFORMAT record for bitmap mode if( mxWallFrame.is() ) - mxWallFrame->Convert( rPropSet ); + mxWallFrame->Convert( rPropSet, true ); } void XclImpChAxis::ConvertAxisPosition( ScfPropertySet& rPropSet, const XclImpChTypeGroup& rTypeGroup ) const diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 5e0a3884317c..c841feb974fc 100755 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -147,8 +147,7 @@ XclChEscherFormat::~XclChEscherFormat() XclChPicFormat::XclChPicFormat() : mnBmpMode( EXC_CHPICFORMAT_NONE ), - mnFormat( EXC_CHPICFORMAT_DEFAULT ), - mnFlags( EXC_CHPICFORMAT_DEFAULTFLAGS ), + mnFlags( EXC_CHPICFORMAT_TOPBOTTOM | EXC_CHPICFORMAT_FRONTBACK | EXC_CHPICFORMAT_LEFTRIGHT ), mfScale( 0.5 ) { } @@ -529,7 +528,7 @@ static const XclChTypeInfo spTypeInfos[] = { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false }, { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, false }, { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false }, - { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false }, + { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, false, false }, { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false }, { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false }, { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false }, @@ -1050,8 +1049,8 @@ void XclChPropSetHelper::WriteAreaProperties( ScfPropertySet& rPropSet, void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, XclChObjectTable& rGradientTable, XclChObjectTable& /*rHatchTable*/, XclChObjectTable& rBitmapTable, - const XclChEscherFormat& rEscherFmt, const XclChPicFormat& rPicFmt, - XclChPropertyMode ePropMode ) + const XclChEscherFormat& rEscherFmt, const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) { if( rEscherFmt.mxItemSet.is() ) { @@ -1101,8 +1100,10 @@ void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, if( aBmpName.getLength() ) { namespace cssd = ::com::sun::star::drawing; - cssd::BitmapMode eApiBmpMode = (rPicFmt.mnBmpMode == EXC_CHPICFORMAT_STRETCH) ? - cssd::BitmapMode_STRETCH : cssd::BitmapMode_REPEAT; + /* #i71810# Caller decides whether to use a CHPICFORMAT record for bitmap mode. + If not passed, detect fill mode from the DFF property 'fill-type'. */ + bool bStretch = pPicFmt ? (pPicFmt->mnBmpMode == EXC_CHPICFORMAT_STRETCH) : (nDffFillType == mso_fillPicture); + cssd::BitmapMode eApiBmpMode = bStretch ? cssd::BitmapMode_STRETCH : cssd::BitmapMode_REPEAT; maBitmapHlp.InitializeWrite(); maBitmapHlp << cssd::FillStyle_BITMAP << aBmpName << eApiBmpMode; maBitmapHlp.WriteToPropertySet( rPropSet ); diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index d8289b3b671b..421b1f7ad57c 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -153,7 +153,8 @@ public: void ConvertEscherFormat( ScfPropertySet& rPropSet, const XclChEscherFormat& rEscherFmt, - const XclChPicFormat& rPicFmt, + const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) const; /** Writes font properties to the passed property set. */ void ConvertFont( @@ -294,12 +295,13 @@ public: virtual void ReadSubRecord( XclImpStream& rStrm ); /** Converts and writes the contained data to the passed property set. */ - void Convert( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType ) const; + void Convert( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, + XclChObjectType eObjType, bool bUsePicFmt ) const; private: XclChEscherFormat maData; /// Fill properties for complex areas (CHESCHERFORMAT record). XclChPicFormat maPicFmt; /// Image options, e.g. stretched, stacked (CHPICFORMAT record). + sal_uInt32 mnDffFillType; /// Fill type imported from the DFF property set. }; typedef ScfRef< XclImpChEscherFormat > XclImpChEscherFormatRef; @@ -343,11 +345,11 @@ protected: /** Converts and writes the contained area formatting to the passed property set. */ void ConvertAreaBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, XclChObjectType eObjType, - sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const; + sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const; /** Converts and writes the contained data to the passed property set. */ void ConvertFrameBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, XclChObjectType eObjType, - sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const; + sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const; protected: XclImpChLineFormatRef mxLineFmt; /// Line format (CHLINEFORMAT record). @@ -377,7 +379,7 @@ public: void UpdateObjFrame( const XclObjLineData& rLineData, const XclObjFillData& rFillData ); /** Converts and writes the contained data to the passed property set. */ - void Convert( ScfPropertySet& rPropSet ) const; + void Convert( ScfPropertySet& rPropSet, bool bUsePicFmt = false ) const; private: XclChFrame maData; /// Contents of the CHFRAME record. @@ -700,7 +702,7 @@ public: /** Writes the line format only, e.g. for trend lines or error bars. */ void ConvertLine( ScfPropertySet& rPropSet, XclChObjectType eObjType ) const; /** Writes the area format only for the series or a data point. */ - void ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx ) const; + void ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const; private: /** Removes unused formatting (e.g. pie distance in a bar chart). */ diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx old mode 100644 new mode 100755 index 13eda8619cc0..0e38e51b88f4 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -567,14 +567,9 @@ const sal_uInt16 EXC_CHPICFORMAT_STRETCH = 1; /// Bitmap stretched const sal_uInt16 EXC_CHPICFORMAT_STACK = 2; /// Bitmap stacked. const sal_uInt16 EXC_CHPICFORMAT_SCALE = 3; /// Bitmap scaled to axis scale. -const sal_uInt16 EXC_CHPICFORMAT_WMF = 2; -const sal_uInt16 EXC_CHPICFORMAT_BMP = 9; -const sal_uInt16 EXC_CHPICFORMAT_DEFAULT = 19; - -const sal_uInt16 EXC_CHPICFORMAT_WINDOWS = 0x0001; -const sal_uInt16 EXC_CHPICFORMAT_MACOS = 0x0002; -const sal_uInt16 EXC_CHPICFORMAT_FORMATONLY = 0x0100; -const sal_uInt16 EXC_CHPICFORMAT_DEFAULTFLAGS = 0x0E00; /// Default flags for export. +const sal_uInt16 EXC_CHPICFORMAT_TOPBOTTOM = 0x0200; +const sal_uInt16 EXC_CHPICFORMAT_FRONTBACK = 0x0400; +const sal_uInt16 EXC_CHPICFORMAT_LEFTRIGHT = 0x0800; // (0x103D) CHDROPBAR --------------------------------------------------------- @@ -837,7 +832,6 @@ struct XclChEscherFormat struct XclChPicFormat { sal_uInt16 mnBmpMode; /// Bitmap mode, e.g. stretched, stacked. - sal_uInt16 mnFormat; /// Image data format (WMF, BMP). sal_uInt16 mnFlags; /// Additional flags. double mfScale; /// Picture scaling (units). @@ -1404,7 +1398,8 @@ public: XclChObjectTable& rHatchTable, XclChObjectTable& rBitmapTable, const XclChEscherFormat& rEscherFmt, - const XclChPicFormat& rPicFmt, + const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ); /** Writes all marker properties to the passed property set. */ void WriteMarkerProperties( -- cgit From b60db466ef41f4414ef80563dc3b97428336acf5 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 15 Dec 2010 17:43:27 +0100 Subject: dr78: #i71810# rework import of fill bitmap mode: ignore CHPICFORMAT record except for bar chart series/points and for 3D walls/floor --- oox/source/dump/biffdumper.cxx | 2 +- oox/source/dump/biffdumper.ini | 10 -------- oox/source/dump/dffdumper.ini | 53 ++++++++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 30938f9ebbe6..3d6f20ed62ba 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -1909,7 +1909,7 @@ void WorkbookStreamObject::implDumpRecordBody() case BIFF_ID_CHPICFORMAT: dumpDec< sal_uInt16 >( "bitmap-mode", "CHPICFORMAT-BITMAP-MODE" ); - dumpDec< sal_uInt16 >( "image-format", "CHPICFORMAT-IMAGE-FORMAT" ); + dumpUnused( 2 ); dumpHex< sal_uInt16 >( "flags", "CHPICFORMAT-FLAGS" ); dumpDec< double >( "scaling-factor" ); break; diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 97685c850515..8e1626f82659 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -1045,17 +1045,7 @@ end shortlist=CHPICFORMAT-BITMAP-MODE,1,stretched,stacked,stacked-scaled -constlist=CHPICFORMAT-IMAGE-FORMAT - 2=wmf - 9=bmp - 19=?emf -end - -shortlist=CHPICFORMAT-ENV,1,windows,apple - combilist=CHPICFORMAT-FLAGS - 0x00FF=uint16,dec,environment,CHPICFORMAT-ENV - 0x0100=format-only 0x0200=top-bottom 0x0400=front-back 0x0800=left-right diff --git a/oox/source/dump/dffdumper.ini b/oox/source/dump/dffdumper.ini index c33d733c6bd8..ebdf652afcfa 100644 --- a/oox/source/dump/dffdumper.ini +++ b/oox/source/dump/dffdumper.ini @@ -79,6 +79,9 @@ end shortlist=DFF-COLORMOD-TYPE,0,none,shade,tint +unitconverter=DFF-OPACITY,/655.36,% +unitconverter=DFF-DEGREES,/65536,° + # DFFBSE --------------------------------------------------------------------- combilist=DFFBSE-RECORD-INST @@ -136,8 +139,8 @@ multilist=DFFOPT-PROPERTY-NAMES # 0x0100-0x013F: picture (BLIP) 0x0100=blip-crop-top,blip-crop-bottom,blip-crop-left,blip-crop-right,blip-id,blip-name,blip-opt,blip-transparency-color 0x0108=blip-contrast,blip-brightness,blip-gamma,blip-ole-id,blip-double-cr-mod,blip-fill-cr-mod,blip-line-cr-mod,blip-print-id - 0x0110=blip-print-name,blip-print-opt,blip-movie,,,blip-transparency-color-ext,,blip-transparency-color-ext-mod - 0x0118,,blip-recolor,blip-recolor,blip-recolor-ext,,blip-recolor-ext-mod + 0x0110=blip-print-name,blip-print-opt,blip-movie,,,blip-transparency-color-ext,reserved,blip-transparency-color-ext-mod + 0x0118=reserved,reserved,blip-recolor,blip-recolor-ext,reserved,blip-recolor-ext-mod,reserved,reserved 0x013F=blip-flags # 0x0140-0x017F: shape geometry 0x0140=geo-left,geo-top,geo-right,geo-bottom,geo-shape-path,geo-vertices,geo-segment-info,geo-adjust-1 @@ -149,20 +152,21 @@ multilist=DFFOPT-PROPERTY-NAMES 0x0180=fill-type,fill-color,fill-opacity,fill-back-color,fill-back-opacity,fill-cr-mod,fill-blip,fill-blip-name 0x0188=fill-blip-opt,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right 0x0190=fill-to-bottom,fill-rect-left,fill-rect-top,fill-rect-right,fill-rect-bottom,fill-dz-type,fill-shade-preset,fill-shade-colors - 0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type,,fill-color-ext, - 0x01A0=fill-color-ext-mod,,fill-back-color-ext,,fill-back-color-ext-mod + 0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type,,fill-color-ext,reserved + 0x01A0=fill-color-ext-mod,reserved,fill-back-color-ext,reserved,fill-back-color-ext-mod,reserved,reserved,reserved 0x01BF=fill-flags # 0x01C0-0x01FF: line style 0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-opt 0x01C8=line-fill-width,line-fill-height,line-fill-dz-type,line-width,line-miter-limit,line-style,line-dash,line-dash-style 0x01D0=line-start-arrow-head,line-end-arrow-head,line-start-arrow-width,line-start-arrow-length,line-end-arrow-width,line-end-arrow-length,line-join-style,line-end-cap-style - 0x01D8=,line-color-ext,,line-color-ext-mod,,line-back-color-ext,,line-back-color-ext-mod + 0x01D8=,line-color-ext,reserved,line-color-ext-mod,reserved,line-back-color-ext,reserved,line-back-color-ext-mod + 0x01E0=reserved,reserved,reserved 0x01FF=line-flags # 0x0200-0x023F: shadow style 0x0200=shadow-type,shadow-color,shadow-highlight,shadow-cr-mod,shadow-opacity,shadow-offset-x,shadow-offset-y,shadow-2nd-offset-x 0x0208=shadow-2nd-offset-y,,,,,,, - 0x0210=shadow-origin-x,shadow-origin-y,shadow-color-ext,,shadow-color-ext-mod,,shadow-highlight-ext, - 0x0218=shadow-highlight-ext-mod + 0x0210=shadow-origin-x,shadow-origin-y,shadow-color-ext,reserved,shadow-color-ext-mod,reserved,shadow-highlight-ext,reserved + 0x0218=shadow-highlight-ext-mod,reserved,reserved,reserved 0x023F=shadow-flags # 0x0240-0x027F: perspective 0x0240=persp-type,persp-offset-x,persp-offsety,persp-scale-x-to-x,persp-scale-y-to-x,persp-scale-x-to-y,persp-scale-y-to-y,persp-persp-x @@ -170,7 +174,7 @@ multilist=DFFOPT-PROPERTY-NAMES 0x027F=persp-flags # 0x0280-0x02BF: 3d object 0x0280=3dobj-specular-amt,3dobj-diffuse-amt,3dobj-shininess,3dobj-edge-thickness,3dobj-extrude-forward,3dobj-extrude-backward,3dobj-extrude-plane,3dobj-extrusion-color - 0x0288=3dobj-cr-mod,3dobj-extrusion-color-ext,,3dobj-extrusion-color-ext-mod + 0x0288=3dobj-cr-mod,3dobj-extrusion-color-ext,reserved,3dobj-extrusion-color-ext-mod,reserved,reserved 0x02BF=3dobj-flags # 0x02C0-0x02FF: 3d style 0x02C0=3dstyle-y-rotation,3dstyle-x-rotation,3dstyle-rotation-axis-x,3dstyle-rotation-axis-y,3dstyle-rotation-axis-z,3dstyle-rotation,3dstyle-rotation-center-x,3dstyle-rotation-center-y @@ -208,25 +212,29 @@ multilist=DFFOPT-PROPERTY-NAMES 0x0540=lline-color,lline-opacity,lline-back-color,lline-cr-mod,lline-type,lline-fill-blip,lline-fill-blip-name,lline-fill-blip-opt 0x0548=lline-fill-width,lline-fill-height,lline-fill-dz-type,lline-width,lline-miter-limit,lline-style,lline-dash,lline-dash-style 0x0550=lline-start-arrow-head,lline-end-arrow-head,lline-start-arrow-width,lline-start-arrow-length,lline-end-arrow-width,lline-end-arrow-length,lline-join-style,lline-end-cap-style - 0x0558=,lline-color-ext,,lline-color-ext-mod,,lline-back-color-ext,,lline-back-color-ext-mod + 0x0558=,lline-color-ext,reserved,lline-color-ext-mod,reserved,lline-back-color-ext,reserved,lline-back-color-ext-mod + 0x0560=reserved,reserved,reserved 0x057F=lline-flags # 0x0580-0x05BF: top line style 0x0580=tline-color,tline-opacity,tline-back-color,tline-cr-mod,tline-type,tline-fill-blip,tline-fill-blip-name,tline-fill-blip-opt 0x0588=tline-fill-width,tline-fill-height,tline-fill-dz-type,tline-width,tline-miter-limit,tline-style,tline-dash,tline-dash-style 0x0590=tline-start-arrow-head,tline-end-arrow-head,tline-start-arrow-width,tline-start-arrow-length,tline-end-arrow-width,tline-end-arrow-length,tline-join-style,tline-end-cap-style - 0x0598=,tline-color-ext,,tline-color-ext-mod,,tline-back-color-ext,,tline-back-color-ext-mod + 0x0598=,tline-color-ext,reserved,tline-color-ext-mod,reserved,tline-back-color-ext,reserved,tline-back-color-ext-mod + 0x05A0=reserved,reserved,reserved 0x05BF=tline-flags # 0x05C0-0x05FF: right line style 0x05C0=rline-color,rline-opacity,rline-back-color,rline-cr-mod,rline-type,rline-fill-blip,rline-fill-blip-name,rline-fill-blip-opt 0x05C8=rline-fill-width,rline-fill-height,rline-fill-dz-type,rline-width,rline-miter-limit,rline-style,rline-dash,rline-dash-style 0x05D0=rline-start-arrow-head,rline-end-arrow-head,rline-start-arrow-width,rline-start-arrow-length,rline-end-arrow-width,rline-end-arrow-length,rline-join-style,rline-end-cap-style - 0x05D8=,rline-color-ext,,rline-color-ext-mod,,rline-back-color-ext,,rline-back-color-ext-mod + 0x05D8=,rline-color-ext,reserved,rline-color-ext-mod,reserved,rline-back-color-ext,reserved,rline-back-color-ext-mod + 0x05E0=reserved,reserved,reserved 0x05FF=rline-flags # 0x0600-0x063F: bottom line style 0x0600=bline-color,bline-opacity,bline-back-color,bline-cr-mod,bline-type,bline-fill-blip,bline-fill-blip-name,bline-fill-blip-opt 0x0608=bline-fill-width,bline-fill-height,bline-fill-dz-type,bline-width,bline-miter-limit,bline-style,bline-dash,bline-dash-style 0x0610=bline-start-arrow-head,bline-end-arrow-head,bline-start-arrow-width,bline-start-arrow-length,bline-end-arrow-width,bline-end-arrow-length,bline-join-style,bline-end-cap-style - 0x0618=,bline-color-ext,,bline-color-ext-mod,,bline-back-color-ext,,bline-back-color-ext-mod + 0x0618=,bline-color-ext,reserved,bline-color-ext-mod,reserved,bline-back-color-ext,reserved,bline-back-color-ext-mod + 0x0620=reserved,reserved,reserved 0x063F=bline-flags # 0x0680-0x06BF: web component 0x0680=webcomp-html,webcomp-name,webcomp-url @@ -258,7 +266,7 @@ constlist=DFFOPT-SIMPLE-PROPERTIES # fill style 0x0180=uint32,dec,type,DFFOPT-FILL-TYPE 0x0181=uint32,hex,color,DFF-COLOR - 0x0182=int32,fix,opacity,CONV-FLOAT-TO-PERC + 0x0182=int32,fix,opacity,DFF-OPACITY 0x0183=uint32,hex,color,DFF-COLOR 0x0184=int32,fix,opacity,DFF-OPACITY 0x0185=uint32,hex,color,DFF-COLOR @@ -266,22 +274,22 @@ constlist=DFFOPT-SIMPLE-PROPERTIES 0x0188=uint32,dec,blip-opt,DFFOPT-BLIPOPT 0x0189=int32,dec,width 0x018A=int32,dec,height - 0x018B=int32,fix,angle,CONV-DEG + 0x018B=int32,fix,angle,DFF-DEGREES 0x018C=int32,dec,focus,CONV-PERCENT - 0x018D=int32,fix,size,CONV-FLOAT-TO-PERC - 0x018E=int32,fix,size,CONV-FLOAT-TO-PERC - 0x018F=int32,fix,size,CONV-FLOAT-TO-PERC - 0x0190=int32,fix,size,CONV-FLOAT-TO-PERC + 0x018D=int32,fix,size,DFF-OPACITY + 0x018E=int32,fix,size,DFF-OPACITY + 0x018F=int32,fix,size,DFF-OPACITY + 0x0190=int32,fix,size,DFF-OPACITY 0x0191=int32,fix,size,CONV-EMU-TO-CM 0x0192=int32,fix,size,CONV-EMU-TO-CM 0x0193=int32,fix,size,CONV-EMU-TO-CM 0x0194=int32,fix,size,CONV-EMU-TO-CM 0x0195=uint32,dec,type,DFFOPT-FILL-DZTYPE 0x0196=int32,dec,preset - 0x0198=int32,fix,pos,CONV-FLOAT-TO-PERC - 0x0199=int32,fix,pos,CONV-FLOAT-TO-PERC - 0x019A=int32,fix,pos,CONV-FLOAT-TO-PERC - 0x019B=int32,fix,pos,CONV-FLOAT-TO-PERC + 0x0198=int32,fix,pos,DFF-OPACITY + 0x0199=int32,fix,pos,DFF-OPACITY + 0x019A=int32,fix,pos,DFF-OPACITY + 0x019B=int32,fix,pos,DFF-OPACITY 0x019C=uint32,hex,type,DFFOPT-FILL-SHADETYPE 0x019E=uint32,hex,color,DFF-COLOR 0x01A0=uint32,hex,color-mod,DFF-COLORMOD @@ -443,6 +451,7 @@ shortlist=DFFOPT-FILL-DZTYPE-UNIT,0,unused,emu,pixel,shape-size-rel shortlist=DFFOPT-FILL-DZTYPE-ASPECT,0,none,fixed,prefer-largest flagslist=DFFOPT-FILL-SHADETYPE + ignore=0x40000000 0x00000001=none 0x00000002=gamma 0x00000004=sigma-transfer -- cgit From c48a53b7186019313e4539453cbed7cc285c671a Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 16 Dec 2010 13:21:16 +0100 Subject: dr78: #i109800# SHEET record may not point to BOF but to any record in the sheet substream --- sc/source/filter/excel/read.cxx | 69 +++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index cfe5aedb867e..7a744493a502 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -1018,45 +1018,48 @@ FltError ImportExcel8::Read( void ) break; // ---------------------------------------------------------------- - // before worksheet: wait for new worksheet BOF + // before worksheet: expecting worksheet BOF case EXC_STATE_BEFORE_SHEET: { - if( nRecId == EXC_ID5_BOF ) + // #94191# import only 256 sheets + if( GetCurrScTab() > GetScMaxPos().Tab() ) { - // #94191# import only 256 sheets - if( GetCurrScTab() > GetScMaxPos().Tab() ) - { + if( nRecId != EXC_ID_EOF ) XclTools::SkipSubStream( maStrm ); - // #i29930# show warning box - GetAddressConverter().CheckScTab( GetCurrScTab(), true ); - eAkt = EXC_STATE_END; - } + // #i29930# show warning box + GetAddressConverter().CheckScTab( GetCurrScTab(), true ); + eAkt = EXC_STATE_END; + } + else + { + /* #i109800# SHEET record may point to any record inside the + sheet substream. We will assume a standard worksheet. */ + if( nRecId == EXC_ID5_BOF ) + Bof5(); else + pExcRoot->eDateiTyp = Biff8; + NeueTabelle(); + switch( pExcRoot->eDateiTyp ) { - Bof5(); - NeueTabelle(); - switch( pExcRoot->eDateiTyp ) - { - case Biff8: // worksheet - case Biff8M4: // macro sheet - eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch - aIn.StoreGlobalPosition(); - break; - case Biff8C: // chart sheet - GetCurrSheetDrawing().ReadTabChart( maStrm ); - Eof(); - GetTracer().TraceChartOnlySheet(); - break; - case Biff8W: // workbook - DBG_ERRORFILE( "ImportExcel8::Read - double workbook globals" ); - // run through - case Biff8V: // VB module - default: - // TODO: do not create a sheet in the Calc document - pD->SetVisible( GetCurrScTab(), FALSE ); - XclTools::SkipSubStream( maStrm ); - IncCurrScTab(); - } + case Biff8: // worksheet + case Biff8M4: // macro sheet + eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch + aIn.StoreGlobalPosition(); + break; + case Biff8C: // chart sheet + GetCurrSheetDrawing().ReadTabChart( maStrm ); + Eof(); + GetTracer().TraceChartOnlySheet(); + break; + case Biff8W: // workbook + DBG_ERRORFILE( "ImportExcel8::Read - double workbook globals" ); + // run through + case Biff8V: // VB module + default: + // TODO: do not create a sheet in the Calc document + pD->SetVisible( GetCurrScTab(), FALSE ); + XclTools::SkipSubStream( maStrm ); + IncCurrScTab(); } } } -- cgit From 6e6b91f409de89064b3692e29fa5d30cf7061d00 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 16 Dec 2010 16:50:35 +0100 Subject: dr78: #i109800# SHEET record may not point to BOF but to any record in the sheet substream (but now with reading that record too) --- sc/source/filter/excel/read.cxx | 99 ++++++++++++++++++------------------- sc/source/filter/excel/xiescher.cxx | 40 ++++++++++----- sc/source/filter/excel/xistream.cxx | 6 +++ sc/source/filter/inc/xistream.hxx | 11 +++++ 4 files changed, 93 insertions(+), 63 deletions(-) diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 7a744493a502..7061013de392 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -836,11 +836,56 @@ FltError ImportExcel8::Read( void ) if( eAkt == EXC_STATE_BEFORE_SHEET ) { sal_uInt16 nScTab = GetCurrScTab(); - if( nScTab < maSheetOffsets.size() ) + if( nScTab < maSheetOffsets.size() ) { - nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos); + nProgressBaseSize += (maStrm.GetSvStreamPos() - nProgressBasePos); nProgressBasePos = maSheetOffsets[ nScTab ]; - aIn.StartNextRecord( nProgressBasePos ); + maStrm.StartNextRecord( nProgressBasePos ); + + // #94191# import only 256 sheets + if( nScTab > GetScMaxPos().Tab() ) + { + if( maStrm.GetRecId() != EXC_ID_EOF ) + XclTools::SkipSubStream( maStrm ); + // #i29930# show warning box + GetAddressConverter().CheckScTab( nScTab, true ); + eAkt = EXC_STATE_END; + } + else + { + // #i109800# SHEET record may point to any record inside the sheet substream + bool bIsBof = maStrm.GetRecId() == EXC_ID5_BOF; + if( bIsBof ) + Bof5(); // read the BOF record + else + pExcRoot->eDateiTyp = Biff8; // on missing BOF, assume a standard worksheet + + NeueTabelle(); + switch( pExcRoot->eDateiTyp ) + { + case Biff8: // worksheet + case Biff8M4: // macro sheet + eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch + // go to next record + if( bIsBof ) maStrm.StartNextRecord(); + maStrm.StoreGlobalPosition(); + break; + case Biff8C: // chart sheet + GetCurrSheetDrawing().ReadTabChart( maStrm ); + Eof(); + GetTracer().TraceChartOnlySheet(); + break; + case Biff8W: // workbook + DBG_ERRORFILE( "ImportExcel8::Read - double workbook globals" ); + // run through + case Biff8V: // VB module + default: + // TODO: do not create a sheet in the Calc document + pD->SetVisible( GetCurrScTab(), FALSE ); + XclTools::SkipSubStream( maStrm ); + IncCurrScTab(); + } + } } else eAkt = EXC_STATE_END; @@ -1017,54 +1062,6 @@ FltError ImportExcel8::Read( void ) } break; - // ---------------------------------------------------------------- - // before worksheet: expecting worksheet BOF - case EXC_STATE_BEFORE_SHEET: - { - // #94191# import only 256 sheets - if( GetCurrScTab() > GetScMaxPos().Tab() ) - { - if( nRecId != EXC_ID_EOF ) - XclTools::SkipSubStream( maStrm ); - // #i29930# show warning box - GetAddressConverter().CheckScTab( GetCurrScTab(), true ); - eAkt = EXC_STATE_END; - } - else - { - /* #i109800# SHEET record may point to any record inside the - sheet substream. We will assume a standard worksheet. */ - if( nRecId == EXC_ID5_BOF ) - Bof5(); - else - pExcRoot->eDateiTyp = Biff8; - NeueTabelle(); - switch( pExcRoot->eDateiTyp ) - { - case Biff8: // worksheet - case Biff8M4: // macro sheet - eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch - aIn.StoreGlobalPosition(); - break; - case Biff8C: // chart sheet - GetCurrSheetDrawing().ReadTabChart( maStrm ); - Eof(); - GetTracer().TraceChartOnlySheet(); - break; - case Biff8W: // workbook - DBG_ERRORFILE( "ImportExcel8::Read - double workbook globals" ); - // run through - case Biff8V: // VB module - default: - // TODO: do not create a sheet in the Calc document - pD->SetVisible( GetCurrScTab(), FALSE ); - XclTools::SkipSubStream( maStrm ); - IncCurrScTab(); - } - } - } - break; - // ---------------------------------------------------------------- // prefetch for worksheet case EXC_STATE_SHEET_PRE: diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 167c5e27cdfb..0cfd59a33abc 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1540,23 +1540,39 @@ XclImpChartObj::XclImpChartObj( const XclImpRoot& rRoot, bool bOwnTab ) : void XclImpChartObj::ReadChartSubStream( XclImpStream& rStrm ) { - if( mbOwnTab ? (rStrm.GetRecId() == EXC_ID5_BOF) : ((rStrm.GetNextRecId() == EXC_ID5_BOF) && rStrm.StartNextRecord()) ) + /* If chart is read from a chartsheet (mbOwnTab == true), the BOF record + has already been read. If chart is embedded as object, the next record + has to be the BOF record. */ + if( mbOwnTab ) { - sal_uInt16 nBofType; - rStrm.Seek( 2 ); - rStrm >> nBofType; - DBG_ASSERT( nBofType == EXC_BOF_CHART, "XclImpChartObj::ReadChartSubStream - no chart BOF record" ); - - // read chart, even if BOF record contains wrong substream identifier - mxChart.reset( new XclImpChart( GetRoot(), mbOwnTab ) ); - mxChart->ReadChartSubStream( rStrm ); - if( mbOwnTab ) - FinalizeTabChart(); + /* #i109800# The input stream may point somewhere inside the chart + substream and not exactly to the leading BOF record. To read this + record correctly in the following, the stream has to rewind it, so + that the next call to StartNextRecord() will find it correctly. */ + if( rStrm.GetRecId() != EXC_ID5_BOF ) + rStrm.RewindRecord(); } else { - DBG_ERRORFILE( "XclImpChartObj::ReadChartSubStream - missing chart substream" ); + if( (rStrm.GetNextRecId() == EXC_ID5_BOF) && rStrm.StartNextRecord() ) + { + sal_uInt16 nBofType; + rStrm.Seek( 2 ); + rStrm >> nBofType; + DBG_ASSERT( nBofType == EXC_BOF_CHART, "XclImpChartObj::ReadChartSubStream - no chart BOF record" ); + } + else + { + DBG_ERRORFILE( "XclImpChartObj::ReadChartSubStream - missing chart substream" ); + return; + } } + + // read chart, even if BOF record contains wrong substream identifier + mxChart.reset( new XclImpChart( GetRoot(), mbOwnTab ) ); + mxChart->ReadChartSubStream( rStrm ); + if( mbOwnTab ) + FinalizeTabChart(); } void XclImpChartObj::DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize ) diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 98db9dcb4471..3ade9e1a573f 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -431,6 +431,12 @@ void XclImpStream::ResetRecord( bool bContLookup, sal_uInt16 nAltContId ) } } +void XclImpStream::RewindRecord() +{ + mnNextRecPos = maFirstRec.GetPos(); + mbValid = mbValidRec = false; +} + void XclImpStream::SetDecrypter( XclImpDecrypterRef xDecrypter ) { mxDecrypter = xDecrypter; diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx index 9b27077d78e7..1fd98d92cf13 100644 --- a/sc/source/filter/inc/xistream.hxx +++ b/sc/source/filter/inc/xistream.hxx @@ -182,6 +182,9 @@ public: sal_uInt16& rnRawRecId, sal_uInt16& rnRawRecSize, sal_uInt16& rnRawRecLeft, bool& rbValid ) const; + /** Returns the stored stream position. */ + inline sal_Size GetPos() const { return mnPos; } + private: sal_Size mnPos; /// Absolute position of the stream. sal_Size mnNextPos; /// Absolute position of next record. @@ -280,6 +283,14 @@ public: started with StartNextRecord(). */ void ResetRecord( bool bContLookup, sal_uInt16 nAltContId = EXC_ID_UNKNOWN ); + /** Sets stream pointer before current record and invalidates stream. + @descr The next call to StartNextRecord() will start again the current + record. This can be used in situations where a loop or a function + leaves on a specific record, but the parent context expects to start + this record by itself. The stream is invalid as long as the first + record has not been started (it is not allowed to call any other stream + operation then). */ + void RewindRecord(); /** Enables decryption of record contents for the rest of the stream. */ void SetDecrypter( XclImpDecrypterRef xDecrypter ); -- cgit From 2b7da24f60f3cf7feafa17562c47760b8f1f44d0 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 16 Dec 2010 19:00:18 +0100 Subject: dr78: #i109800# SHEET record may not point to BOF but to any record in the sheet substream --- oox/inc/oox/xls/excelhandlers.hxx | 15 --------------- oox/source/dump/biffdumper.cxx | 16 ++++++++++++++++ oox/source/dump/dumperbase.ini | 2 +- oox/source/xls/excelhandlers.cxx | 28 +++++++++------------------- oox/source/xls/workbookfragment.cxx | 19 +++++++++++++++++-- 5 files changed, 43 insertions(+), 37 deletions(-) diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx index 986f42aadba4..e25fc994c362 100644 --- a/oox/inc/oox/xls/excelhandlers.hxx +++ b/oox/inc/oox/xls/excelhandlers.hxx @@ -301,17 +301,6 @@ protected: */ BiffFragmentType startFragment( BiffType eBiff ); - /** Starts a new fragment at a specific position in the workbbok stream and - returns the fragment type. - - The passed record handle must specify the stream position of the BOF - record of the fragment substream. The function will try to start the - next record and read the contents of the BOF record, if extant. - - @return Fragment type according to the imported BOF record. - */ - BiffFragmentType startFragment( BiffType eBiff, sal_Int64 nRecHandle ); - /** Skips the current fragment up to its trailing EOF record. Skips all records until next EOF record. When this function returns, @@ -324,10 +313,6 @@ protected: @return True = stream points to the EOF record of the current fragment. */ bool skipFragment(); - -private: - /** Implementation helper for the startFragment() functions. */ - BiffFragmentType implStartFragment( BiffType eBiff ); }; // ============================================================================ diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 3d6f20ed62ba..709fa22b41e0 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2461,6 +2461,12 @@ void WorkbookStreamObject::implDumpRecordBody() dumpDec< sal_Int32 >( "sst-idx" ); break; + case BIFF_ID_MERGEDCELLS: + mxOut->resetItemIndex(); + for( sal_uInt16 nIdx = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !rStrm.isEof() && (nIdx < nCount); ++nIdx ) + dumpRange( "#range" ); + break; + case BIFF_ID_MSODRAWING: case BIFF_ID_MSODRAWINGGROUP: case BIFF_ID_MSODRAWINGSEL: @@ -2560,6 +2566,16 @@ void WorkbookStreamObject::implDumpRecordBody() } break; + case BIFF_ID_PALETTE: + mxOut->resetItemIndex(); + for( sal_uInt16 nIdx = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !rStrm.isEof() && (nIdx < nCount); ++nIdx ) + { + OUStringBuffer aColorName; + StringHelper::appendHex( aColorName, dumpColorABGR( "#color" ) ); + mxColors->setName( nIdx, aColorName.makeStringAndClear() ); + } + break; + case BIFF_ID_PANE: dumpDec< sal_uInt16 >( "x-pos", "CONV-TWIP-TO-CM" ); dumpDec< sal_uInt16 >( "y-pos", "CONV-TWIP-TO-CM" ); diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini index 34ef302c784c..f9b776c9d99a 100644 --- a/oox/source/dump/dumperbase.ini +++ b/oox/source/dump/dumperbase.ini @@ -35,7 +35,7 @@ show-trailing-unknown=1 # Shows the absolute stream position of records in the record header field # (default=on). # 0=off, 1=on -show-record-position=0 +show-record-position=1 # name lists ================================================================= # diff --git a/oox/source/xls/excelhandlers.cxx b/oox/source/xls/excelhandlers.cxx index aaf551424483..a02009ec1898 100644 --- a/oox/source/xls/excelhandlers.cxx +++ b/oox/source/xls/excelhandlers.cxx @@ -139,29 +139,11 @@ BiffFragmentHandler::BiffFragmentHandler( const BiffFragmentHandler& rHandler ) } BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff ) -{ - return mrStrm.startNextRecord() ? implStartFragment( eBiff ) : BIFF_FRAGMENT_UNKNOWN; -} - -BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff, sal_Int64 nRecHandle ) -{ - return mrStrm.startRecordByHandle( nRecHandle ) ? implStartFragment( eBiff ) : BIFF_FRAGMENT_UNKNOWN; -} - -bool BiffFragmentHandler::skipFragment() -{ - while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) ) - if( isBofRecord() ) - skipFragment(); - return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF); -} - -BiffFragmentType BiffFragmentHandler::implStartFragment( BiffType eBiff ) { BiffFragmentType eFragment = BIFF_FRAGMENT_UNKNOWN; /* #i23425# Don't rely on BOF record ID to read BOF contents, but on the detected BIFF version. */ - if( isBofRecord() ) + if( mrStrm.startNextRecord() && isBofRecord() ) { // BOF is always written unencrypted mrStrm.enableDecoder( false ); @@ -219,6 +201,14 @@ BiffFragmentType BiffFragmentHandler::implStartFragment( BiffType eBiff ) return eFragment; } +bool BiffFragmentHandler::skipFragment() +{ + while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) ) + if( isBofRecord() ) + skipFragment(); + return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF); +} + // ============================================================================ BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) : diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 6e43a32495be..fcc9f4972b7d 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -379,10 +379,25 @@ bool BiffWorkbookFragment::importFragment() bool bNextSheet = bRet; for( sal_Int32 nWorksheet = 0, nWorksheetCount = rWorksheets.getWorksheetCount(); bNextSheet && (nWorksheet < nWorksheetCount); ++nWorksheet ) { - // try to start a new sheet fragment + // calculate progress size for the sheet double fSegmentLength = getProgressBar().getFreeLength() / (nWorksheetCount - nWorksheet); ISegmentProgressBarRef xSheetProgress = getProgressBar().createSegment( fSegmentLength ); - BiffFragmentType eSheetFragment = startFragment( getBiff(), rWorksheets.getBiffRecordHandle( nWorksheet ) ); + /* Try to start a new sheet fragment. The SHEET records point to the + first record of the sheet fragment which is usually a BOF record. */ + BiffFragmentType eSheetFragment = BIFF_FRAGMENT_UNKNOWN; + sal_Int64 nRecHandle = rWorksheets.getBiffRecordHandle( nWorksheet ); + if( mrStrm.startRecordByHandle( nRecHandle ) ) + { + /* #i109800# Stream may point to any record of the sheet fragment. + Check the record identifier before calling startFragment(). */ + bool bIsBofRec = isBofRecord(); + /* Rewind the record. If it is the BOF record, it will be read in + startFragment(). In every case, stream will point before the + first available non-BOF record. */ + mrStrm.rewindRecord(); + // if the BOF record is missing, a regular worksheet will be assumed + eSheetFragment = bIsBofRec ? startFragment( getBiff() ) : BIFF_FRAGMENT_WORKSHEET; + } sal_Int16 nCalcSheet = rWorksheets.getCalcSheetIndex( nWorksheet ); bNextSheet = importSheetFragment( *xSheetProgress, eSheetFragment, nCalcSheet ); } -- cgit From 70ec19ae3cbf881388c0011e0c4aa132bece311c Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 16 Dec 2010 19:07:41 +0100 Subject: dr78: corrected color indexes when dumping PALETTE --- oox/source/dump/biffdumper.cxx | 4 ++-- oox/source/dump/dumperbase.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 709fa22b41e0..0cc07eb23d2d 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2567,12 +2567,12 @@ void WorkbookStreamObject::implDumpRecordBody() break; case BIFF_ID_PALETTE: - mxOut->resetItemIndex(); + mxOut->resetItemIndex( 8 ); for( sal_uInt16 nIdx = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !rStrm.isEof() && (nIdx < nCount); ++nIdx ) { OUStringBuffer aColorName; StringHelper::appendHex( aColorName, dumpColorABGR( "#color" ) ); - mxColors->setName( nIdx, aColorName.makeStringAndClear() ); + mxColors->setName( nIdx + 8, aColorName.makeStringAndClear() ); } break; diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini index f9b776c9d99a..34ef302c784c 100644 --- a/oox/source/dump/dumperbase.ini +++ b/oox/source/dump/dumperbase.ini @@ -35,7 +35,7 @@ show-trailing-unknown=1 # Shows the absolute stream position of records in the record header field # (default=on). # 0=off, 1=on -show-record-position=1 +show-record-position=0 # name lists ================================================================= # -- cgit From a25f4715687671a2cdeb1c7e07df02e21bd46758 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 17 Dec 2010 12:09:17 +0100 Subject: dr78: #i71453# BIFF2: use formatting information from cell records if XF records are missing --- oox/inc/oox/xls/sheetdatacontext.hxx | 1 + oox/inc/oox/xls/stylesbuffer.hxx | 5 +++++ oox/source/dump/biffdumper.ini | 2 +- oox/source/xls/sheetdatacontext.cxx | 39 +++++++++++++++++++++++++++--------- oox/source/xls/stylesbuffer.cxx | 35 ++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 10 deletions(-) diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index a77f4b285fa4..fec8b7db89cb 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -163,6 +163,7 @@ private: sal_uInt32 mnFormulaIgnoreSize; /// Number of bytes to be ignored in FORMULA record. sal_uInt32 mnArrayIgnoreSize; /// Number of bytes to be ignored in ARRAY record. sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. + OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. }; // ============================================================================ diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx index 4fa9c964108e..b597546f8484 100644 --- a/oox/inc/oox/xls/stylesbuffer.hxx +++ b/oox/inc/oox/xls/stylesbuffer.hxx @@ -787,6 +787,11 @@ public: /** Writes all formatting attributes to the passed property set. */ void writeToPropertySet( PropertySet& rPropSet ) const; + /** Converts formatting information from BIFF2 cell record data directly. */ + static void writeBiff2CellFormatToPropertySet( + const WorkbookHelper& rHelper, PropertySet& rPropSet, + sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ); + private: /** Sets 'attribute used' flags from the passed BIFF bit field. */ void setBiffUsedFlags( sal_uInt8 nUsedFlags ); diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 8e1626f82659..18e8cd87e551 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -2193,7 +2193,7 @@ combilist=XF-FILLCOLOR-BIFF8 0x3F80=uint8,dec,bg-color-idx,COLORS end -# BIFF2 XF index field ------------------------------------------------------- +# BIFF2 cell records ---------------------------------------------------------- constlist=XFINDEX-BIFF2 default= diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 05e4c5bfe767..8ce601b0aa8c 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -106,8 +106,9 @@ const sal_uInt32 BIFF_ROW_THICKTOP = 0x10000000; const sal_uInt32 BIFF_ROW_THICKBOTTOM = 0x20000000; const sal_uInt32 BIFF_ROW_SHOWPHONETIC = 0x40000000; -const sal_Int32 BIFF2_XF_EXTENDED_IDS = 63; -const sal_uInt8 BIFF2_XF_MASK = 0x3F; +const sal_uInt8 BIFF2_CELL_LOCKED = 0x40; +const sal_uInt8 BIFF2_CELL_HIDDEN = 0x80; +const sal_Int32 BIFF2_CELL_USEIXFE = 63; // ---------------------------------------------------------------------------- @@ -600,7 +601,6 @@ BiffSheetDataContext::BiffSheetDataContext( const BiffWorksheetFragmentBase& rPa BiffWorksheetContextBase( rParent ), mnBiff2XfId( 0 ) { - mnArrayIgnoreSize = (getBiff() == BIFF2) ? 1 : ((getBiff() <= BIFF4) ? 2 : 6); switch( getBiff() ) { case BIFF2: @@ -718,12 +718,33 @@ void BiffSheetDataContext::importXfId( bool bBiff2 ) { if( bBiff2 ) { - sal_uInt8 nBiff2XfId; - mrStrm >> nBiff2XfId; - mrStrm.skip( 2 ); - maCurrCell.mnXfId = nBiff2XfId & BIFF2_XF_MASK; - if( maCurrCell.mnXfId == BIFF2_XF_EXTENDED_IDS ) - maCurrCell.mnXfId = mnBiff2XfId; + /* #i71453# On first call, check if the file contains XF records (by + trying to access the first XF with index 0). If there are no XFs, + the explicit formatting information contained in each cell record + will be used instead. */ + if( !mobBiff2HasXfs ) + mobBiff2HasXfs = getStyles().getCellXf( 0 ).get() != 0; + // read formatting information (includes the XF identifier) + sal_uInt8 nFlags1, nFlags2, nFlags3; + mrStrm >> nFlags1 >> nFlags2 >> nFlags3; + /* If the file contains XFs, extract and set the XF identifier, + otherwise get the explicit formatting. */ + if( mobBiff2HasXfs.get() ) + { + maCurrCell.mnXfId = extractValue< sal_Int32 >( nFlags1, 0, 6 ); + /* If the identifier is equal to 63, then the real identifier is + contained in the preceding IXFE record (stored in mnBiff2XfId). */ + if( maCurrCell.mnXfId == BIFF2_CELL_USEIXFE ) + maCurrCell.mnXfId = mnBiff2XfId; + } + else + { + /* Let the Xf class do the API conversion. Keeping the member + maCurrCell.mnXfId untouched will prevent to trigger the usual + XF formatting conversion later on. */ + PropertySet aPropSet( maCurrCell.mxCell ); + Xf::writeBiff2CellFormatToPropertySet( *this, aPropSet, nFlags1, nFlags2, nFlags3 ); + } } else { diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index 5a149961c0e2..b95ca8984ded 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -2477,6 +2477,41 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const rPropSet.setProperties( aPropMap ); } +/*static*/ void Xf::writeBiff2CellFormatToPropertySet( const WorkbookHelper& rHelper, + PropertySet& rPropSet, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ) +{ + /* Create an XF object and let it do the work. We will have access to its + private members here. Also, create temporary border and fill objects, + this prevents polluting the border and fill buffers with new temporary + objects per imported cell. */ + Xf aXf( rHelper ); + Border aBorder( rHelper, false ); + Fill aFill( rHelper, false ); + + // no used flags available in BIFF2 (always true) + aXf.setAllUsedFlags( true ); + + // set the attributes + aXf.maModel.mnFontId = extractValue< sal_Int32 >( nFlags2, 6, 2 ); + aXf.maModel.mnNumFmtId = extractValue< sal_Int32 >( nFlags2, 0, 6 ); + aXf.maAlignment.setBiff2Data( nFlags3 ); + aXf.maProtection.setBiff2Data( nFlags1 ); + aBorder.setBiff2Data( nFlags3 ); + aFill.setBiff2Data( nFlags3 ); + + // finalize the objects (convert model to API attributes) + aXf.finalizeImport(); + aBorder.finalizeImport(); + aFill.finalizeImport(); + + // write the properties to the property set + PropertyMap aPropMap; + aXf.writeToPropertyMap( aPropMap ); + aBorder.writeToPropertyMap( aPropMap ); + aFill.writeToPropertyMap( aPropMap ); + rPropSet.setProperties( aPropMap ); +} + void Xf::setBiffUsedFlags( sal_uInt8 nUsedFlags ) { /* Notes about finding the used flags: -- cgit From e3c7c4fc089ad365b7d9b2d66addc85255df1eeb Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 17 Dec 2010 12:17:41 +0100 Subject: dr78: #i71453# remove unused flags --- oox/source/xls/sheetdatacontext.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 8ce601b0aa8c..ab041846cd18 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -106,8 +106,6 @@ const sal_uInt32 BIFF_ROW_THICKTOP = 0x10000000; const sal_uInt32 BIFF_ROW_THICKBOTTOM = 0x20000000; const sal_uInt32 BIFF_ROW_SHOWPHONETIC = 0x40000000; -const sal_uInt8 BIFF2_CELL_LOCKED = 0x40; -const sal_uInt8 BIFF2_CELL_HIDDEN = 0x80; const sal_Int32 BIFF2_CELL_USEIXFE = 63; // ---------------------------------------------------------------------------- -- cgit From 168b999333e90533ce8140c304388c26d0053411 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 17 Dec 2010 14:40:47 +0100 Subject: dr78: #i71453# BIFF2: use formatting information from cell records if XF records are missing --- sc/source/filter/excel/excform.cxx | 4 --- sc/source/filter/excel/impop.cxx | 59 +++++++++++++++++++++++++++----------- sc/source/filter/excel/xistyle.cxx | 22 ++++++++++++++ sc/source/filter/inc/imp_op.hxx | 8 ++++-- sc/source/filter/inc/xistyle.hxx | 5 ++++ 5 files changed, 74 insertions(+), 24 deletions(-) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 0652363e8822..f7d4822efd7d 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -84,8 +84,6 @@ void ImportExcel::Formula25() bShrFmla = nFlag0 & 0x08; // shared or not shared } - nLastXF = nXF; - Formula( aXclPos, nXF, nFormLen, fCurVal, bShrFmla ); } @@ -107,8 +105,6 @@ void ImportExcel::Formula4() aIn.Ignore( 1 ); aIn >> nFormLen; - nLastXF = nXF; - Formula( aXclPos, nXF, nFormLen, fCurVal, FALSE ); } diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 059f5ba7426b..bf4dae2af055 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -123,11 +123,13 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ): XclImpRoot( rImpData ), maStrm( rStrm, GetRoot() ), aIn( maStrm ), - maScOleSize( ScAddress::INITIALIZE_INVALID ) + maScOleSize( ScAddress::INITIALIZE_INVALID ), + mnLastRefIdx( 0 ), + mnIxfeIndex( 0 ), + mbBiff2HasXfs( false ), + mbBiff2HasXfsValid( false ) { - mnLastRefIdx = 0; nBdshtTab = 0; - nIxfeIndex = 0; // zur Sicherheit auf 0 // Root-Daten fuellen - nach new's ohne Root als Parameter pExcRoot = &GetOldRoot(); @@ -193,17 +195,40 @@ void ImportExcel::ReadFileSharing() } } -sal_uInt16 ImportExcel::ReadXFIndex( bool bBiff2 ) +sal_uInt16 ImportExcel::ReadXFIndex( const ScAddress& rScPos, bool bBiff2 ) { sal_uInt16 nXFIdx = 0; if( bBiff2 ) { - sal_uInt8 nXFIdx2; - maStrm >> nXFIdx2; - maStrm.Ignore( 2 ); - nXFIdx = nXFIdx2 & 0x3F; - if( nXFIdx == 63 ) - nXFIdx = nIxfeIndex; + /* #i71453# On first call, check if the file contains XF records (by + trying to access the first XF with index 0). If there are no XFs, + the explicit formatting information contained in each cell record + will be used instead. */ + if( !mbBiff2HasXfsValid ) + { + mbBiff2HasXfsValid = true; + mbBiff2HasXfs = GetXFBuffer().GetXF( 0 ) != 0; + } + // read formatting information (includes the XF identifier) + sal_uInt8 nFlags1, nFlags2, nFlags3; + maStrm >> nFlags1 >> nFlags2 >> nFlags3; + /* If the file contains XFs, extract and set the XF identifier, + otherwise get the explicit formatting. */ + if( mbBiff2HasXfs ) + { + nXFIdx = ::extract_value< sal_uInt16 >( nFlags1, 0, 6 ); + /* If the identifier is equal to 63, then the real identifier is + contained in the preceding IXFE record (stored in mnBiff2XfId). */ + if( nXFIdx == 63 ) + nXFIdx = mnIxfeIndex; + } + else + { + /* Let the XclImpXF class do the conversion of the imported + formatting. The XF buffer is empty, therefore will not do any + conversion based on the XF index later on. */ + XclImpXF::ApplyPatternForBiff2CellFormat( GetRoot(), rScPos, nFlags1, nFlags2, nFlags3 ); + } } else aIn >> nXFIdx; @@ -258,7 +283,7 @@ void ImportExcel::ReadBlank() ScAddress aScPos( ScAddress::UNINITIALIZED ); if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) ) { - sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_BLANK ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BLANK ); GetXFRangeBuffer().SetBlankXF( aScPos, nXFIdx ); } @@ -272,7 +297,7 @@ void ImportExcel::ReadInteger() ScAddress aScPos( ScAddress::UNINITIALIZED ); if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) ) { - sal_uInt16 nXFIdx = ReadXFIndex( true ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, true ); sal_uInt16 nValue; maStrm >> nValue; @@ -289,7 +314,7 @@ void ImportExcel::ReadNumber() ScAddress aScPos( ScAddress::UNINITIALIZED ); if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) ) { - sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_NUMBER ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_NUMBER ); double fValue; maStrm >> fValue; @@ -312,7 +337,7 @@ void ImportExcel::ReadLabel() 0x0204 2-7 2 byte 16-bit length, byte string 0x0204 8 2 byte 16-bit length, unicode string */ bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL; - sal_uInt16 nXFIdx = ReadXFIndex( bBiff2 ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, bBiff2 ); XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? EXC_STR_8BITLENGTH : EXC_STR_DEFAULT; XclImpString aString; @@ -337,7 +362,7 @@ void ImportExcel::ReadBoolErr() ScAddress aScPos( ScAddress::UNINITIALIZED ); if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) ) { - sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_BOOLERR ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BOOLERR ); sal_uInt8 nValue, nType; maStrm >> nValue >> nType; @@ -362,7 +387,7 @@ void ImportExcel::ReadRk() ScAddress aScPos( ScAddress::UNINITIALIZED ); if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) ) { - sal_uInt16 nXFIdx = ReadXFIndex( false ); + sal_uInt16 nXFIdx = ReadXFIndex( aScPos, false ); sal_Int32 nRk; maStrm >> nRk; @@ -628,7 +653,7 @@ void ImportExcel::Codepage( void ) void ImportExcel::Ixfe( void ) { - aIn >> nIxfeIndex; + maStrm >> mnIxfeIndex; } diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index f09da83d2adb..8aeae0328ffe 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1204,6 +1204,28 @@ void XclImpXF::ApplyPattern( } } +/*static*/ void XclImpXF::ApplyPatternForBiff2CellFormat( const XclImpRoot& rRoot, + const ScAddress& rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ) +{ + /* Create an XF object and let it do the work. We will have access to its + private members here. */ + XclImpXF aXF( rRoot ); + + // no used flags available in BIFF2 (always true) + aXF.SetAllUsedFlags( true ); + + // set the attributes + aXF.maProtection.FillFromXF2( nFlags1 ); + aXF.maAlignment.FillFromXF2( nFlags3 ); + aXF.maBorder.FillFromXF2( nFlags3 ); + aXF.maArea.FillFromXF2( nFlags3 ); + aXF.mnXclNumFmt = ::extract_value< sal_uInt16 >( nFlags2, 0, 6 ); + aXF.mnXclFont = ::extract_value< sal_uInt16 >( nFlags2, 6, 2 ); + + // write the attributes to the cell + aXF.ApplyPattern( rScPos.Col(), rScPos.Row(), rScPos.Col(), rScPos.Row(), rScPos.Tab() ); +} + void XclImpXF::SetUsedFlags( sal_uInt8 nUsedFlags ) { /* Notes about finding the mb***Used flags: diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx index 2df58173a63a..8d228d775031 100644 --- a/sc/source/filter/inc/imp_op.hxx +++ b/sc/source/filter/inc/imp_op.hxx @@ -110,8 +110,10 @@ protected: XclImpOutlineListBuffer* pOutlineListBuffer; sal_Int16 mnLastRefIdx; - UINT16 nIxfeIndex; // merkt sich Angabe im IXFE-Record - UINT16 nLastXF; // letzter XF in Formula-Record + sal_uInt16 mnIxfeIndex; /// Current XF identifier from IXFE record. + bool mbBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. + bool mbBiff2HasXfsValid; /// False = mbBiff2HasXfs is undetermined yet. + SCTAB nBdshtTab; // Counter fuer Boundsheet ScFormulaCell* pLastFormCell; // fuer String-Records @@ -121,7 +123,7 @@ protected: // Record-Funktionen void ReadFileSharing(); - sal_uInt16 ReadXFIndex( bool bBiff2 ); + sal_uInt16 ReadXFIndex( const ScAddress& rScPos, bool bBiff2 ); void ReadDimensions(); void ReadBlank(); diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 104002542a17..b7f78fbe57c8 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -415,6 +415,11 @@ public: SCTAB nScTab, ULONG nForceScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND ); + /** Converts formatting information from BIFF2 cell record data directly. */ + static void ApplyPatternForBiff2CellFormat( + const XclImpRoot& rRoot, const ScAddress& rScPos, + sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ); + private: void ReadXF2( XclImpStream& rStrm ); void ReadXF3( XclImpStream& rStrm ); -- cgit From 00d0b523b7913b534a6f7fef4f2a86e9472d0208 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 21 Dec 2010 11:28:35 +0100 Subject: dba34c: #i110039# 'Form Design' now known as 'Database Form' --- officecfg/registry/data/org/openoffice/Setup.xcu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index e8b483b8622d..27054b8a3417 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -348,7 +348,7 @@ swform - Base: Form Design + Base: Database Form WriterFormWindowState -- cgit From 1866f942b7b66e9f0c24b8de2ec5ca5378f05765 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 29 Dec 2010 09:36:40 +0100 Subject: dr78: typos in comments --- oox/inc/oox/xls/formulabase.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx index fe4533680424..1c668296cee3 100644 --- a/oox/inc/oox/xls/formulabase.hxx +++ b/oox/inc/oox/xls/formulabase.hxx @@ -481,9 +481,9 @@ enum FunctionLibraryType /** Represents information for a spreadsheet function. - The member mpParamInfos points to an array of type information structures + The member mpParamInfos points to a C-array of type information structures for all parameters of the function. The last initialized structure - describing a regular parameter (member meValid == EXC_PARAMVALID_ALWAYS) in + describing a regular parameter (member meValid == FUNC_PARAM_REGULAR) in this array is used repeatedly for all following parameters supported by a function. */ @@ -501,7 +501,7 @@ struct FunctionInfo sal_uInt8 mnMaxParamCount; /// Maximum number of parameters. sal_uInt8 mnRetClass; /// BIFF token class of the return value. const FunctionParamInfo* mpParamInfos; /// Information about all parameters. - bool mbParamPairs; /// true = optional parameters are expected to appear in pairs. + bool mbParamPairs; /// True = optional parameters are expected to appear in pairs. bool mbVolatile; /// True = volatile function. bool mbExternal; /// True = external function in Calc. bool mbMacroFunc; /// True = macro sheet function or command. -- cgit From c6aea6d541713c4e2cd27a2b1ffb8a408f9764c1 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 29 Dec 2010 16:41:23 +0100 Subject: dr78: typo in comment --- oox/inc/oox/vml/vmldrawing.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx index c2f8432dca6f..a9c1d3506210 100644 --- a/oox/inc/oox/vml/vmldrawing.hxx +++ b/oox/inc/oox/vml/vmldrawing.hxx @@ -124,7 +124,7 @@ public: /** Final processing after import of the fragment. */ void finalizeFragmentImport(); - /** Creates and inserts all UNO shapes into the passed container. The virtual + /** Creates and inserts all UNO shapes into the draw page. The virtual function notifyShapeInserted() will be called for each new shape. */ void convertAndInsert() const; -- cgit From 3ff6379e53a0f47f56417a41937fe92996980cb8 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 3 Jan 2011 13:56:33 +0100 Subject: dba34c: fix for cast and char compare --- connectivity/inc/connectivity/sqlnode.hxx | 1 + connectivity/source/drivers/ado/AColumn.cxx | 5 ++++- connectivity/source/drivers/ado/AConnection.cxx | 5 +++++ connectivity/source/drivers/macab/MacabRecord.cxx | 2 +- connectivity/source/parse/sqlnode.cxx | 11 ++++++++++- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index fa283cb5cf04..04ec8dc153df 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -231,6 +231,7 @@ namespace connectivity character_string_type, other_like_predicate_part_2, between_predicate_part_2, + cast_spec, rule_count, // letzter_wert UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID) }; diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index aa287c185b26..510c2790e777 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -165,7 +165,8 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r { sal_Int32 nVal=0; rValue >>= nVal; - m_aColumn.put_NumericScale((sal_Int8)nVal); + if ( !m_IsCurrency ) + m_aColumn.put_NumericScale((sal_Int8)nVal); } break; case PROPERTY_ID_ISNULLABLE: @@ -212,6 +213,8 @@ void OAdoColumn::fillPropertyValues() DataTypeEnum eType = m_aColumn.get_Type(); m_IsCurrency = (eType == adCurrency); + if ( m_IsCurrency && !m_Scale) + m_Scale = 4; m_Type = ADOS::MapADOType2Jdbc(eType); sal_Bool bForceTo = sal_True; diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index a7e2ec4df490..6596b9b8d946 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -466,6 +466,11 @@ void OConnection::buildTypeInfo() throw( SQLException) aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value(); aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value(); aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value(); + if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale) + { + aInfo->aSimpleType.nMinimumScale = 4; + aInfo->aSimpleType.nMaximumScale = 4; + } aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value(); // Now that we have the type info, save it // in the Hashtable if we don't already have an diff --git a/connectivity/source/drivers/macab/MacabRecord.cxx b/connectivity/source/drivers/macab/MacabRecord.cxx index 35817526ff17..e161ece74522 100755 --- a/connectivity/source/drivers/macab/MacabRecord.cxx +++ b/connectivity/source/drivers/macab/MacabRecord.cxx @@ -202,7 +202,7 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield result = CFStringCompare( (CFStringRef) _field1->value, (CFStringRef) _field2->value, - 0); // 0 = no options (like ignore case) + kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character. break; case kABDateProperty: diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index f9f348592a6f..77c7118a1d38 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1425,7 +1425,8 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" }, { OSQLParseNode::character_string_type, "character_string_type" }, { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" }, - { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" } + { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }, + { OSQLParseNode::cast_spec, "cast_spec" } }; size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] ); OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" ); @@ -2511,6 +2512,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode rString.append(m_aNodeValue); rString.appendAscii("#"); break; + case SQL_NODE_INTNUM: case SQL_NODE_APPROXNUM: { @@ -2523,6 +2525,13 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode rString.append(aTmp); } break; + + case SQL_NODE_PUNCTUATION: + if ( getParent() && SQL_ISRULE(getParent(),cast_spec) && m_aNodeValue.toChar() == '(' ) // no spaces in front of '(' or after ')' + { + rString.append(m_aNodeValue); + break; + } // fall through default: if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' ) -- cgit From e89ecedf654df0267c260ef2dc489be1b261fb5a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 3 Jan 2011 13:58:05 +0100 Subject: dba34c: #i110323# fix for double --- forms/source/component/FormattedField.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 697b39d4931e..193ed4b1a693 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -1040,10 +1040,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) m_xColumnUpdate->updateNull(); else { - // als Value koennen nur double, string oder void auftreten try { - if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE ) + double f = 0.0; + if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323 { DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType ); } -- cgit From e28d24e20f58c0736b31db3beee93a8881849bc9 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 3 Jan 2011 14:41:49 +0100 Subject: dba34c: fix for flush and text recognize --- dbaccess/source/core/dataaccess/datasource.cxx | 2 +- dbaccess/source/ui/misc/DExport.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100755 => 100644 dbaccess/source/core/dataaccess/datasource.cxx diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx old mode 100755 new mode 100644 index 835f5398efc7..4cd88751ea15 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -204,7 +204,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) t if ( xListener.is() ) xListener->disposing( Source ); - impl_dispose( false ); + impl_dispose( true ); } //-------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index f4ff8064181d..e84cc8142f6a 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -447,7 +447,8 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl if ( eNumLang != LANGUAGE_NONE ) { nFormatKey = m_pFormatter->GetFormatForLanguageIfBuiltIn( nFormatKey, eNumLang ); - m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ); + if ( !m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ) ) + return NumberFormat::TEXT; } Reference xProp = xFormats->getByKey(nFormatKey); xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat; -- cgit From 8a8d24e0e13629228731ee283fe72bf753e26179 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 3 Jan 2011 14:49:28 +0100 Subject: dba34c: #i96942# check if hit shape is a custom one --- reportdesign/source/ui/report/dlgedfunc.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx index 1535ce7d6ee1..13badddbb079 100644 --- a/reportdesign/source/ui/report/dlgedfunc.cxx +++ b/reportdesign/source/ui/report/dlgedfunc.cxx @@ -451,6 +451,7 @@ void DlgEdFunc::activateOle(SdrObject* _pObj) void DlgEdFunc::deactivateOle(bool _bSelect) { OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache(); + OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController(); const ULONG nCount = rObjCache.Count(); for(ULONG i = 0 ; i< nCount;++i) { @@ -464,7 +465,6 @@ void DlgEdFunc::deactivateOle(bool _bSelect) m_bUiActive = false; if ( m_bShowPropertyBrowser ) { - OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController(); rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >()); } @@ -639,15 +639,17 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt) if (pObjOverlapped && !m_bSelectionMode) { colorizeOverlappedObject(pObjOverlapped); + } } } } } - } - else if ( aVEvt.pObj && !m_bSelectionMode) + else if ( aVEvt.pObj && (aVEvt.pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode) { colorizeOverlappedObject(aVEvt.pObj); } + else + bIsSetPoint = false; return bIsSetPoint; } // ----------------------------------------------------------------------------- -- cgit From 33b9b857ea6cb5a6f731de68f58e532242c43d30 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 4 Jan 2011 13:12:33 +0100 Subject: dba34c: #i20306# support for window function and limit fetch first, ... added --- connectivity/inc/connectivity/sqlnode.hxx | 2 + connectivity/source/drivers/file/fcomp.cxx | 4 +- connectivity/source/parse/sqlbison.y | 459 ++++++++++++++++++++++++++++- connectivity/source/parse/sqlflex.l | 27 ++ connectivity/source/parse/sqliterator.cxx | 16 +- 5 files changed, 491 insertions(+), 17 deletions(-) diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index 04ec8dc153df..2fe688574a0a 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -65,6 +65,8 @@ namespace rtl { class OUStringBuffer; } +#define ORDER_BY_CHILD_POS 5 +#define TABLE_EXPRESSION_CHILD_COUNT 9 namespace connectivity { diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index eeaec1ff40f1..c5b287164e16 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -99,7 +99,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) OSQLParseNode * pTableExp = pSQLParseNode->getChild(3); DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree"); DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree"); - DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree"); // check that we don't use anything other than count(*) as function OSQLParseNode* pSelection = pSQLParseNode->getChild(2); @@ -117,7 +117,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pTableExp->getChild(1); - pOrderbyClause = pTableExp->getChild(4); + pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS); } else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) { diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 947da78b8f62..bfea82a25c7c 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -217,6 +217,14 @@ using namespace connectivity; %token SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER %token SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL %token SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL +// window function +%token SQL_TOKEN_OVER SQL_TOKEN_ROW_NUMBER SQL_TOKEN_NTILE SQL_TOKEN_LEAD SQL_TOKEN_LAG SQL_TOKEN_RESPECT SQL_TOKEN_IGNORE SQL_TOKEN_NULLS +%token SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST +%token SQL_TOKEN_EXCLUDE SQL_TOKEN_OTHERS SQL_TOKEN_TIES SQL_TOKEN_FOLLOWING SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING SQL_TOKEN_RANGE SQL_TOKEN_ROWS +%token SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO +// LIMIT and OFFSEt +%token SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY + /* operators */ %left SQL_TOKEN_NAME %left SQL_TOKEN_OR @@ -286,6 +294,16 @@ using namespace connectivity; %type binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length %type large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone %type approximate_numeric_type exact_numeric_type opt_paren_precision_scale +/* window function rules */ +%type window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment +%type first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function +%type opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition +%type new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause +%type window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion +%type opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset +%type opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause +/* LIMIT and OFFSET */ +%type opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause %% /* Parse Tree an OSQLParser zurueckliefern @@ -920,19 +938,89 @@ selection: } | scalar_exp_commalist ; +opt_result_offset_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | result_offset_clause + ; +result_offset_clause: + SQL_TOKEN_OFFSET offset_row_count row_or_rows + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +opt_fetch_first_row_count: + /* empty */ {$$ = SQL_NEW_RULE;} + | fetch_first_row_count + ; +first_or_next: + SQL_TOKEN_FIRST + | SQL_TOKEN_NEXT + ; +row_or_rows: + SQL_TOKEN_ROW + | SQL_TOKEN_ROWS + ; +opt_fetch_first_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | fetch_first_clause + ; +fetch_first_clause: + SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + ; +offset_row_count: + literal + ; +fetch_first_row_count: + literal + ; +opt_limit_offset_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | limit_offset_clause + ; +opt_offset: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +limit_offset_clause: + SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; table_exp: - from_clause - opt_where_clause - opt_group_by_clause - opt_having_clause - opt_order_by_clause - {$$ = SQL_NEW_RULE; + from_clause opt_where_clause opt_group_by_clause opt_having_clause opt_window_clause opt_order_by_clause opt_limit_offset_clause opt_result_offset_clause opt_fetch_first_clause + { + $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); $$->append($3); $$->append($4); - $$->append($5);} + $$->append($5); + $$->append($6); + $$->append($7); + $$->append($8); + $$->append($9); + } ; from_clause: @@ -1949,6 +2037,362 @@ numeric_function: SQL_TOKEN_RAND | SQL_TOKEN_TRUNCATE ; + +window_function: + window_function_type SQL_TOKEN_OVER window_name_or_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_function_type : + rank_function_type '(' ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_ROW_NUMBER '(' ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | general_set_fct + | ntile_function + | lead_or_lag_function + | first_or_last_value_function + | nth_value_function +; +ntile_function : + SQL_TOKEN_NTILE '(' number_of_tiles ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +dynamic_parameter_specification: + parameter + ; +simple_value_specification: + literal + ; +number_of_tiles : + simple_value_specification + | dynamic_parameter_specification + ; +opt_lead_or_lag_function: + /* empty */ {$$ = SQL_NEW_RULE;} + | ',' offset + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | ',' offset ',' default_expression + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + } + ; +opt_null_treatment: + /* empty */ {$$ = SQL_NEW_RULE;} + | null_treatment + ; + +lead_or_lag_function: + lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($6); + } + ; +lead_or_lag: + SQL_TOKEN_LEAD + | SQL_TOKEN_LAG + ; +lead_or_lag_extent: + value_exp + ; +offset: + SQL_TOKEN_INTNUM + ; +default_expression: + value_exp + ; +null_treatment: + SQL_TOKEN_RESPECT SQL_TOKEN_NULLS + | SQL_TOKEN_IGNORE SQL_TOKEN_NULLS + ; +first_or_last_value_function: + first_or_last_value '(' value_exp ')' opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + ; +first_or_last_value : + SQL_TOKEN_FIRST_VALUE + | SQL_TOKEN_LAST_VALUE + ; +opt_from_first_or_last: + /* empty */ {$$ = SQL_NEW_RULE;} + | from_first_or_last + ; +nth_value_function: + SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($7); + $$->append($8); + } + ; +nth_row: + simple_value_specification + | dynamic_parameter_specification + ; +from_first_or_last: + SQL_TOKEN_FROM SQL_TOKEN_FIRST + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_FROM SQL_TOKEN_LAST + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_name: + SQL_TOKEN_NAME + ; +window_name_or_specification: + window_name + | in_line_window_specification + ; +in_line_window_specification: + window_specification + ; +opt_window_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_clause + ; +window_clause: + SQL_TOKEN_WINDOW window_definition_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_definition_list: + window_definition_list ',' window_definition + {$1->append($3); + $$ = $1;} + | window_definition + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + ; +window_definition: + new_window_name SQL_TOKEN_AS window_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +new_window_name: + window_name + ; +window_specification: + '(' window_specification_details ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +opt_existing_window_name: + /* empty */ {$$ = SQL_NEW_RULE;} + | existing_window_name + ; +opt_window_partition_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_partition_clause + ; +opt_window_frame_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_frame_clause + ; +window_specification_details: + opt_existing_window_name + opt_window_partition_clause + opt_order_by_clause + opt_window_frame_clause + ; +existing_window_name: + window_name + ; +window_partition_clause: + SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_partition_column_reference_list: + window_partition_column_reference_list ',' window_partition_column_reference + {$1->append($3); + $$ = $1;} + | window_partition_column_reference + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + ; +window_partition_column_reference: + column_ref opt_collate_clause + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +opt_window_frame_exclusion: + /* empty */ {$$ = SQL_NEW_RULE;} + | window_frame_exclusion + ; +window_frame_clause: + window_frame_units window_frame_extent opt_window_frame_exclusion + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +window_frame_units: + SQL_TOKEN_ROWS + | SQL_TOKEN_RANGE + ; +window_frame_extent: + window_frame_start + | window_frame_between + ; +window_frame_start: + SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | window_frame_preceding + | SQL_TOKEN_CURRENT SQL_TOKEN_ROW + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_preceding: + unsigned_value_spec SQL_TOKEN_PRECEDING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_between: + SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2 + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +window_frame_bound_1: + window_frame_bound + ; +window_frame_bound_2: + window_frame_bound + ; +window_frame_bound: + window_frame_start + | SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | window_frame_following + ; +window_frame_following: + unsigned_value_spec SQL_TOKEN_FOLLOWING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +window_frame_exclusion: + SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; op_parameter: {$$ = SQL_NEW_RULE;} | '?' SQL_EQUAL @@ -2313,6 +2757,7 @@ value_exp_primary: | set_fct_spec | scalar_subquery | case_expression + | window_function | '(' value_exp ')' { $$ = SQL_NEW_RULE; diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index c6723dfd6869..35a9278a8e49 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -212,15 +212,19 @@ END {SQL_NEW_KEYWORD(SQL_TOKEN_END); } EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); } ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); } EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); } +EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); } EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); } EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); } EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); } FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); } FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); } +FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); } +FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); } FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); } FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); } FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); } +FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); } FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); } FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); } FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); } @@ -234,6 +238,7 @@ GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); } HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); } HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); } +IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); } IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); } INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); } INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); } @@ -249,12 +254,17 @@ JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); } KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); } +LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); } LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); } +LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); } +LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); } LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); } +LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); } LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); } LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); } LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); } LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); } +LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); } LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); } LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); } LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); } @@ -276,29 +286,40 @@ NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); } NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); } NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); } NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); } +NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); } +NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); } NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); } NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); } +NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); } +NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); } NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); } NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); } +NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); } NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); } OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); } OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); } OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); } +OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); } OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); } OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); } ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); } +ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); } OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); } OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); } ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); } +OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); } OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); } +OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); } +PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); } PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); } PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); } PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); } PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); } POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); } POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); } +PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); } PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); } PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); } PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); } @@ -309,16 +330,20 @@ QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); } RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); } RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); } +RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); } RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); } REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); } REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); } REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); } REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); } REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); } +RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); } ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); } ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); } ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); } ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); } +ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); } +ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); } RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); } RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); } @@ -345,6 +370,7 @@ SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); } TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); } TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); } THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); } +TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); } TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); } TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); } TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); } @@ -363,6 +389,7 @@ TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); } T {SQL_NEW_KEYWORD(SQL_TOKEN_T); } UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); } +UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); } UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); } UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); } UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 34ba49566383..58d0330a2f29 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1068,9 +1068,9 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo OSQLParseNode * pTableExp = pSelectNode->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); - sal_uInt32 nPos = ( _bOrder ? 4 : 2 ); + sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 ); OSQLParseNode * pOptByClause = pTableExp->getChild(nPos); OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!"); @@ -1233,7 +1233,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele OSQLParseNode * pTableExp = pSelectNode->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pWhereClause = pTableExp->getChild(1); } else if (SQL_ISRULE(pSelectNode,update_statement_searched)) { @@ -1967,7 +1967,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pWhereClause = pTableExp->getChild(1); } @@ -1997,9 +1997,9 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); - pOrderClause = pTableExp->getChild(4); + pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: if(pOrderClause->count() != 3) pOrderClause = NULL; @@ -2019,7 +2019,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pGroupClause = pTableExp->getChild(2); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: @@ -2040,7 +2040,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const OSQLParseNode * pTableExp = m_pParseTree->getChild(3); OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pHavingClause = pTableExp->getChild(3); // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: -- cgit From 9f338a693e1f7ca0b649827103edab417bd9b4d5 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 4 Jan 2011 13:12:33 +0100 Subject: dba34c: #i20306# support for window function and limit fetch first, ... added --- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 67385fd02d67..e0b4a665a8bc 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2061,6 +2061,13 @@ namespace break; } + const OSQLParseNode* pTableExp = pParseTree->getChild(3); + if ( pTableExp->getChild(6)->count() > 0 || pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0) + { + eErrorCode = eStatementTooComplex; + break; + } + Reference< XConnection> xConnection = rController.getConnection(); if ( !xConnection.is() ) { @@ -2142,7 +2149,7 @@ namespace pTableView->RemoveTabWin(aIterTableMap->second); } - if ( eOk == (eErrorCode = FillOuterJoins(_pView,pParseTree->getChild(3)->getChild(0)->getChild(1))) ) + if ( eOk == (eErrorCode = FillOuterJoins(_pView,pTableExp->getChild(0)->getChild(1))) ) { // check if we have a distinct statement if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT)) -- cgit From b926321f4b3e4386e0d1ed4a2795477bd0f2e727 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 4 Jan 2011 13:42:04 +0100 Subject: dba34c: #i108229# check for correct token id --- connectivity/source/parse/sqliterator.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 58d0330a2f29..e0ea97f1f7aa 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1451,7 +1451,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode - ,const OSQLParseNode* _pColumnRef + ,const OSQLParseNode* _pParentNode ,const ::rtl::OUString& _aColumnName ,const ::rtl::OUString& _aTableRange ,const ::rtl::OUString& _rColumnAlias) @@ -1490,18 +1490,18 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode } // found a parameter - if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) ) + if ( _pParentNode && (SQL_ISRULE(_pParentNode,general_set_fct) || SQL_ISRULE(_pParentNode,set_fct_spec)) ) {// found a function as column_ref ::rtl::OUString sFunctionName; - _pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); - const sal_uInt32 nCount = _pColumnRef->count(); + _pParentNode->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); + const sal_uInt32 nCount = _pParentNode->count(); sal_uInt32 i = 0; for(; i < nCount;++i) { - if ( _pColumnRef->getChild(i) == _pParseNode ) + if ( _pParentNode->getChild(i) == _pParseNode ) break; } - sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1); + sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pParentNode->getChild(0)->getTokenID(), i-1); OParseColumn* pColumn = new OParseColumn( sParameterName, ::rtl::OUString(), @@ -1552,14 +1552,14 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode if ( bNotFound ) { sal_Int32 nType = DataType::VARCHAR; - OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL; + OSQLParseNode* pParent = _pParentNode ? _pParentNode->getParent() : NULL; if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) ) { - const sal_uInt32 nCount = _pColumnRef->count(); + const sal_uInt32 nCount = _pParentNode->count(); sal_uInt32 i = 0; for(; i < nCount;++i) { - if ( _pColumnRef->getChild(i) == _pParseNode ) + if ( _pParentNode->getChild(i) == _pParseNode ) break; } nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1); -- cgit From c15fb91736dfb70247d864267290d0053a05267c Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 4 Jan 2011 18:51:14 +0100 Subject: dr78: oox - import of BIFF3-BIFF5 drawing objects - first bits --- .../oox/drawingml/chart/chartdrawingfragment.hxx | 5 +- oox/inc/oox/drawingml/drawingmltypes.hxx | 20 + oox/inc/oox/helper/zipstorage.hxx | 5 +- oox/inc/oox/vml/vmlformatting.hxx | 2 +- oox/inc/oox/xls/drawingbase.hxx | 147 ++++ oox/inc/oox/xls/drawingfragment.hxx | 96 +- oox/inc/oox/xls/drawingmanager.hxx | 447 ++++++++++ oox/inc/oox/xls/worksheethelper.hxx | 5 +- .../drawingml/chart/chartdrawingfragment.cxx | 55 +- oox/source/drawingml/shape.cxx | 5 +- oox/source/vml/vmlformatting.cxx | 19 +- oox/source/xls/drawingbase.cxx | 327 +++++++ oox/source/xls/drawingfragment.cxx | 362 +------- oox/source/xls/drawingmanager.cxx | 979 +++++++++++++++++++++ oox/source/xls/makefile.mk | 2 + oox/source/xls/worksheetfragment.cxx | 6 + oox/source/xls/worksheethelper.cxx | 146 +-- 17 files changed, 2083 insertions(+), 545 deletions(-) create mode 100755 oox/inc/oox/xls/drawingbase.hxx create mode 100755 oox/inc/oox/xls/drawingmanager.hxx create mode 100755 oox/source/xls/drawingbase.cxx create mode 100755 oox/source/xls/drawingmanager.cxx diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx index 0b5a7f6374a4..b685664ad612 100644 --- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx +++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx @@ -72,8 +72,7 @@ public: void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); /** Calculates the resulting shape anchor in EMUs. */ - ::com::sun::star::awt::Rectangle - calcEmuLocation( const EmuRectangle& rEmuChartRect ) const; + EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const; private: AnchorPosModel maFrom; /// Top-left position relative to chart object. @@ -108,7 +107,7 @@ private: mxDrawPage; /// Drawing page of this sheet. ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape. ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape. - EmuRectangle maEmuChartRect; /// Position and size of the chart object for embedded shapes (in EMUs). + EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs). bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page. }; diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx index f8bb4c91b5d5..3ceb0e82838a 100644 --- a/oox/inc/oox/drawingml/drawingmltypes.hxx +++ b/oox/inc/oox/drawingml/drawingmltypes.hxx @@ -35,6 +35,7 @@ #include #include #include +#include "oox/helper/helper.hxx" namespace oox { namespace drawingml { @@ -150,6 +151,22 @@ IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::st // ============================================================================ +const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm. + +/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */ +inline sal_Int64 convertHmmToEmu( sal_Int32 nValue ) +{ + return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM; +} + +/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */ +inline sal_Int32 convertEmuToHmm( sal_Int64 nValue ) +{ + return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, 0, SAL_MAX_INT32 ); +} + +// ============================================================================ + struct EmuPoint { sal_Int64 X; @@ -177,6 +194,9 @@ struct EmuRectangle : public EmuPoint, public EmuSize inline explicit EmuRectangle() {} inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {} inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {} + + inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; } + inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; } }; // ============================================================================ diff --git a/oox/inc/oox/helper/zipstorage.hxx b/oox/inc/oox/helper/zipstorage.hxx index 0c9a15c10077..d4bc68794323 100644 --- a/oox/inc/oox/helper/zipstorage.hxx +++ b/oox/inc/oox/helper/zipstorage.hxx @@ -83,9 +83,8 @@ private: virtual void implCommit() const; private: - typedef ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > XStorageRef; - - XStorageRef mxStorage; /// Storage based on input or output stream. + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + mxStorage; /// Storage based on input or output stream. }; // ============================================================================ diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index db67d7a85af4..76242fca3418 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -90,7 +90,7 @@ public: @param bDefaultAsPixel Set to true if omitted measure unit means pixel. Set to false if omitted measure unit means EMU. */ - static sal_Int32 decodeMeasureToEmu( + static sal_Int64 decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, const ::rtl::OUString& rValue, sal_Int32 nRefValue, diff --git a/oox/inc/oox/xls/drawingbase.hxx b/oox/inc/oox/xls/drawingbase.hxx new file mode 100755 index 000000000000..01bf43a6434f --- /dev/null +++ b/oox/inc/oox/xls/drawingbase.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef OOX_XLS_DRAWINGBASE_HXX +#define OOX_XLS_DRAWINGBASE_HXX + +#include "oox/drawingml/drawingmltypes.hxx" +#include "oox/xls/worksheethelper.hxx" + +namespace oox { +namespace xls { + +// ============================================================================ + +/** Absolute position in a spreadsheet (in EMUs) independent from cells. */ +struct AnchorPointModel : public ::oox::drawingml::EmuPoint +{ + inline explicit AnchorPointModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {} + inline bool isValid() const { return (X >= 0) && (Y >= 0); } +}; + +// ---------------------------------------------------------------------------- + +/** Absolute size in a spreadsheet (in EMUs). */ +struct AnchorSizeModel : public ::oox::drawingml::EmuSize +{ + inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {} + inline bool isValid() const { return (Width >= 0) && (Height >= 0); } +}; + +// ---------------------------------------------------------------------------- + +/** Position in spreadsheet (cell position and offset inside cell). */ +struct CellAnchorModel +{ + sal_Int32 mnCol; /// Column index. + sal_Int32 mnRow; /// Row index. + sal_Int64 mnColOffset; /// X offset inside the column. + sal_Int64 mnRowOffset; /// Y offset inside the row. + + explicit CellAnchorModel(); + inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); } +}; + +// ---------------------------------------------------------------------------- + +/** Application-specific client data of a shape. */ +struct AnchorClientDataModel +{ + bool mbLocksWithSheet; + bool mbPrintsWithSheet; + + explicit AnchorClientDataModel(); +}; + +// ============================================================================ + +/** Contains the position of a shape in the spreadsheet. Supports different + shape anchor modes (absolute, one-cell, two-cell). */ +class ShapeAnchor : public WorksheetHelper +{ +public: + explicit ShapeAnchor( const WorksheetHelper& rHelper ); + + /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */ + void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ); + /** Imports the absolute anchor position from the xdr:pos element. */ + void importPos( const AttributeList& rAttribs ); + /** Imports the absolute anchor size from the xdr:ext element. */ + void importExt( const AttributeList& rAttribs ); + /** Imports the shape client data from the xdr:clientData element. */ + void importClientData( const AttributeList& rAttribs ); + /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */ + void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); + /** Imports the client anchor settings from a VML element. */ + void importVmlAnchor( const ::rtl::OUString& rAnchor ); + /** Imports the client anchor settings from a BIFF or DFF stream. */ + void importBiffAnchor( BinaryInputStream& rStrm ); + + /** Calculates the resulting shape anchor in EMUs. */ + ::oox::drawingml::EmuRectangle calcAnchorRectEmu( + const ::com::sun::star::awt::Size& rPageSizeHmm ) const; + /** Calculates the resulting shape anchor in 1/100 mm. */ + ::com::sun::star::awt::Rectangle calcAnchorRectHmm( + const ::com::sun::star::awt::Size& rPageSizeHmm ) const; + +private: + /** Converts the passed anchor to an absolute position in EMUs. */ + ::oox::drawingml::EmuPoint calcCellAnchorEmu( const CellAnchorModel& rModel ) const; + +private: + enum AnchorType + { + ANCHOR_INVALID, /// Anchor type is unknown. + ANCHOR_ABSOLUTE, /// Absolute anchor (top-left corner and size in absolute units). + ANCHOR_ONECELL, /// One-cell anchor (top-left corner at cell, size in absolute units). + ANCHOR_TWOCELL /// Two-cell anchor (top-left and bottom-right corner at cell). + }; + + /** Specifies how cell positions from CellAnchorModel have to be processed. */ + enum CellAnchorType + { + CELLANCHOR_EMU, /// Offsets are given in EMUs. + CELLANCHOR_PIXEL, /// Offsets are given in screen pixels. + CELLANCHOR_COLROW /// Offsets are given in fractions of column width or row height. + }; + + AnchorType meAnchorType; /// Type of this shape anchor. + CellAnchorType meCellAnchorType; /// Type of the cell anchor models. + AnchorPointModel maPos; /// Top-left position, if anchor is of type absolute. + AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell. + CellAnchorModel maFrom; /// Top-left position, if anchor is not of type absolute. + CellAnchorModel maTo; /// Bottom-right position, if anchor is of type two-cell. + AnchorClientDataModel maClientData; /// Shape client data. + sal_Int32 mnEditAs; /// Anchor mode as shown in the UI. +}; + +// ============================================================================ + +} // namespace xls +} // namespace oox + +#endif diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx index 66d716220b8a..a6877edf7cca 100644 --- a/oox/inc/oox/xls/drawingfragment.hxx +++ b/oox/inc/oox/xls/drawingfragment.hxx @@ -33,6 +33,7 @@ #include "oox/drawingml/shape.hxx" #include "oox/vml/vmldrawing.hxx" #include "oox/vml/vmldrawingfragment.hxx" +#include "oox/xls/drawingbase.hxx" #include "oox/xls/excelhandlers.hxx" namespace oox { @@ -40,97 +41,6 @@ namespace xls { // ============================================================================ -/** Absolute position in spreadsheet (in EMUs) independent from cells. */ -struct AnchorPosModel : public ::oox::drawingml::EmuPoint -{ - inline explicit AnchorPosModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {} - inline bool isValid() const { return (X >= 0) && (Y >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Absolute size in spreadsheet (in EMUs). */ -struct AnchorSizeModel : public ::oox::drawingml::EmuSize -{ - inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {} - inline bool isValid() const { return (Width >= 0) && (Height >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Position in spreadsheet (cell position and offset inside cell in EMUs). */ -struct AnchorCellModel -{ - sal_Int32 mnCol; /// Column index. - sal_Int32 mnRow; /// Row index. - sal_Int64 mnColOffset; /// X offset in column mnCol (EMUs). - sal_Int64 mnRowOffset; /// Y offset in row mnRow (EMUs). - - explicit AnchorCellModel(); - inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); } -}; - -// ---------------------------------------------------------------------------- - -/** Application-specific client data of a shape. */ -struct AnchorClientDataModel -{ - bool mbLocksWithSheet; - bool mbPrintsWithSheet; - - explicit AnchorClientDataModel(); -}; - -// ============================================================================ - -/** Contains the position of a shape in the spreadsheet. Supports different - shape anchor modes (absolute, one-cell, two-cell). */ -class ShapeAnchor : public WorksheetHelper -{ -public: - explicit ShapeAnchor( const WorksheetHelper& rHelper ); - - /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */ - void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ); - /** Imports the absolute anchor position from the xdr:pos element. */ - void importPos( const AttributeList& rAttribs ); - /** Imports the absolute anchor size from the xdr:ext element. */ - void importExt( const AttributeList& rAttribs ); - /** Imports the shape client data from the xdr:clientData element. */ - void importClientData( const AttributeList& rAttribs ); - /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */ - void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue ); - void importVmlAnchor( const ::rtl::OUString& rAnchor ); - - /** Returns true, if the anchor contains valid position and size settings. */ - bool isValidAnchor() const; - - /** Calculates the resulting shape anchor in 1/100 mm. */ - ::com::sun::star::awt::Rectangle - calcApiLocation( - const ::com::sun::star::awt::Size& rApiSheetSize, - const AnchorSizeModel& rEmuSheetSize ) const; - - /** Calculates the resulting shape anchor in EMUs. */ - ::com::sun::star::awt::Rectangle - calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const; - -private: - enum AnchorType { ANCHOR_ABSOLUTE, ANCHOR_ONECELL, ANCHOR_TWOCELL, ANCHOR_VML, ANCHOR_INVALID }; - - AnchorType meType; /// Type of this shape anchor. - AnchorPosModel maPos; /// Top-left position, if anchor is of type absolute. - AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell. - AnchorCellModel maFrom; /// Top-left position, if anchor is not of type absolute. - AnchorCellModel maTo; /// Bottom-right position, if anchor is of type two-cell. - AnchorClientDataModel maClientData; /// Shape client data. - sal_Int32 mnEditAs; /// Anchor mode as shown in the UI. -}; - -typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef; - -// ============================================================================ - /** Fragment handler for a complete sheet drawing. */ class OoxDrawingFragment : public OoxWorksheetFragmentBase { @@ -146,10 +56,10 @@ protected: virtual void onEndElement( const ::rtl::OUString& rChars ); private: + typedef ::std::auto_ptr< ShapeAnchor > ShapeAnchorRef; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage; /// Drawing page of this sheet. - ::com::sun::star::awt::Size maApiSheetSize; /// Sheet size in 1/100 mm. - AnchorSizeModel maEmuSheetSize; /// Sheet size in EMU. ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape. ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape. }; diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx new file mode 100755 index 000000000000..766d54cf83a3 --- /dev/null +++ b/oox/inc/oox/xls/drawingmanager.hxx @@ -0,0 +1,447 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef OOX_XLS_DRAWINGMANAGER_HXX +#define OOX_XLS_DRAWINGMANAGER_HXX + +#include "oox/xls/drawingbase.hxx" + +namespace com { namespace sun { namespace star { + namespace drawing { class XDrawPage; } + namespace drawing { class XShape; } + namespace drawing { class XShapes; } +} } } + +namespace oox { +namespace xls { + +// ============================================================================ +// Model structures for BIFF OBJ record data +// ============================================================================ + +/** This structure contains line formatting attributes from an OBJ record. */ +struct BiffObjLineModel +{ + sal_uInt8 mnColorIdx; /// Index into color palette. + sal_uInt8 mnStyle; /// Line dash style. + sal_uInt8 mnWidth; /// Line width. + sal_uInt8 mnAuto; /// Automatic line flag. + + explicit BiffObjLineModel(); + + /** Returns true, if the line formatting is set to automatic. */ + bool isAuto() const; + /** Returns true, if the line formatting is visible (automatic or explicit). */ + bool isVisible() const; +}; + +// ============================================================================ + +/** This structure contains fill formatting attributes from an OBJ record. */ +struct BiffObjFillModel +{ + sal_uInt8 mnBackColorIdx; /// Index to color palette for background color. + sal_uInt8 mnPattColorIdx; /// Index to color palette for pattern foreground color. + sal_uInt8 mnPattern; /// Fill pattern. + sal_uInt8 mnAuto; /// Automatic fill flag. + + explicit BiffObjFillModel(); + + /** Returns true, if the fill formatting is set to automatic. */ + bool isAuto() const; + /** Returns true, if the fill formatting is visible (automatic or explicit). */ + bool isFilled() const; +}; + +// ============================================================================ + +/** This structure contains text formatting attributes from an OBJ record. */ +struct BiffObjTextModel +{ + sal_uInt16 mnTextLen; /// Length of the text (characters). + sal_uInt16 mnFormatSize; /// Size of the formatting array (bytes). + sal_uInt16 mnLinkSize; /// Size of the linked text formula (bytes). + sal_uInt16 mnDefFontId; /// Font index for default font formatting. + sal_uInt16 mnFlags; /// Additional flags. + sal_uInt16 mnOrientation; /// Text orientation. + sal_uInt16 mnButtonFlags; /// Additional flags for push buttons. + sal_uInt16 mnShortcut; /// Shortcut character. + sal_uInt16 mnShortcutEA; /// East-asian shortcut character. + + explicit BiffObjTextModel(); + + /** Reads text data from a BIFF3/BIFF4 OBJ record. */ + void readObj3( BiffInputStream& rStrm ); + /** Reads text data from a BIFF5 OBJ record. */ + void readObj5( BiffInputStream& rStrm ); + /** Reads text data from a BIFF8 TXO record. */ + void readTxo8( BiffInputStream& rStrm ); + + /** Returns the horizontal alignment of the text. */ + sal_uInt8 getHorAlign() const; + /** Returns the vertical alignment of the text. */ + sal_uInt8 getVerAlign() const; +}; + +// ============================================================================ +// BIFF drawing objects +// ============================================================================ + +class BiffDrawingBase; +class BiffDrawingObjectBase; +typedef ::boost::shared_ptr< BiffDrawingObjectBase > BiffDrawingObjectRef; + +// ---------------------------------------------------------------------------- + +class BiffDrawingObjectContainer +{ +public: + explicit BiffDrawingObjectContainer(); + + /** Appends the passed object to the list of objects. */ + void append( const BiffDrawingObjectRef& rxDrawingObj ); + /** Tries to insert the passed object into the last group or appends it. */ + void insertGrouped( const BiffDrawingObjectRef& rxDrawingObj ); + + /** Creates and inserts all UNO shapes into the passed shape container. */ + void convertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const; + +private: + typedef RefVector< BiffDrawingObjectBase > BiffDrawingObjectVector; + BiffDrawingObjectVector maObjects; +}; + +// ============================================================================ + +/** Base class for all BIFF drawing objects (OBJ records). */ +class BiffDrawingObjectBase : public WorksheetHelper +{ +public: + explicit BiffDrawingObjectBase( const WorksheetHelper& rHelper ); + virtual ~BiffDrawingObjectBase(); + + /** Reads the BIFF3 OBJ record, returns a new drawing object. */ + static BiffDrawingObjectRef importObjBiff3( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); + /** Reads the BIFF4 OBJ record, returns a new drawing object. */ + static BiffDrawingObjectRef importObjBiff4( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); + /** Reads the BIFF5 OBJ record, returns a new drawing object. */ + static BiffDrawingObjectRef importObjBiff5( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); + /** Reads the BIFF8 OBJ record, returns a new drawing object. */ + static BiffDrawingObjectRef importObjBiff8( const WorksheetHelper& rHelper, BiffInputStream& rStrm ); + + /** Sets whether this is an area object (then its width and height must be greater than 0). */ + inline void setAreaObj( bool bAreaObj ) { mbAreaObj = bAreaObj; } + /** If set to true, the object supports a simple on-click macro and/or hyperlink. */ + inline void setSimpleMacro( bool bMacro ) { mbSimpleMacro = bMacro; } + + /** If set to false, the UNO shape will not be created, processed, or inserted into the draw page. */ + inline void setProcessShape( bool bProcess ) { mbProcessShape = bProcess; } + /** If set to false, the UNO shape will be created or processed, but not be inserted into the draw page. */ + inline void setInsertShape( bool bInsert ) { mbInsertShape = bInsert; } + /** If set to true, a new custom UNO shape will be created while in DFF import (BIFF8 only). */ + inline void setCustomDffObj( bool bCustom ) { mbCustomDff = bCustom; } + + /** Returns the object identifier from the OBJ record. */ + inline sal_uInt16 getObjId() const { return mnObjId; } + /** Returns the object type from the OBJ record. */ + inline sal_uInt16 getObjType() const { return mnObjType; } + + /** Returns true, if the object is hidden. */ + inline bool isHidden() const { return mbHidden; } + /** Returns true, if the object is visible. */ + inline bool isVisible() const { return mbVisible; } + /** Returns true, if the object is printable. */ + inline bool isPrintable() const { return mbPrintable; } + + /** Creates the UNO shape and inserts it into the passed shape container. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + convertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const; + +protected: + /** Reads the object name in a BIFF5 OBJ record. */ + void readNameBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen ); + /** Reads the macro link in a BIFF3 OBJ record. */ + void readMacroBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the macro link in a BIFF4 OBJ record. */ + void readMacroBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the macro link in a BIFF5 OBJ record. */ + void readMacroBiff5( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the ftMacro sub structure in an OBJ record. */ + void readMacroBiff8( BiffInputStream& rStrm ); + + /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */ + virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Derived classes read the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Derived classes read the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + /** Derived classes read the contents of the specified subrecord of a BIFF8 OBJ record from stream. */ + virtual void implReadObjBiff8SubRec( BiffInputStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize ); + + /** Derived classes create the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0; + +private: + /** Reads the contents of a BIFF3 OBJ record. */ + void importObjBiff3( BiffInputStream& rStrm ); + /** Reads the contents of a BIFF4 OBJ record. */ + void importObjBiff4( BiffInputStream& rStrm ); + /** Reads the contents of a BIFF5 OBJ record. */ + void importObjBiff5( BiffInputStream& rStrm ); + /** Reads the contents of a BIFF8 OBJ record. */ + void importObjBiff8( BiffInputStream& rStrm ); + +private: + ShapeAnchor maAnchor; /// Position of the drawing object. + ::rtl::OUString maObjName; /// Name of the object. + ::rtl::OUString maMacroName; /// Name of an attached macro. + ::rtl::OUString maHyperlink; /// On-click hyperlink URL. + sal_uInt32 mnDffShapeId; /// Shape identifier from DFF stream (BIFF8 only). + sal_uInt32 mnDffFlags; /// Shape flags from DFF stream. + sal_uInt16 mnObjId; /// The object identifier (unique per drawing). + sal_uInt16 mnObjType; /// The object type from OBJ record. + bool mbHasAnchor; /// True = anchor has been initialized. + bool mbHidden; /// True = object is hidden. + bool mbVisible; /// True = object is visible (form controls). + bool mbPrintable; /// True = object is printable. + bool mbAreaObj; /// True = width and height must be greater than 0. + bool mbAutoMargin; /// True = set automatic text margin. + bool mbSimpleMacro; /// True = create simple macro link and hyperlink. + bool mbProcessShape; /// True = object is valid, do processing and insertion. + bool mbInsertShape; /// True = insert the UNO shape into the draw page. + bool mbCustomDff; /// True = recreate UNO shape in DFF import (BIFF8 only). +}; + +// ============================================================================ + +/** A placeholder object for unknown/unsupported object types. */ +class BiffPlaceholderObject : public BiffDrawingObjectBase +{ +public: + explicit BiffPlaceholderObject( const WorksheetHelper& rHelper ); + +protected: + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; +}; + +// ============================================================================ + +/** A group object that is able to contain other child objects. */ +class BiffGroupObject : public BiffDrawingObjectBase +{ +public: + explicit BiffGroupObject( const WorksheetHelper& rHelper ); + + /** Tries to insert the passed drawing object into this or a nested group. */ + bool tryInsert( const BiffDrawingObjectRef& rxDrawingObj ); + +protected: + /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ + virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + +protected: + BiffDrawingObjectContainer maChildren; /// All child objects contained in this group object. + sal_uInt16 mnFirstUngrouped; /// Object identfier of first object not grouped into this group. +}; + +// ============================================================================ + +/** A simple line object. */ +class BiffLineObject : public BiffDrawingObjectBase +{ +public: + explicit BiffLineObject( const WorksheetHelper& rHelper ); + +protected: + /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ + virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + +protected: + BiffObjLineModel maLineModel; /// Line formatting. + sal_uInt16 mnArrows; /// Line arrows. + sal_uInt8 mnStartPoint; /// Starting point. +}; + +// ============================================================================ + +/** A simple rectangle object (used as base class for oval objects). */ +class BiffRectObject : public BiffDrawingObjectBase +{ +public: + explicit BiffRectObject( const WorksheetHelper& rHelper ); + +protected: + /** Reads the fill model, the line model, and frame flags. */ + void readFrameData( BiffInputStream& rStrm ); + + /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ + virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + +protected: + BiffObjFillModel maFillModel; /// Fill formatting. + BiffObjLineModel maLineModel; /// Line formatting. + sal_uInt16 mnFrameFlags; /// Additional flags. +}; + +// ============================================================================ + +/** A simple oval object. */ +class BiffOvalObject : public BiffRectObject +{ +public: + explicit BiffOvalObject( const WorksheetHelper& rHelper ); + +protected: + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; +}; + +// ============================================================================ +// BIFF drawing page +// ============================================================================ + +/** Base class for a container for all objects on a drawing page (in a + spreadsheet or in an embedded chart object). + + For BIFF import, it is needed to load all drawing objects before converting + them to UNO shapes. There might be some dummy drawing objects (e.g. the + dropdown buttons of autofilters) which have to be skipped. The information, + that a drawing object is a dummy object, may be located after the drawing + objects themselves. + + The BIFF8 format stores drawing objects in the DFF stream (stored + fragmented in MSODRAWING records), and in the OBJ records. The DFF stream + fragments are collected in a single stream, and the complete stream will be + processed afterwards. + */ +class BiffDrawingBase : public WorksheetHelper +{ +public: + explicit BiffDrawingBase( const WorksheetHelper& rHelper, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage ); + + /** Imports a plain OBJ record (without leading DFF data). */ + void importObj( BiffInputStream& rStrm ); + /** Sets the object with the passed identifier to be skipped on import. */ + void setSkipObj( sal_uInt16 nObjId ); + + /** Final processing after import of the all drawing objects. */ + void finalizeImport(); + + /** Creates a new UNO shape object, inserts it into the passed UNO shape + container, and sets the shape position and size. */ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + createAndInsertXShape( + const ::rtl::OUString& rService, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + + /** Derived classes may want to know that a shape has been inserted. Will + be called from the convertAndInsert() implementation. */ + virtual void notifyShapeInserted( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + const ::com::sun::star::awt::Rectangle& rShapeRect ) = 0; + +protected: + /** Appends a new drawing object to the list of raw objects (without DFF data). */ + void appendRawObject( const BiffDrawingObjectRef& rxDrawingObj ); + +private: + typedef RefMap< sal_uInt16, BiffDrawingObjectBase > BiffDrawingObjectMapById; + typedef ::std::vector< sal_uInt16 > BiffObjIdVector; + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > + mxDrawPage; /// UNO draw page used to insert the shapes. + BiffDrawingObjectContainer maRawObjs; /// Drawing objects without DFF data. + BiffDrawingObjectMapById maObjMapId; /// Maps drawing objects by their object identifiers. + BiffObjIdVector maSkipObjs; /// Identifiers of all objects to be skipped. +}; + +// ---------------------------------------------------------------------------- + +/** Drawing manager of a single sheet. */ +class BiffSheetDrawing : public BiffDrawingBase +{ +public: + explicit BiffSheetDrawing( const WorksheetHelper& rHelper ); + + /** Called when a new UNO shape has been inserted into the draw page. */ + virtual void notifyShapeInserted( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + const ::com::sun::star::awt::Rectangle& rShapeRect ); +}; + +// ============================================================================ + +} // namespace xls +} // namespace oox + +#endif diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index 632d7027403f..14a5ca4be888 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -52,6 +52,7 @@ namespace xls { struct BinAddress; struct BinRange; +class BiffSheetDrawing; class BinRangeList; class WorksheetSettings; class SharedFormulaBuffer; @@ -318,8 +319,10 @@ public: PageSettings& getPageSettings() const; /** Returns the view settings for this sheet. */ SheetViewSettings& getSheetViewSettings() const; - /** Returns the VML drawing page for this sheet. */ + /** Returns the VML drawing page for this sheet (OOXML/BIFF12 only). */ VmlDrawing& getVmlDrawing() const; + /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */ + BiffSheetDrawing& getBiffDrawing() const; /** Sets the passed string to the cell. */ void setStringCell( diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx index fcc350b583c3..f4d4ab8daf59 100644 --- a/oox/source/drawingml/chart/chartdrawingfragment.cxx +++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx @@ -83,42 +83,41 @@ void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OU } } -Rectangle ShapeAnchor::calcEmuLocation( const EmuRectangle& rEmuChartRect ) const +EmuRectangle ShapeAnchor::calcAnchorRectEmu( const EmuRectangle& rChartRect ) const { - Rectangle aLoc( -1, -1, -1, -1 ); + EmuRectangle aAnchorRect( -1, -1, -1, -1 ); - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcEmuLocation - invalid from position" ); - OSL_ENSURE( mbRelSize ? maTo.isValid() : maSize.isValid(), "ShapeAnchor::calcEmuLocation - invalid to/size" ); + OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid from position" ); + OSL_ENSURE( mbRelSize ? maTo.isValid() : maSize.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid to/size" ); if( maFrom.isValid() && (mbRelSize ? maTo.isValid() : maSize.isValid()) ) { // calculate shape position - aLoc.X = getLimitedValue< sal_Int32, double >( maFrom.mfX * rEmuChartRect.Width, 0, SAL_MAX_INT32 ); - aLoc.Y = getLimitedValue< sal_Int32, double >( maFrom.mfY * rEmuChartRect.Height, 0, SAL_MAX_INT32 ); + aAnchorRect.X = static_cast< sal_Int64 >( maFrom.mfX * rChartRect.Width + 0.5 ); + aAnchorRect.Y = static_cast< sal_Int64 >( maFrom.mfY * rChartRect.Height + 0.5 ); // calculate shape size if( mbRelSize ) { - aLoc.Width = getLimitedValue< sal_Int32, double >( maTo.mfX * rEmuChartRect.Width, 0, SAL_MAX_INT32 ) - aLoc.X; - if( aLoc.Width < 0 ) + aAnchorRect.Width = static_cast< sal_Int64 >( maTo.mfX * rChartRect.Width + 0.5 ) - aAnchorRect.X; + if( aAnchorRect.Width < 0 ) { - aLoc.X += aLoc.Width; - aLoc.Width *= -1; + aAnchorRect.X += aAnchorRect.Width; + aAnchorRect.Width *= -1; } - aLoc.Height = getLimitedValue< sal_Int32, double >( maTo.mfY * rEmuChartRect.Height, 0, SAL_MAX_INT32 ) - aLoc.Y; - if( aLoc.Height < 0 ) + aAnchorRect.Height = static_cast< sal_Int64 >( maTo.mfY * rChartRect.Height + 0.5 ) - aAnchorRect.Y; + if( aAnchorRect.Height < 0 ) { - aLoc.Y += aLoc.Height; - aLoc.Height *= -1; + aAnchorRect.Y += aAnchorRect.Height; + aAnchorRect.Height *= -1; } } else { - aLoc.Width = getLimitedValue< sal_Int32, sal_Int64 >( maSize.Width, 0, SAL_MAX_INT32 ); - aLoc.Height = getLimitedValue< sal_Int32, sal_Int64 >( maSize.Height, 0, SAL_MAX_INT32 ); + aAnchorRect.setSize( maSize ); } } - return aLoc; + return aAnchorRect; } // ============================================================================ @@ -129,10 +128,10 @@ ChartDrawingFragment::ChartDrawingFragment( XmlFilterBase& rFilter, mxDrawPage( rxDrawPage ), mbOleSupport( bOleSupport ) { - maEmuChartRect.X = static_cast< sal_Int64 >( rShapesOffset.X ) * 360; - maEmuChartRect.Y = static_cast< sal_Int64 >( rShapesOffset.Y ) * 360; - maEmuChartRect.Width = static_cast< sal_Int64 >( rChartSize.Width ) * 360; - maEmuChartRect.Height = static_cast< sal_Int64 >( rChartSize.Height ) * 360; + maChartRectEmu.X = convertHmmToEmu( rShapesOffset.X ); + maChartRectEmu.Y = convertHmmToEmu( rShapesOffset.Y ); + maChartRectEmu.Width = convertHmmToEmu( rChartSize.Width ); + maChartRectEmu.Height = convertHmmToEmu( rChartSize.Height ); } ChartDrawingFragment::~ChartDrawingFragment() @@ -217,9 +216,17 @@ void ChartDrawingFragment::onEndElement( const OUString& rChars ) case CDR_TOKEN( relSizeAnchor ): if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() ) { - Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartRect ); - if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) ) - mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aLoc ); + EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( maChartRectEmu ); + if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && (aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) ) + { + // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle) + Rectangle aShapeRectEmu32( + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); + mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aShapeRectEmu32 ); + } } mxShape.reset(); mxAnchor.reset(); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f0ae2ec2a7a3..4d15886a641a 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -259,7 +259,10 @@ Reference< XShape > Shape::createAndInsert( OUString aServiceName = rServiceName; if( mxCreateCallback.get() ) - aServiceName = mxCreateCallback->onCreateXShape( aServiceName, awt::Rectangle( aPosition.X / 360, aPosition.Y / 360, aSize.Width / 360, aSize.Height / 360 ) ); + { + awt::Rectangle aShapeRectHmm( convertEmuToHmm( aPosition.X ), convertEmuToHmm( aPosition.Y ), convertEmuToHmm( aSize.Width ), convertEmuToHmm( aSize.Height ) ); + aServiceName = mxCreateCallback->onCreateXShape( aServiceName, aShapeRectHmm ); + } sal_Bool bIsCustomShape = aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ); basegfx::B2DHomMatrix aTransformation; diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 827930c22496..9ee8a4ec3215 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -105,7 +105,7 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r return fDefValue; } -/*static*/ sal_Int32 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, +/*static*/ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { // default for missing values is 0 @@ -148,10 +148,11 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r fValue *= 12700.0; else if( (cChar1 == 'p') && (cChar2 == 'c') ) // 1 pica = 1/6 inch = 152,400 EMU fValue *= 152400.0; - else if( (cChar1 == 'p') && (cChar2 == 'x') ) // 1 pixel, dependent on output device, factor 360 to convert 1/100mm to EMU - fValue = bPixelX ? - rGraphicHelper.convertScreenPixelXToHmm( 360.0 * fValue ) : - rGraphicHelper.convertScreenPixelYToHmm( 360.0 * fValue ); + else if( (cChar1 == 'p') && (cChar2 == 'x') ) // 1 pixel, dependent on output device + fValue = static_cast< double >( ::oox::drawingml::convertHmmToEmu( + bPixelX ? + rGraphicHelper.convertScreenPixelXToHmm( fValue ) : + rGraphicHelper.convertScreenPixelYToHmm( fValue ) ) ); } else if( (aUnit.getLength() == 1) && (aUnit[ 0 ] == '%') ) { @@ -162,13 +163,13 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r OSL_ENSURE( false, "ConversionHelper::decodeMeasureToEmu - unknown measure unit" ); fValue = nRefValue; } - return static_cast< sal_Int32 >( fValue + 0.5 ); + return static_cast< sal_Int64 >( fValue + 0.5 ); } /*static*/ sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper, const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { - return (decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) + 180) / 360; + return ::oox::drawingml::convertEmuToHmm( decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) ); } // ============================================================================ @@ -285,7 +286,7 @@ void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper, orDmlColor.setSrgbClr( nDefaultRgb ); } -sal_Int32 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int32 nDefValue ) +sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int64 nDefValue ) { return roValue.has() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.get(), 0, false, false ) : nDefValue; } @@ -442,7 +443,7 @@ void StrokeModel::pushToPropMap( PropertyMap& rPropMap, lclConvertArrow( aLineProps.maStartArrow, maStartArrow ); lclConvertArrow( aLineProps.maEndArrow, maEndArrow ); lclGetColor( aLineProps.maLineFill.maFillColor, rGraphicHelper, moColor, moOpacity, API_RGB_BLACK ); - aLineProps.moLineWidth = lclGetEmu( rGraphicHelper, moWeight, 1 ); + aLineProps.moLineWidth = getLimitedValue< sal_Int32, sal_Int64 >( lclGetEmu( rGraphicHelper, moWeight, 1 ), 0, SAL_MAX_INT32 ); lclGetDmlLineDash( aLineProps.moPresetDash, aLineProps.maCustomDash, moDashStyle ); aLineProps.moLineCompound = lclGetDmlLineCompound( moLineStyle ); aLineProps.moLineCap = lclGetDmlLineCap( moEndCap ); diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx new file mode 100755 index 000000000000..c7a901ead30a --- /dev/null +++ b/oox/source/xls/drawingbase.cxx @@ -0,0 +1,327 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "oox/xls/drawingbase.hxx" + +#include +#include "oox/core/namespaces.hxx" +#include "oox/helper/attributelist.hxx" +#include "oox/helper/binaryinputstream.hxx" +#include "oox/xls/unitconverter.hxx" + +namespace oox { +namespace xls { + +// ============================================================================ + +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::table; +using namespace ::oox::drawingml; + +using ::rtl::OUString; + +// ============================================================================ + +namespace { + +/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */ +inline sal_Int64 lclHmmToEmu( sal_Int32 nValue ) +{ + return (nValue < 0) ? -1 : convertHmmToEmu( nValue ); +} + +/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */ +inline sal_Int32 lclEmuToHmm( sal_Int64 nValue ) +{ + return (nValue < 0) ? -1 : convertEmuToHmm( nValue ); +} + +/** Reads the cell anchor model from a BIFF or DFF stream. */ +BinaryInputStream& operator>>( BinaryInputStream& rStrm, CellAnchorModel& rModel ) +{ + // all members are given as 16-bit unsigned values + rModel.mnCol = rStrm.readuInt16(); + rModel.mnColOffset = rStrm.readuInt16(); + rModel.mnRow = rStrm.readuInt16(); + rModel.mnRowOffset = rStrm.readuInt16(); + return rStrm; +} + +} // namespace + +// ============================================================================ + +CellAnchorModel::CellAnchorModel() : + mnCol( -1 ), + mnRow( -1 ), + mnColOffset( 0 ), + mnRowOffset( 0 ) +{ +} + +// ---------------------------------------------------------------------------- + +AnchorClientDataModel::AnchorClientDataModel() : + mbLocksWithSheet( true ), + mbPrintsWithSheet( true ) +{ +} + +// ============================================================================ + +ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) : + WorksheetHelper( rHelper ), + meAnchorType( ANCHOR_INVALID ), + meCellAnchorType( CELLANCHOR_EMU ), + mnEditAs( XML_twoCell ) +{ +} + +void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + switch( nElement ) + { + case XDR_TOKEN( absoluteAnchor ): + meAnchorType = ANCHOR_ABSOLUTE; + break; + case XDR_TOKEN( oneCellAnchor ): + meAnchorType = ANCHOR_ONECELL; + break; + case XDR_TOKEN( twoCellAnchor ): + meAnchorType = ANCHOR_TWOCELL; + mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell ); + break; + default: + OSL_ENSURE( false, "ShapeAnchor::importAnchor - unexpected element" ); + } + meCellAnchorType = CELLANCHOR_EMU; +} + +void ShapeAnchor::importPos( const AttributeList& rAttribs ) +{ + OSL_ENSURE( meAnchorType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" ); + maPos.X = rAttribs.getHyper( XML_x, 0 ); + maPos.Y = rAttribs.getHyper( XML_y, 0 ); +} + +void ShapeAnchor::importExt( const AttributeList& rAttribs ) +{ + OSL_ENSURE( (meAnchorType == ANCHOR_ABSOLUTE) || (meAnchorType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" ); + maSize.Width = rAttribs.getHyper( XML_cx, 0 ); + maSize.Height = rAttribs.getHyper( XML_cy, 0 ); +} + +void ShapeAnchor::importClientData( const AttributeList& rAttribs ) +{ + maClientData.mbLocksWithSheet = rAttribs.getBool( XML_fLocksWithSheet, true ); + maClientData.mbPrintsWithSheet = rAttribs.getBool( XML_fPrintsWithSheet, true ); +} + +void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) +{ + CellAnchorModel* pCellAnchor = 0; + switch( nParentContext ) + { + case XDR_TOKEN( from ): + OSL_ENSURE( (meAnchorType == ANCHOR_ONECELL) || (meAnchorType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" ); + pCellAnchor = &maFrom; + break; + case XDR_TOKEN( to ): + OSL_ENSURE( meAnchorType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" ); + pCellAnchor = &maTo; + break; + default: + OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected parent element" ); + } + if( pCellAnchor ) switch( nElement ) + { + case XDR_TOKEN( col ): pCellAnchor->mnCol = rValue.toInt32(); break; + case XDR_TOKEN( row ): pCellAnchor->mnRow = rValue.toInt32(); break; + case XDR_TOKEN( colOff ): pCellAnchor->mnColOffset = rValue.toInt64(); break; + case XDR_TOKEN( rowOff ): pCellAnchor->mnRowOffset = rValue.toInt64(); break; + default: OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected element" ); + } +} + +void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) +{ + meAnchorType = ANCHOR_TWOCELL; /// VML uses two-cell anchors only + meCellAnchorType = CELLANCHOR_PIXEL; /// VML uses screen pixels for offset values + + ::std::vector< OUString > aTokens; + sal_Int32 nIndex = 0; + while( nIndex >= 0 ) + aTokens.push_back( rAnchor.getToken( 0, ',', nIndex ).trim() ); + + OSL_ENSURE( aTokens.size() >= 8, "ShapeAnchor::importVmlAnchor - missing anchor tokens" ); + if( aTokens.size() >= 8 ) + { + maFrom.mnCol = aTokens[ 0 ].toInt32(); + maFrom.mnColOffset = aTokens[ 1 ].toInt32(); + maFrom.mnRow = aTokens[ 2 ].toInt32(); + maFrom.mnRowOffset = aTokens[ 3 ].toInt32(); + maTo.mnCol = aTokens[ 4 ].toInt32(); + maTo.mnColOffset = aTokens[ 5 ].toInt32(); + maTo.mnRow = aTokens[ 6 ].toInt32(); + maTo.mnRowOffset = aTokens[ 7 ].toInt32(); + } +} + +void ShapeAnchor::importBiffAnchor( BinaryInputStream& rStrm ) +{ + meAnchorType = ANCHOR_TWOCELL; /// BIFF/DFF use two-cell anchors only + meCellAnchorType = CELLANCHOR_COLROW; /// BIFF/DFF use fraction of column/row for offset values + rStrm >> maFrom >> maTo; +} + +EmuRectangle ShapeAnchor::calcAnchorRectEmu( const Size& rPageSizeHmm ) const +{ + AddressConverter& rAddrConv = getAddressConverter(); + const UnitConverter& rUnitConv = getUnitConverter(); + + EmuSize aPageSize( lclHmmToEmu( rPageSizeHmm.Width ), lclHmmToEmu( rPageSizeHmm.Height ) ); + EmuRectangle aAnchorRect( -1, -1, -1, -1 ); + + // calculate shape position + switch( meAnchorType ) + { + case ANCHOR_ABSOLUTE: + OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" ); + if( maPos.isValid() && (maPos.X < aPageSize.Width) && (maPos.Y < aPageSize.Height) ) + aAnchorRect.setPos( maPos ); + break; + case ANCHOR_ONECELL: + case ANCHOR_TWOCELL: + OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" ); + if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) ) + { + EmuPoint aPoint = calcCellAnchorEmu( maFrom ); + if( (aPoint.X < aPageSize.Width) && (aPoint.Y < aPageSize.Height) ) + aAnchorRect.setPos( aPoint ); + } + break; + case ANCHOR_INVALID: + OSL_ENSURE( false, "ShapeAnchor::calcAnchorRectEmu - invalid anchor" ); + break; + } + + // calculate shape size + if( (aAnchorRect.X >= 0) && (aAnchorRect.Y >= 0) ) switch( meAnchorType ) + { + case ANCHOR_ABSOLUTE: + case ANCHOR_ONECELL: + OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid size" ); + if( maSize.isValid() ) + { + aAnchorRect.Width = ::std::min< sal_Int64 >( maSize.Width, aPageSize.Width - aAnchorRect.X ); + aAnchorRect.Height = ::std::min< sal_Int64 >( maSize.Height, aPageSize.Height - aAnchorRect.Y ); + } + break; + case ANCHOR_TWOCELL: + OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcAnchorRectEmu - invalid position" ); + if( maTo.isValid() ) + { + /* Pass a valid cell address to calcCellAnchorEmu(), otherwise + nothing useful is returned, even if either row or column is valid. */ + CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true ); + CellAnchorModel aValidTo = maTo; + aValidTo.mnCol = aToCell.Column; + aValidTo.mnRow = aToCell.Row; + EmuPoint aPoint = calcCellAnchorEmu( aValidTo ); + // width (if column index is valid, use the calculated offset, otherwise stretch to maximum available X position) + aAnchorRect.Width = aPageSize.Width - aAnchorRect.X; + if( aToCell.Column == maTo.mnCol ) + aAnchorRect.Width = ::std::min< sal_Int64 >( aPoint.X - aAnchorRect.X + 1, aAnchorRect.Width ); + // height (if row index is valid, use the calculated offset, otherwise stretch to maximum available Y position) + aAnchorRect.Height = aPageSize.Height - aAnchorRect.Y; + if( aToCell.Row == maTo.mnRow ) + aAnchorRect.Height = ::std::min< sal_Int64 >( aPoint.Y - aAnchorRect.Y + 1, aAnchorRect.Height ); + } + break; + case ANCHOR_INVALID: + break; + } + + // add 0.75 mm (27,000 EMUs) in X direction to correct display error + if( aAnchorRect.X >= 0 ) + aAnchorRect.X += 27000; + // remove 0.25 mm (9,000 EMUs) in Y direction to correct display error + if( aAnchorRect.Y >= 9000 ) + aAnchorRect.Y -= 9000; + + return aAnchorRect; +} + +Rectangle ShapeAnchor::calcAnchorRectHmm( const Size& rPageSizeHmm ) const +{ + EmuRectangle aAnchorRect = calcAnchorRectEmu( rPageSizeHmm ); + return Rectangle( lclEmuToHmm( aAnchorRect.X ), lclEmuToHmm( aAnchorRect.Y ), lclEmuToHmm( aAnchorRect.Width ), lclEmuToHmm( aAnchorRect.Height ) ); +} + +// private -------------------------------------------------------------------- + +EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const +{ + // calculate position of top-left edge of the cell + Point aPoint = getCellPosition( rModel.mnCol, rModel.mnRow ); + EmuPoint aEmuPoint( lclHmmToEmu( aPoint.X ), lclHmmToEmu( aPoint.Y ) ); + + // add the offset inside the cell + switch( meCellAnchorType ) + { + case CELLANCHOR_EMU: + aEmuPoint.X += rModel.mnColOffset; + aEmuPoint.Y += rModel.mnRowOffset; + break; + + case CELLANCHOR_PIXEL: + { + const UnitConverter& rUnitConv = getUnitConverter(); + aEmuPoint.X += static_cast< sal_Int64 >( rUnitConv.scaleValue( static_cast< double >( rModel.mnColOffset ), UNIT_SCREENX, UNIT_EMU ) ); + aEmuPoint.Y += static_cast< sal_Int64 >( rUnitConv.scaleValue( static_cast< double >( rModel.mnRowOffset ), UNIT_SCREENY, UNIT_EMU ) ); + } + break; + + case CELLANCHOR_COLROW: + { + Size aCellSize = getCellSize( rModel.mnCol, rModel.mnRow ); + EmuSize aEmuSize( lclHmmToEmu( aCellSize.Width ), lclHmmToEmu( aCellSize.Height ) ); + // X offset is given in 1/1024 of column width + aEmuPoint.X += static_cast< sal_Int64 >( aEmuSize.Width * getLimitedValue< double >( static_cast< double >( rModel.mnColOffset ) / 1024.0, 0.0, 1.0 ) + 0.5 ); + // Y offset is given in 1/256 of row height + aEmuPoint.Y += static_cast< sal_Int64 >( aEmuSize.Height * getLimitedValue< double >( static_cast< double >( rModel.mnRowOffset ) / 256.0, 0.0, 1.0 ) + 0.5 ); + } + break; + } + + return aEmuPoint; +} + +// ============================================================================ + +} // namespace xls +} // namespace oox diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 172530692923..45e311aea4a2 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -67,6 +67,9 @@ using ::com::sun::star::table::CellAddress; using ::com::sun::star::table::CellRangeAddress; using ::oox::core::ContextHandlerRef; using ::oox::drawingml::ConnectorShapeContext; +using ::oox::drawingml::EmuPoint; +using ::oox::drawingml::EmuRectangle; +using ::oox::drawingml::EmuSize; using ::oox::drawingml::GraphicalObjectFrameContext; using ::oox::drawingml::GraphicShapeContext; using ::oox::drawingml::Shape; @@ -80,352 +83,11 @@ namespace xls { // ============================================================================ -namespace { - -/** Converts the passed 64-bit integer value from the passed unit to EMUs. */ -sal_Int64 lclCalcEmu( const UnitConverter& rUnitConv, sal_Int64 nValue, Unit eFromUnit ) -{ - return (eFromUnit == UNIT_EMU) ? nValue : - static_cast< sal_Int64 >( rUnitConv.scaleValue( static_cast< double >( nValue ), eFromUnit, UNIT_EMU ) + 0.5 ); -} - -} // namespace - -// ============================================================================ - -AnchorCellModel::AnchorCellModel() : - mnCol( -1 ), - mnRow( -1 ), - mnColOffset( 0 ), - mnRowOffset( 0 ) -{ -} - -// ---------------------------------------------------------------------------- - -AnchorClientDataModel::AnchorClientDataModel() : - mbLocksWithSheet( true ), - mbPrintsWithSheet( true ) -{ -} - -// ============================================================================ - -ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) : - WorksheetHelper( rHelper ), - meType( ANCHOR_INVALID ), - mnEditAs( XML_twoCell ) -{ -} - -void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ) -{ - switch( nElement ) - { - case XDR_TOKEN( absoluteAnchor ): - meType = ANCHOR_ABSOLUTE; - break; - case XDR_TOKEN( oneCellAnchor ): - meType = ANCHOR_ONECELL; - break; - case XDR_TOKEN( twoCellAnchor ): - meType = ANCHOR_TWOCELL; - mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell ); - break; - default: - OSL_ENSURE( false, "ShapeAnchor::importAnchor - unexpected element" ); - } -} - -void ShapeAnchor::importPos( const AttributeList& rAttribs ) -{ - OSL_ENSURE( meType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" ); - maPos.X = rAttribs.getHyper( XML_x, 0 ); - maPos.Y = rAttribs.getHyper( XML_y, 0 ); -} - -void ShapeAnchor::importExt( const AttributeList& rAttribs ) -{ - OSL_ENSURE( (meType == ANCHOR_ABSOLUTE) || (meType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" ); - maSize.Width = rAttribs.getHyper( XML_cx, 0 ); - maSize.Height = rAttribs.getHyper( XML_cy, 0 ); -} - -void ShapeAnchor::importClientData( const AttributeList& rAttribs ) -{ - maClientData.mbLocksWithSheet = rAttribs.getBool( XML_fLocksWithSheet, true ); - maClientData.mbPrintsWithSheet = rAttribs.getBool( XML_fPrintsWithSheet, true ); -} - -void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) -{ - AnchorCellModel* pAnchorCell = 0; - switch( nParentContext ) - { - case XDR_TOKEN( from ): - OSL_ENSURE( (meType == ANCHOR_ONECELL) || (meType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" ); - pAnchorCell = &maFrom; - break; - case XDR_TOKEN( to ): - OSL_ENSURE( meType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" ); - pAnchorCell = &maTo; - break; - default: - OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected parent element" ); - } - if( pAnchorCell ) switch( nElement ) - { - case XDR_TOKEN( col ): pAnchorCell->mnCol = rValue.toInt32(); break; - case XDR_TOKEN( row ): pAnchorCell->mnRow = rValue.toInt32(); break; - case XDR_TOKEN( colOff ): pAnchorCell->mnColOffset = rValue.toInt64(); break; - case XDR_TOKEN( rowOff ): pAnchorCell->mnRowOffset = rValue.toInt64(); break; - default: OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected element" ); - } -} - -void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) -{ - meType = ANCHOR_VML; - - ::std::vector< OUString > aTokens; - sal_Int32 nIndex = 0; - while( nIndex >= 0 ) - aTokens.push_back( rAnchor.getToken( 0, ',', nIndex ).trim() ); - - OSL_ENSURE( aTokens.size() >= 8, "ShapeAnchor::importVmlAnchor - missing anchor tokens" ); - if( aTokens.size() >= 8 ) - { - maFrom.mnCol = aTokens[ 0 ].toInt32(); - maFrom.mnColOffset = aTokens[ 1 ].toInt32(); - maFrom.mnRow = aTokens[ 2 ].toInt32(); - maFrom.mnRowOffset = aTokens[ 3 ].toInt32(); - maTo.mnCol = aTokens[ 4 ].toInt32(); - maTo.mnColOffset = aTokens[ 5 ].toInt32(); - maTo.mnRow = aTokens[ 6 ].toInt32(); - maTo.mnRowOffset = aTokens[ 7 ].toInt32(); - } -} - -bool ShapeAnchor::isValidAnchor() const -{ - bool bValid = false; - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::isValidAnchor - invalid position" ); - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maPos.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); - break; - case ANCHOR_ONECELL: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maFrom.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::isValidAnchor - invalid to position" ); - bValid = maFrom.isValid() && maTo.isValid() && - ((maFrom.mnCol < maTo.mnCol) || ((maFrom.mnCol == maTo.mnCol) && (maFrom.mnColOffset < maTo.mnColOffset))) && - ((maFrom.mnRow < maTo.mnRow) || ((maFrom.mnRow == maTo.mnRow) && (maFrom.mnRowOffset < maTo.mnRowOffset))); - break; - case ANCHOR_INVALID: - OSL_ENSURE( false, "ShapeAnchor::isValidAnchor - invalid anchor" ); - break; - } - return bValid; -} - -Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const AnchorSizeModel& rEmuSheetSize ) const -{ - AddressConverter& rAddrConv = getAddressConverter(); - UnitConverter& rUnitConv = getUnitConverter(); - Rectangle aApiLoc( -1, -1, -1, -1 ); - Unit eUnitX = (meType == ANCHOR_VML) ? UNIT_SCREENX : UNIT_EMU; - Unit eUnitY = (meType == ANCHOR_VML) ? UNIT_SCREENY : UNIT_EMU; - - // calculate shape position - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maPos.isValid() && (maPos.X < rEmuSheetSize.Width) && (maPos.Y < rEmuSheetSize.Height) ) - { - aApiLoc.X = rUnitConv.scaleToMm100( static_cast< double >( maPos.X ), UNIT_EMU ); - aApiLoc.Y = rUnitConv.scaleToMm100( static_cast< double >( maPos.Y ), UNIT_EMU ); - } - break; - case ANCHOR_ONECELL: - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) ) - { - Point aPoint = getCellPosition( maFrom.mnCol, maFrom.mnRow ); - aApiLoc.X = aPoint.X + rUnitConv.scaleToMm100( static_cast< double >( maFrom.mnColOffset ), eUnitX ); - aApiLoc.Y = aPoint.Y + rUnitConv.scaleToMm100( static_cast< double >( maFrom.mnRowOffset ), eUnitY ); - } - break; - case ANCHOR_INVALID: - OSL_ENSURE( false, "ShapeAnchor::calcApiLocation - invalid anchor" ); - break; - } - - // calculate shape size - if( (aApiLoc.X >= 0) && (aApiLoc.Y >= 0) ) switch( meType ) - { - case ANCHOR_ABSOLUTE: - case ANCHOR_ONECELL: - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcApiLocation - invalid size" ); - if( maSize.isValid() ) - { - aApiLoc.Width = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.Width ), UNIT_EMU ), - rApiSheetSize.Width - aApiLoc.X ); - aApiLoc.Height = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.Height ), UNIT_EMU ), - rApiSheetSize.Height - aApiLoc.Y ); - } - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maTo.isValid() ) - { - /* Pass a valid cell address to getCellPosition(), otherwise - nothing is returned, even if either row or column is valid. */ - CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true ); - Point aPoint = getCellPosition( aToCell.Column, aToCell.Row ); - // width - aApiLoc.Width = rApiSheetSize.Width - aApiLoc.X; - if( aToCell.Column == maTo.mnCol ) - { - aPoint.X += rUnitConv.scaleToMm100( static_cast< double >( maTo.mnColOffset ), eUnitX ); - aApiLoc.Width = ::std::min< sal_Int32 >( aPoint.X - aApiLoc.X + 1, aApiLoc.Width ); - } - // height - aApiLoc.Height = rApiSheetSize.Height - aApiLoc.Y; - if( aToCell.Row == maTo.mnRow ) - { - aPoint.Y += rUnitConv.scaleToMm100( static_cast< double >( maTo.mnRowOffset ), eUnitY ); - aApiLoc.Height = ::std::min< sal_Int32 >( aPoint.Y - aApiLoc.Y + 1, aApiLoc.Height ); - } - } - break; - case ANCHOR_INVALID: - break; - } - - return aApiLoc; -} - -Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const -{ - AddressConverter& rAddrConv = getAddressConverter(); - UnitConverter& rUnitConv = getUnitConverter(); - - Size aSheetSize( - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Width, 0, SAL_MAX_INT32 ), - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Height, 0, SAL_MAX_INT32 ) ); - Rectangle aLoc( -1, -1, -1, -1 ); - Unit eUnitX = (meType == ANCHOR_VML) ? UNIT_SCREENX : UNIT_EMU; - Unit eUnitY = (meType == ANCHOR_VML) ? UNIT_SCREENY : UNIT_EMU; - - // calculate shape position - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maPos.isValid() && (maPos.X < aSheetSize.Width) && (maPos.Y < aSheetSize.Height) ) - { - aLoc.X = static_cast< sal_Int32 >( maPos.X ); - aLoc.Y = static_cast< sal_Int32 >( maPos.Y ); - } - break; - case ANCHOR_ONECELL: - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) ) - { - Point aPoint = getCellPosition( maFrom.mnCol, maFrom.mnRow ); - sal_Int64 nX = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.X, UNIT_EMU ) ) + lclCalcEmu( rUnitConv, maFrom.mnColOffset, eUnitX ); - sal_Int64 nY = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.Y, UNIT_EMU ) ) + lclCalcEmu( rUnitConv, maFrom.mnRowOffset, eUnitY ); - if( (nX < aSheetSize.Width) && (nY < aSheetSize.Height) ) - { - aLoc.X = static_cast< sal_Int32 >( nX ); - aLoc.Y = static_cast< sal_Int32 >( nY ); - } - } - break; - case ANCHOR_INVALID: - OSL_ENSURE( false, "ShapeAnchor::calcEmuLocation - invalid anchor" ); - break; - } - - // calculate shape size - if( (aLoc.X >= 0) && (aLoc.Y >= 0) ) switch( meType ) - { - case ANCHOR_ABSOLUTE: - case ANCHOR_ONECELL: - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcEmuLocation - invalid size" ); - if( maSize.isValid() ) - { - aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Width, aSheetSize.Width - aLoc.X ) ); - aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Height, aSheetSize.Height - aLoc.Y ) ); - } - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maTo.isValid() ) - { - /* Pass a valid cell address to getCellPosition(), otherwise - nothing is returned, even if either row or column is valid. */ - CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true ); - Point aPoint = getCellPosition( aToCell.Column, aToCell.Row ); - sal_Int64 nX = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.X, UNIT_EMU ) ); - sal_Int64 nY = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.Y, UNIT_EMU ) ); - // width - aLoc.Width = aSheetSize.Width - aLoc.X; - if( aToCell.Column == maTo.mnCol ) - { - nX += lclCalcEmu( rUnitConv, maTo.mnColOffset, eUnitX ); - aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( nX - aLoc.X + 1, aLoc.Width ) ); - } - // height - aLoc.Height = aSheetSize.Height - aLoc.Y; - if( aToCell.Row == maTo.mnRow ) - { - nY += lclCalcEmu( rUnitConv, maTo.mnRowOffset, eUnitY ); - aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( nY - aLoc.Y + 1, aLoc.Height ) ); - } - } - break; - case ANCHOR_INVALID: - break; - } - - // add 0.75 mm (27,000 EMUs) in X direction to correct display error - if( aLoc.X >= 0 ) - aLoc.X += 27000; - // remove 0.25 mm (9,000 EMUs) in Y direction to correct display error - if( aLoc.Y >= 9000 ) - aLoc.Y -= 9000; - - return aLoc; -} - -// ============================================================================ - OoxDrawingFragment::OoxDrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : OoxWorksheetFragmentBase( rHelper, rFragmentPath ), mxDrawPage( rHelper.getDrawPage(), UNO_QUERY ) { OSL_ENSURE( mxDrawPage.is(), "OoxDrawingFragment::OoxDrawingFragment - missing drawing page" ); - maApiSheetSize = getDrawPageSize(); - maEmuSheetSize.Width = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Width, UNIT_EMU ) ); - maEmuSheetSize.Height = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Height, UNIT_EMU ) ); } // oox.core.ContextHandler2Helper interface ----------------------------------- @@ -507,14 +169,20 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars ) case XDR_TOKEN( absoluteAnchor ): case XDR_TOKEN( oneCellAnchor ): case XDR_TOKEN( twoCellAnchor ): - if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() && mxAnchor->isValidAnchor() ) + if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() ) { - Rectangle aShapeRect = mxAnchor->calcEmuLocation( maEmuSheetSize ); - if( (aShapeRect.X >= 0) && (aShapeRect.Y >= 0) && (aShapeRect.Width >= 0) && (aShapeRect.Height >= 0) ) + EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( getDrawPageSize() ); + if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && (aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) ) { - mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aShapeRect ); + // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle) + Rectangle aShapeRectEmu32( + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), + getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); + mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aShapeRectEmu32 ); // collect all shape positions in the WorksheetHelper base class - extendShapeBoundingBox( aShapeRect ); + extendShapeBoundingBox( aShapeRectEmu32 ); } } mxShape.reset(); @@ -577,7 +245,7 @@ bool VmlDrawing::convertShapeClientAnchor( Rectangle& orShapeRect, const OUStrin return false; ShapeAnchor aAnchor( *this ); aAnchor.importVmlAnchor( rShapeAnchor ); - orShapeRect = aAnchor.calcApiLocation( getDrawPageSize(), AnchorSizeModel() ); + orShapeRect = aAnchor.calcAnchorRectHmm( getDrawPageSize() ); return (orShapeRect.Width >= 0) && (orShapeRect.Height >= 0); } diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx new file mode 100755 index 000000000000..16e5ceddd27d --- /dev/null +++ b/oox/source/xls/drawingmanager.cxx @@ -0,0 +1,979 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "oox/xls/drawingmanager.hxx" + +#include +#include +#include "oox/xls/biffinputstream.hxx" +#include "oox/xls/unitconverter.hxx" + +namespace oox { +namespace xls { + +// ============================================================================ + +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::oox::drawingml; + +using ::rtl::OUString; + +// ============================================================================ + +namespace { + +// OBJ record ----------------------------------------------------------------- + +const sal_uInt16 BIFF_OBJ_INVALID_ID = 0; + +const sal_uInt16 BIFF_OBJTYPE_GROUP = 0; +const sal_uInt16 BIFF_OBJTYPE_LINE = 1; +const sal_uInt16 BIFF_OBJTYPE_RECTANGLE = 2; +const sal_uInt16 BIFF_OBJTYPE_OVAL = 3; +const sal_uInt16 BIFF_OBJTYPE_ARC = 4; +const sal_uInt16 BIFF_OBJTYPE_CHART = 5; +const sal_uInt16 BIFF_OBJTYPE_TEXT = 6; +const sal_uInt16 BIFF_OBJTYPE_BUTTON = 7; +const sal_uInt16 BIFF_OBJTYPE_PICTURE = 8; +const sal_uInt16 BIFF_OBJTYPE_POLYGON = 9; // new in BIFF4 +const sal_uInt16 BIFF_OBJTYPE_CHECKBOX = 11; // new in BIFF5 +const sal_uInt16 BIFF_OBJTYPE_OPTIONBUTTON = 12; +const sal_uInt16 BIFF_OBJTYPE_EDIT = 13; +const sal_uInt16 BIFF_OBJTYPE_LABEL = 14; +const sal_uInt16 BIFF_OBJTYPE_DIALOG = 15; +const sal_uInt16 BIFF_OBJTYPE_SPIN = 16; +const sal_uInt16 BIFF_OBJTYPE_SCROLLBAR = 17; +const sal_uInt16 BIFF_OBJTYPE_LISTBOX = 18; +const sal_uInt16 BIFF_OBJTYPE_GROUPBOX = 19; +const sal_uInt16 BIFF_OBJTYPE_DROPDOWN = 20; +const sal_uInt16 BIFF_OBJTYPE_NOTE = 25; // new in BIFF8 +const sal_uInt16 BIFF_OBJTYPE_DRAWING = 30; +const sal_uInt16 BIFF_OBJTYPE_UNKNOWN = 0xFFFF; // for internal use only + +const sal_uInt16 BIFF_OBJ_HIDDEN = 0x0100; +const sal_uInt16 BIFF_OBJ_VISIBLE = 0x0200; +const sal_uInt16 BIFF_OBJ_PRINTABLE = 0x0400; + +// line formatting ------------------------------------------------------------ + +const sal_uInt8 BIFF_OBJ_LINE_AUTOCOLOR = 64; + +const sal_uInt8 BIFF_OBJ_LINE_SOLID = 0; +const sal_uInt8 BIFF_OBJ_LINE_DASH = 1; +const sal_uInt8 BIFF_OBJ_LINE_DOT = 2; +const sal_uInt8 BIFF_OBJ_LINE_DASHDOT = 3; +const sal_uInt8 BIFF_OBJ_LINE_DASHDOTDOT = 4; +const sal_uInt8 BIFF_OBJ_LINE_MEDTRANS = 5; +const sal_uInt8 BIFF_OBJ_LINE_DARKTRANS = 6; +const sal_uInt8 BIFF_OBJ_LINE_LIGHTTRANS = 7; +const sal_uInt8 BIFF_OBJ_LINE_NONE = 255; + +const sal_uInt8 BIFF_OBJ_LINE_HAIR = 0; +const sal_uInt8 BIFF_OBJ_LINE_THIN = 1; +const sal_uInt8 BIFF_OBJ_LINE_MEDIUM = 2; +const sal_uInt8 BIFF_OBJ_LINE_THICK = 3; + +const sal_uInt8 BIFF_OBJ_LINE_AUTO = 0x01; + +const sal_uInt8 BIFF_OBJ_ARROW_NONE = 0; +const sal_uInt8 BIFF_OBJ_ARROW_OPEN = 1; +const sal_uInt8 BIFF_OBJ_ARROW_FILLED = 2; +const sal_uInt8 BIFF_OBJ_ARROW_OPENBOTH = 3; +const sal_uInt8 BIFF_OBJ_ARROW_FILLEDBOTH = 4; + +const sal_uInt8 BIFF_OBJ_ARROW_NARROW = 0; +const sal_uInt8 BIFF_OBJ_ARROW_MEDIUM = 1; +const sal_uInt8 BIFF_OBJ_ARROW_WIDE = 2; + +const sal_uInt8 BIFF_OBJ_LINE_TL = 0; +const sal_uInt8 BIFF_OBJ_LINE_TR = 1; +const sal_uInt8 BIFF_OBJ_LINE_BR = 2; +const sal_uInt8 BIFF_OBJ_LINE_BL = 3; + +// fill formatting ------------------------------------------------------------ + +const sal_uInt8 BIFF_OBJ_FILL_AUTOCOLOR = 65; + +const sal_uInt8 BIFF_OBJ_PATT_NONE = 0; +const sal_uInt8 BIFF_OBJ_PATT_SOLID = 1; + +const sal_uInt8 BIFF_OBJ_FILL_AUTO = 0x01; + +// text formatting ------------------------------------------------------------ + +const sal_uInt8 BIFF_OBJ_HOR_LEFT = 1; +const sal_uInt8 BIFF_OBJ_HOR_CENTER = 2; +const sal_uInt8 BIFF_OBJ_HOR_RIGHT = 3; +const sal_uInt8 BIFF_OBJ_HOR_JUSTIFY = 4; + +const sal_uInt8 BIFF_OBJ_VER_TOP = 1; +const sal_uInt8 BIFF_OBJ_VER_CENTER = 2; +const sal_uInt8 BIFF_OBJ_VER_BOTTOM = 3; +const sal_uInt8 BIFF_OBJ_VER_JUSTIFY = 4; + +const sal_uInt16 BIFF_OBJ_ORIENT_NONE = 0; +const sal_uInt16 BIFF_OBJ_ORIENT_STACKED = 1; /// Stacked top to bottom. +const sal_uInt16 BIFF_OBJ_ORIENT_90CCW = 2; /// 90 degr. counterclockwise. +const sal_uInt16 BIFF_OBJ_ORIENT_90CW = 3; /// 90 degr. clockwise. + +const sal_uInt16 BIFF_OBJ_TEXT_AUTOSIZE = 0x0080; +const sal_uInt16 BIFF_OBJ_TEXT_LOCKED = 0x0200; + +const sal_Int32 BIFF_OBJ_TEXT_MARGIN = 20000; /// Automatic text margin (EMUs). + +// BIFF8 OBJ sub records ------------------------------------------------------ + +const sal_uInt16 BIFF_OBJCMO_PRINTABLE = 0x0010; /// Object printable. +const sal_uInt16 BIFF_OBJCMO_AUTOLINE = 0x2000; /// Automatic line formatting. +const sal_uInt16 BIFF_OBJCMO_AUTOFILL = 0x4000; /// Automatic fill formatting. + +// ---------------------------------------------------------------------------- + +inline BiffInputStream& operator>>( BiffInputStream& rStrm, ShapeAnchor& rAnchor ) +{ + rAnchor.importBiffAnchor( rStrm ); + return rStrm; +} + +} // namespace + +// ============================================================================ +// Model structures for BIFF OBJ record data +// ============================================================================ + +BiffObjLineModel::BiffObjLineModel() : + mnColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ), + mnStyle( BIFF_OBJ_LINE_SOLID ), + mnWidth( BIFF_OBJ_LINE_HAIR ), + mnAuto( BIFF_OBJ_LINE_AUTO ) +{ +} + +bool BiffObjLineModel::isAuto() const +{ + return getFlag( mnAuto, BIFF_OBJ_LINE_AUTO ); +} + +bool BiffObjLineModel::isVisible() const +{ + return isAuto() || (mnStyle != BIFF_OBJ_LINE_NONE); +} + +BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjLineModel& rModel ) +{ + return rStrm >> rModel.mnColorIdx >> rModel.mnStyle >> rModel.mnWidth >> rModel.mnAuto; +} + +// ============================================================================ + +BiffObjFillModel::BiffObjFillModel() : + mnBackColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ), + mnPattColorIdx( BIFF_OBJ_FILL_AUTOCOLOR ), + mnPattern( BIFF_OBJ_PATT_SOLID ), + mnAuto( BIFF_OBJ_FILL_AUTO ) +{ +} + +bool BiffObjFillModel::isAuto() const +{ + return getFlag( mnAuto, BIFF_OBJ_FILL_AUTO ); +} + +bool BiffObjFillModel::isFilled() const +{ + return isAuto() || (mnPattern != BIFF_OBJ_PATT_NONE); +} + +BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjFillModel& rModel ) +{ + return rStrm >> rModel.mnBackColorIdx >> rModel.mnPattColorIdx >> rModel.mnPattern >> rModel.mnAuto; +} + +// ============================================================================ + +BiffObjTextModel::BiffObjTextModel() : + mnTextLen( 0 ), + mnFormatSize( 0 ), + mnLinkSize( 0 ), + mnDefFontId( 0 ), + mnFlags( 0 ), + mnOrientation( BIFF_OBJ_ORIENT_NONE ), + mnButtonFlags( 0 ), + mnShortcut( 0 ), + mnShortcutEA( 0 ) +{ +} + +void BiffObjTextModel::readObj3( BiffInputStream& rStrm ) +{ + rStrm >> mnTextLen; + rStrm.skip( 2 ); + rStrm >> mnFormatSize >> mnDefFontId; + rStrm.skip( 2 ); + rStrm >> mnFlags >> mnOrientation; + rStrm.skip( 8 ); +} + +void BiffObjTextModel::readObj5( BiffInputStream& rStrm ) +{ + rStrm >> mnTextLen; + rStrm.skip( 2 ); + rStrm >> mnFormatSize >> mnDefFontId; + rStrm.skip( 2 ); + rStrm >> mnFlags >> mnOrientation; + rStrm.skip( 2 ); + rStrm >> mnLinkSize; + rStrm.skip( 2 ); + rStrm >> mnButtonFlags >> mnShortcut >> mnShortcutEA; +} + +void BiffObjTextModel::readTxo8( BiffInputStream& rStrm ) +{ + rStrm >> mnFlags >> mnOrientation >> mnButtonFlags >> mnShortcut >> mnShortcutEA >> mnTextLen >> mnFormatSize; +} + +sal_uInt8 BiffObjTextModel::getHorAlign() const +{ + return extractValue< sal_uInt8 >( mnFlags, 1, 3 ); +} + +sal_uInt8 BiffObjTextModel::getVerAlign() const +{ + return extractValue< sal_uInt8 >( mnFlags, 4, 3 ); +} + +// ============================================================================ +// BIFF drawing objects +// ============================================================================ + +BiffDrawingObjectContainer::BiffDrawingObjectContainer() +{ +} + +void BiffDrawingObjectContainer::append( const BiffDrawingObjectRef& rxDrawingObj ) +{ + maObjects.push_back( rxDrawingObj ); +} + +void BiffDrawingObjectContainer::insertGrouped( const BiffDrawingObjectRef& rxDrawingObj ) +{ + if( !maObjects.empty() ) + if( BiffGroupObject* pGroupObj = dynamic_cast< BiffGroupObject* >( maObjects.back().get() ) ) + if( pGroupObj->tryInsert( rxDrawingObj ) ) + return; + maObjects.push_back( rxDrawingObj ); +} + +void BiffDrawingObjectContainer::convertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle* pParentRect ) const +{ + maObjects.forEachMem( &BiffDrawingObjectBase::convertAndInsert, ::boost::ref( rDrawing ), ::boost::cref( rxShapes ), pParentRect ); +} + +// ============================================================================ + +BiffDrawingObjectBase::BiffDrawingObjectBase( const WorksheetHelper& rHelper ) : + WorksheetHelper( rHelper ), + maAnchor( rHelper ), + mnObjId( BIFF_OBJ_INVALID_ID ), + mnObjType( BIFF_OBJTYPE_UNKNOWN ), + mnDffShapeId( 0 ), + mnDffFlags( 0 ), + mbHasAnchor( false ), + mbHidden( false ), + mbVisible( true ), + mbPrintable( true ), + mbAreaObj( false ), + mbAutoMargin( true ), + mbSimpleMacro( true ), + mbProcessShape( true ), + mbInsertShape( true ), + mbCustomDff( false ) +{ +} + +BiffDrawingObjectBase::~BiffDrawingObjectBase() +{ +} + +/*static*/ BiffDrawingObjectRef BiffDrawingObjectBase::importObjBiff3( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) +{ + BiffDrawingObjectRef xDrawingObj; + + if( rStrm.getRemaining() >= 30 ) + { + sal_uInt16 nObjType; + rStrm.skip( 4 ); + rStrm >> nObjType; + switch( nObjType ) + { + case BIFF_OBJTYPE_GROUP: xDrawingObj.reset( new BiffGroupObject( rHelper ) ); break; + case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; + case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; + case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; +#if 0 + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; + case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; + case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; + case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; +#endif + default: + OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff3 - unknown object type" ); + xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); + } + } + + xDrawingObj->importObjBiff3( rStrm ); + return xDrawingObj; +} + +/*static*/ BiffDrawingObjectRef BiffDrawingObjectBase::importObjBiff4( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) +{ + BiffDrawingObjectRef xDrawingObj; + + if( rStrm.getRemaining() >= 30 ) + { + sal_uInt16 nObjType; + rStrm.skip( 4 ); + rStrm >> nObjType; + switch( nObjType ) + { + case BIFF_OBJTYPE_GROUP: xDrawingObj.reset( new BiffGroupObject( rHelper ) ); break; + case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; + case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; + case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; +#if 0 + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; + case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; + case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; + case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; + case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new XclImpPolygonObj( rHelper ) ); break; +#endif + default: + OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff4 - unknown object type" ); + xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); + } + } + + xDrawingObj->importObjBiff4( rStrm ); + return xDrawingObj; +} + +/*static*/ BiffDrawingObjectRef BiffDrawingObjectBase::importObjBiff5( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) +{ + BiffDrawingObjectRef xDrawingObj; + + if( rStrm.getRemaining() >= 34 ) + { + sal_uInt16 nObjType; + rStrm.skip( 4 ); + rStrm >> nObjType; + switch( nObjType ) + { + case BIFF_OBJTYPE_GROUP: xDrawingObj.reset( new BiffGroupObject( rHelper ) ); break; + case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; + case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; + case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; +#if 0 + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; + case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; + case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; + case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; + case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new XclImpPolygonObj( rHelper ) ); break; + case BIFF_OBJTYPE_CHECKBOX: xDrawingObj.reset( new XclImpCheckBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_OPTIONBUTTON: xDrawingObj.reset( new XclImpOptionButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_EDIT: xDrawingObj.reset( new XclImpEditObj( rHelper ) ); break; + case BIFF_OBJTYPE_LABEL: xDrawingObj.reset( new XclImpLabelObj( rHelper ) ); break; + case BIFF_OBJTYPE_DIALOG: xDrawingObj.reset( new XclImpDialogObj( rHelper ) ); break; + case BIFF_OBJTYPE_SPIN: xDrawingObj.reset( new XclImpSpinButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_SCROLLBAR: xDrawingObj.reset( new XclImpScrollBarObj( rHelper ) ); break; + case BIFF_OBJTYPE_LISTBOX: xDrawingObj.reset( new XclImpListBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_GROUPBOX: xDrawingObj.reset( new XclImpGroupBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_DROPDOWN: xDrawingObj.reset( new XclImpDropDownObj( rHelper ) ); break; +#endif + default: + OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff5 - unknown object type" ); + xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); + } + } + + xDrawingObj->importObjBiff5( rStrm ); + return xDrawingObj; +} + +/*static*/ BiffDrawingObjectRef BiffDrawingObjectBase::importObjBiff8( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) +{ + BiffDrawingObjectRef xDrawingObj; + + if( rStrm.getRemaining() >= 10 ) + { + sal_uInt16 nSubRecId, nSubRecSize, nObjType; + rStrm >> nSubRecId >> nSubRecSize >> nObjType; + OSL_ENSURE( nSubRecId == BIFF_ID_OBJCMO, "BiffDrawingObjectBase::importObjBiff8 - OBJCMO subrecord expected" ); + if( (nSubRecId == BIFF_ID_OBJCMO) && (nSubRecSize >= 6) ) + { + switch( nObjType ) + { +#if 0 + // in BIFF8, all simple objects support text + case BIFF_OBJTYPE_LINE: + case BIFF_OBJTYPE_ARC: + xDrawingObj.reset( new XclImpTextObj( rHelper ) ); + // lines and arcs may be 2-dimensional + xDrawingObj->SetAreaObj( false ); + break; + + // in BIFF8, all simple objects support text + case BIFF_OBJTYPE_RECTANGLE: + case BIFF_OBJTYPE_OVAL: + case BIFF_OBJTYPE_POLYGON: + case BIFF_OBJTYPE_DRAWING: + case BIFF_OBJTYPE_TEXT: + xDrawingObj.reset( new XclImpTextObj( rHelper ) ); + break; +#endif + + case BIFF_OBJTYPE_GROUP: xDrawingObj.reset( new BiffGroupObject( rHelper ) ); break; +#if 0 + case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; + case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; + case BIFF_OBJTYPE_CHECKBOX: xDrawingObj.reset( new XclImpCheckBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_OPTIONBUTTON: xDrawingObj.reset( new XclImpOptionButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_EDIT: xDrawingObj.reset( new XclImpEditObj( rHelper ) ); break; + case BIFF_OBJTYPE_LABEL: xDrawingObj.reset( new XclImpLabelObj( rHelper ) ); break; + case BIFF_OBJTYPE_DIALOG: xDrawingObj.reset( new XclImpDialogObj( rHelper ) ); break; + case BIFF_OBJTYPE_SPIN: xDrawingObj.reset( new XclImpSpinButtonObj( rHelper ) ); break; + case BIFF_OBJTYPE_SCROLLBAR: xDrawingObj.reset( new XclImpScrollBarObj( rHelper ) ); break; + case BIFF_OBJTYPE_LISTBOX: xDrawingObj.reset( new XclImpListBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_GROUPBOX: xDrawingObj.reset( new XclImpGroupBoxObj( rHelper ) ); break; + case BIFF_OBJTYPE_DROPDOWN: xDrawingObj.reset( new XclImpDropDownObj( rHelper ) ); break; + case BIFF_OBJTYPE_NOTE: xDrawingObj.reset( new XclImpNoteObj( rHelper ) ); break; +#endif + + default: + OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff8 - unknown object type" ); + xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); + } + } + } + + xDrawingObj->importObjBiff8( rStrm ); + return xDrawingObj; +} + +Reference< XShape > BiffDrawingObjectBase::convertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle* pParentRect ) const +{ + Reference< XShape > xShape; + if( rxShapes.is() && mbProcessShape && !mbHidden ) // TODO: support for hidden objects? + { + // base class 'ShapeAnchor' calculates the shape rectangle in 1/100 mm + Rectangle aShapeRect = maAnchor.calcAnchorRectHmm( getDrawPageSize() ); + + // convert the shape, if the calculated rectangle is not empty + bool bHasWidth = aShapeRect.Width > 0; + bool bHasHeight = aShapeRect.Height > 0; + if( mbAreaObj ? (bHasWidth && bHasHeight) : (bHasWidth || bHasHeight) ) + { + xShape = implConvertAndInsert( rDrawing, rxShapes, aShapeRect ); + /* Notify the drawing that a new shape has been inserted (but not + for children of group shapes). For convenience, pass the + rectangle that contains position and size of the shape. */ + if( !pParentRect && xShape.is() ) + rDrawing.notifyShapeInserted( xShape, aShapeRect ); + } + } + return xShape; +} + +// protected ------------------------------------------------------------------ + +void BiffDrawingObjectBase::readNameBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen ) +{ + maObjName = OUString(); + if( nNameLen > 0 ) + { + // name length field is repeated before the name + maObjName = rStrm.readByteStringUC( false, getTextEncoding() ); + // skip padding byte for word boundaries + rStrm.alignToBlock( 2 ); + } +} + +void BiffDrawingObjectBase::readMacroBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + maMacroName = OUString(); + rStrm.skip( nMacroSize ); + // skip padding byte for word boundaries, not contained in nMacroSize + rStrm.alignToBlock( 2 ); +} + +void BiffDrawingObjectBase::readMacroBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + maMacroName = OUString(); + rStrm.skip( nMacroSize ); +} + +void BiffDrawingObjectBase::readMacroBiff5( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + maMacroName = OUString(); + rStrm.skip( nMacroSize ); +} + +void BiffDrawingObjectBase::readMacroBiff8( BiffInputStream& rStrm ) +{ + maMacroName = OUString(); + if( rStrm.getRemaining() > 6 ) + { + // macro is stored in a tNameXR token containing a link to a defined name + sal_uInt16 nFmlaSize; + rStrm >> nFmlaSize; + rStrm.skip( 4 ); + OSL_ENSURE( nFmlaSize == 7, "BiffDrawingObjectBase::readMacroBiff8 - unexpected formula size" ); + if( nFmlaSize == 7 ) + { + sal_uInt8 nTokenId; + sal_uInt16 nExtLinkId, nExtNameId; + rStrm >> nTokenId >> nExtLinkId >> nExtNameId; +#if 0 + OSL_ENSURE( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ), + "BiffDrawingObjectBase::readMacroBiff8 - tNameXR token expected" ); + if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) ) + maMacroName = GetLinkManager().GetMacroName( nExtLinkId, nExtNameId ); +#endif + } + } +} + +void BiffDrawingObjectBase::implReadObjBiff3( BiffInputStream& /*rStrm*/, sal_uInt16 /*nMacroSize*/ ) +{ +} + +void BiffDrawingObjectBase::implReadObjBiff4( BiffInputStream& /*rStrm*/, sal_uInt16 /*nMacroSize*/ ) +{ +} + +void BiffDrawingObjectBase::implReadObjBiff5( BiffInputStream& /*rStrm*/, sal_uInt16 /*nNameLen*/, sal_uInt16 /*nMacroSize*/ ) +{ +} + +void BiffDrawingObjectBase::implReadObjBiff8SubRec( BiffInputStream& /*rStrm*/, sal_uInt16 /*nSubRecId*/, sal_uInt16 /*nSubRecSize*/ ) +{ +} + +// private -------------------------------------------------------------------- + +void BiffDrawingObjectBase::importObjBiff3( BiffInputStream& rStrm ) +{ + // back to offset 4 (ignore object count field) + rStrm.seek( 4 ); + + sal_uInt16 nObjFlags, nMacroSize; + rStrm >> mnObjType >> mnObjId >> nObjFlags >> maAnchor >> nMacroSize; + rStrm.skip( 2 ); + + mbHasAnchor = true; + mbHidden = getFlag( nObjFlags, BIFF_OBJ_HIDDEN ); + mbVisible = getFlag( nObjFlags, BIFF_OBJ_VISIBLE ); + implReadObjBiff3( rStrm, nMacroSize ); +} + +void BiffDrawingObjectBase::importObjBiff4( BiffInputStream& rStrm ) +{ + // back to offset 4 (ignore object count field) + rStrm.seek( 4 ); + + sal_uInt16 nObjFlags, nMacroSize; + rStrm >> mnObjType >> mnObjId >> nObjFlags >> maAnchor >> nMacroSize; + rStrm.skip( 2 ); + + mbHasAnchor = true; + mbHidden = getFlag( nObjFlags, BIFF_OBJ_HIDDEN ); + mbVisible = getFlag( nObjFlags, BIFF_OBJ_VISIBLE ); + mbPrintable = getFlag( nObjFlags, BIFF_OBJ_PRINTABLE ); + implReadObjBiff4( rStrm, nMacroSize ); +} + +void BiffDrawingObjectBase::importObjBiff5( BiffInputStream& rStrm ) +{ + // back to offset 4 (ignore object count field) + rStrm.seek( 4 ); + + sal_uInt16 nObjFlags, nMacroSize, nNameLen; + rStrm >> mnObjType >> mnObjId >> nObjFlags >> maAnchor >> nMacroSize; + rStrm.skip( 2 ); + rStrm >> nNameLen; + rStrm.skip( 2 ); + + mbHasAnchor = true; + mbHidden = getFlag( nObjFlags, BIFF_OBJ_HIDDEN ); + mbVisible = getFlag( nObjFlags, BIFF_OBJ_VISIBLE ); + mbPrintable = getFlag( nObjFlags, BIFF_OBJ_PRINTABLE ); + implReadObjBiff5( rStrm, nNameLen, nMacroSize ); +} + +void BiffDrawingObjectBase::importObjBiff8( BiffInputStream& rStrm ) +{ + // back to beginning + rStrm.seekToStart(); + + bool bLoop = true; + while( bLoop && (rStrm.getRemaining() >= 4) ) + { + sal_uInt16 nSubRecId, nSubRecSize; + rStrm >> nSubRecId >> nSubRecSize; + sal_Int64 nStrmPos = rStrm.tell(); + // sometimes the last subrecord has an invalid length (OBJLBSDATA) -> min() + nSubRecSize = static_cast< sal_uInt16 >( ::std::min< sal_Int64 >( nSubRecSize, rStrm.getRemaining() ) ); + + switch( nSubRecId ) + { + case BIFF_ID_OBJCMO: + OSL_ENSURE( rStrm.tell() == 4, "BiffDrawingObjectBase::importObjBiff8 - unexpected OBJCMO subrecord" ); + if( (rStrm.tell() == 4) && (nSubRecSize >= 6) ) + { + sal_uInt16 nObjFlags; + rStrm >> mnObjType >> mnObjId >> nObjFlags; + mbPrintable = getFlag( nObjFlags, BIFF_OBJCMO_PRINTABLE ); + } + break; + case BIFF_ID_OBJMACRO: + readMacroBiff8( rStrm ); + break; + case BIFF_ID_OBJEND: + bLoop = false; + break; + default: + implReadObjBiff8SubRec( rStrm, nSubRecId, nSubRecSize ); + } + + // seek to end of subrecord + rStrm.seek( nStrmPos + nSubRecSize ); + } + + /* Call doReadObj8SubRec() with BIFF_ID_OBJEND for further stream + processing (e.g. charts), even if the OBJEND subrecord is missing. */ + implReadObjBiff8SubRec( rStrm, BIFF_ID_OBJEND, 0 ); + + /* Pictures that Excel reads from BIFF5 and writes to BIFF8 still have the + IMGDATA record following the OBJ record (but they use the image data + stored in DFF). The IMGDATA record may be continued by several CONTINUE + records. But the last CONTINUE record may be in fact an MSODRAWING + record that contains the DFF data of the next drawing object! So we + have to skip just enough CONTINUE records to look at the next + MSODRAWING/CONTINUE record. */ + if( (rStrm.getNextRecId() == BIFF3_ID_IMGDATA) && rStrm.startNextRecord() ) + { + rStrm.skip( 4 ); + sal_Int64 nDataSize = rStrm.readuInt32(); + nDataSize -= rStrm.getRemaining(); + // skip following CONTINUE records until IMGDATA ends + while( (nDataSize > 0) && (rStrm.getNextRecId() == BIFF_ID_CONT) && rStrm.startNextRecord() ) + { + OSL_ENSURE( nDataSize >= rStrm.getRemaining(), "BiffDrawingObjectBase::importObjBiff8 - CONTINUE too long" ); + nDataSize -= ::std::min( rStrm.getRemaining(), nDataSize ); + } + OSL_ENSURE( nDataSize == 0, "BiffDrawingObjectBase::importObjBiff8 - missing CONTINUE records" ); + // next record may be MSODRAWING or CONTINUE or anything else + } +} + +// ============================================================================ + +BiffPlaceholderObject::BiffPlaceholderObject( const WorksheetHelper& rHelper ) : + BiffDrawingObjectBase( rHelper ) +{ + setProcessShape( false ); +} + +Reference< XShape > BiffPlaceholderObject::implConvertAndInsert( BiffDrawingBase& /*rDrawing*/, + const Reference< XShapes >& /*rxShapes*/, const Rectangle& /*rShapeRect*/ ) const +{ + return Reference< XShape >(); +} + +// ============================================================================ + +BiffGroupObject::BiffGroupObject( const WorksheetHelper& rHelper ) : + BiffDrawingObjectBase( rHelper ), + mnFirstUngrouped( BIFF_OBJ_INVALID_ID ) +{ +} + +bool BiffGroupObject::tryInsert( const BiffDrawingObjectRef& rxDrawingObj ) +{ + if( rxDrawingObj->getObjId() == mnFirstUngrouped ) + return false; + // insert into own list or into nested group + maChildren.insertGrouped( rxDrawingObj ); + return true; +} + +void BiffGroupObject::implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm.skip( 4 ); + rStrm >> mnFirstUngrouped; + rStrm.skip( 16 ); + readMacroBiff3( rStrm, nMacroSize ); +} + +void BiffGroupObject::implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm.skip( 4 ); + rStrm >> mnFirstUngrouped; + rStrm.skip( 16 ); + readMacroBiff4( rStrm, nMacroSize ); +} + +void BiffGroupObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) +{ + rStrm.skip( 4 ); + rStrm >> mnFirstUngrouped; + rStrm.skip( 16 ); + readNameBiff5( rStrm, nNameLen ); + readMacroBiff5( rStrm, nMacroSize ); +} + +Reference< XShape > BiffGroupObject::implConvertAndInsert( BiffDrawingBase& /*rDrawing*/, + const Reference< XShapes >& /*rxShapes*/, const Rectangle& /*rShapeRect*/ ) const +{ + return Reference< XShape >(); +} + +// ============================================================================ + +BiffLineObject::BiffLineObject( const WorksheetHelper& rHelper ) : + BiffDrawingObjectBase( rHelper ), + mnArrows( 0 ), + mnStartPoint( BIFF_OBJ_LINE_TL ) +{ + setAreaObj( false ); +} + +void BiffLineObject::implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm >> maLineModel >> mnArrows >> mnStartPoint; + rStrm.skip( 1 ); + readMacroBiff3( rStrm, nMacroSize ); +} + +void BiffLineObject::implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm >> maLineModel >> mnArrows >> mnStartPoint; + rStrm.skip( 1 ); + readMacroBiff4( rStrm, nMacroSize ); +} + +void BiffLineObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) +{ + rStrm >> maLineModel >> mnArrows >> mnStartPoint; + rStrm.skip( 1 ); + readNameBiff5( rStrm, nNameLen ); + readMacroBiff5( rStrm, nMacroSize ); +} + +Reference< XShape > BiffLineObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.LineShape" ), rxShapes, rShapeRect ); +} + +// ============================================================================ + +BiffRectObject::BiffRectObject( const WorksheetHelper& rHelper ) : + BiffDrawingObjectBase( rHelper ), + mnFrameFlags( 0 ) +{ + setAreaObj( true ); +} + +void BiffRectObject::readFrameData( BiffInputStream& rStrm ) +{ + rStrm >> maFillModel >> maLineModel >> mnFrameFlags; +} + +void BiffRectObject::implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + readFrameData( rStrm ); + readMacroBiff3( rStrm, nMacroSize ); +} + +void BiffRectObject::implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + readFrameData( rStrm ); + readMacroBiff4( rStrm, nMacroSize ); +} + +void BiffRectObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) +{ + readFrameData( rStrm ); + readNameBiff5( rStrm, nNameLen ); + readMacroBiff5( rStrm, nMacroSize ); +} + +Reference< XShape > BiffRectObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.RectangleShape" ), rxShapes, rShapeRect ); +} + +// ============================================================================ + +BiffOvalObject::BiffOvalObject( const WorksheetHelper& rHelper ) : + BiffRectObject( rHelper ) +{ +} + +Reference< XShape > BiffOvalObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.EllipseShape" ), rxShapes, rShapeRect ); +} + +// ============================================================================ +// BIFF drawing page +// ============================================================================ + +BiffDrawingBase::BiffDrawingBase( const WorksheetHelper& rHelper, const Reference< XDrawPage >& rxDrawPage ) : + WorksheetHelper( rHelper ), + mxDrawPage( rxDrawPage ) +{ +} + +void BiffDrawingBase::importObj( BiffInputStream& rStrm ) +{ + BiffDrawingObjectRef xDrawingObj; + +#if 0 + /* #i61786# In BIFF8 streams, OBJ records may occur without MSODRAWING + records. In this case, the OBJ records are in BIFF5 format. Do a sanity + check here that there is no DFF data loaded before. */ + DBG_ASSERT( maDffStrm.Tell() == 0, "BiffDrawingBase::importObj - unexpected DFF stream data, OBJ will be ignored" ); + if( maDffStrm.Tell() == 0 ) switch( GetBiff() ) +#else + switch( getBiff() ) +#endif + { + case BIFF3: + xDrawingObj = BiffDrawingObjectBase::importObjBiff3( *this, rStrm ); + break; + case BIFF4: + xDrawingObj = BiffDrawingObjectBase::importObjBiff4( *this, rStrm ); + break; + case BIFF5: + case BIFF8: + xDrawingObj = BiffDrawingObjectBase::importObjBiff5( *this, rStrm ); + break; + default:; + } + + if( xDrawingObj.get() ) + { + // insert into maRawObjs or into the last open group object + maRawObjs.insertGrouped( xDrawingObj ); + // to be able to find objects by ID + maObjMapId[ xDrawingObj->getObjId() ] = xDrawingObj; + } +} + +void BiffDrawingBase::setSkipObj( sal_uInt16 nObjId ) +{ + /* Store identifiers of objects to be skipped in a separate list (the OBJ + record may not be read yet). In the finalization phase, all objects + registered here will be skipped. */ + maSkipObjs.push_back( nObjId ); +} + +void BiffDrawingBase::finalizeImport() +{ + Reference< XShapes > xShapes( mxDrawPage, UNO_QUERY ); + OSL_ENSURE( xShapes.is(), "BiffDrawingBase::finalizeImport - no shapes container" ); + if( !xShapes.is() ) + return; + + // process list of objects to be skipped + for( BiffObjIdVector::const_iterator aIt = maSkipObjs.begin(), aEnd = maSkipObjs.end(); aIt != aEnd; ++aIt ) + if( BiffDrawingObjectBase* pDrawingObj = maObjMapId.get( *aIt ).get() ) + pDrawingObj->setProcessShape( false ); + + // process drawing objects without DFF data + maRawObjs.convertAndInsert( *this, xShapes ); +} + +Reference< XShape > BiffDrawingBase::createAndInsertXShape( const OUString& rService, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + OSL_ENSURE( rService.getLength() > 0, "BiffDrawingBase::createAndInsertXShape - missing UNO shape service name" ); + OSL_ENSURE( rxShapes.is(), "BiffDrawingBase::createAndInsertXShape - missing XShapes container" ); + Reference< XShape > xShape; + if( (rService.getLength() > 0) && rxShapes.is() ) try + { + Reference< XMultiServiceFactory > xFactory( getDocumentFactory(), UNO_SET_THROW ); + xShape.set( xFactory->createInstance( rService ), UNO_QUERY_THROW ); + // insert shape into passed shape collection (maybe drawpage or group shape) + rxShapes->add( xShape ); + xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) ); + xShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) ); + } + catch( Exception& ) + { + } + OSL_ENSURE( xShape.is(), "BiffDrawingBase::createAndInsertXShape - cannot instanciate shape object" ); + return xShape; +} + +// protected ------------------------------------------------------------------ + +void BiffDrawingBase::appendRawObject( const BiffDrawingObjectRef& rxDrawingObj ) +{ + OSL_ENSURE( rxDrawingObj.get(), "BiffDrawingBase::appendRawObject - unexpected empty object reference" ); + maRawObjs.append( rxDrawingObj ); +} + +// ============================================================================ + +BiffSheetDrawing::BiffSheetDrawing( const WorksheetHelper& rHelper ) : + BiffDrawingBase( rHelper, rHelper.getDrawPage() ) +{ +} + +void BiffSheetDrawing::notifyShapeInserted( const Reference< XShape >& /*rxShape*/, const Rectangle& rShapeRect ) +{ + // collect all shape positions in the WorksheetHelper base class + extendShapeBoundingBox( rShapeRect ); +} + +// ============================================================================ + +} // namespace xls +} // namespace oox diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk index b5ede953bbfe..493575a408a8 100644 --- a/oox/source/xls/makefile.mk +++ b/oox/source/xls/makefile.mk @@ -55,7 +55,9 @@ SLOFILES = \ $(SLO)$/condformatcontext.obj \ $(SLO)$/connectionsfragment.obj \ $(SLO)$/defnamesbuffer.obj \ + $(SLO)$/drawingbase.obj \ $(SLO)$/drawingfragment.obj \ + $(SLO)$/drawingmanager.obj \ $(SLO)$/excelchartconverter.obj \ $(SLO)$/excelfilter.obj \ $(SLO)$/excelhandlers.obj \ diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index bee58fdbaff3..9a8fa57f68cb 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -36,6 +36,7 @@ #include "oox/xls/commentsfragment.hxx" #include "oox/xls/condformatcontext.hxx" #include "oox/xls/drawingfragment.hxx" +#include "oox/xls/drawingmanager.hxx" #include "oox/xls/externallinkbuffer.hxx" #include "oox/xls/pagesettings.hxx" #include "oox/xls/pivottablebuffer.hxx" @@ -772,6 +773,7 @@ bool BiffWorksheetFragment::importFragment() SheetViewSettings& rSheetViewSett = getSheetViewSettings(); CondFormatBuffer& rCondFormats = getCondFormats(); PageSettings& rPageSett = getPageSettings(); + BiffSheetDrawing& rDrawing = getBiffDrawing(); // process all record in this sheet fragment while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) ) @@ -831,6 +833,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_DEFCOLWIDTH: importDefColWidth(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; + case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break; case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break; @@ -846,6 +849,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_COLINFO: importColInfo(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; + case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break; @@ -863,6 +867,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; case BIFF_ID_MERGEDCELLS: importMergedCells(); break; // #i62300# also in BIFF5 + case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; case BIFF_ID_PTDEFINITION: importPTDefinition(); break; @@ -889,6 +894,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_HYPERLINK: importHyperlink(); break; case BIFF_ID_LABELRANGES: importLabelRanges(); break; case BIFF_ID_MERGEDCELLS: importMergedCells(); break; +// case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( mrStrm ); break; diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index d2d42f2be369..626d3b962ceb 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -62,6 +62,7 @@ #include "oox/xls/commentsbuffer.hxx" #include "oox/xls/condformatbuffer.hxx" #include "oox/xls/drawingfragment.hxx" +#include "oox/xls/drawingmanager.hxx" #include "oox/xls/formulaparser.hxx" #include "oox/xls/pagesettings.hxx" #include "oox/xls/sharedformulabuffer.hxx" @@ -396,7 +397,7 @@ public: /** Returns the XDrawPage interface of the draw page of the current sheet. */ Reference< XDrawPage > getDrawPage() const; /** Returns the size of the entire drawing page in 1/100 mm. */ - Size getDrawPageSize() const; + const Size& getDrawPageSize() const; /** Returns the absolute position of the top-left corner of the cell in 1/100 mm. */ Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const; @@ -404,7 +405,7 @@ public: Size getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const; /** Returns the address of the cell that contains the passed point in 1/100 mm. */ - CellAddress getCellAddressFromPosition( const Point& rPosition, const Size& rDrawPageSize ) const; + CellAddress getCellAddressFromPosition( const Point& rPosition ) const; /** Returns the cell range address that contains the passed rectangle in 1/100 mm. */ CellRangeAddress getCellRangeFromRectangle( const Rectangle& rRect ) const; @@ -420,8 +421,10 @@ public: inline PageSettings& getPageSettings() { return maPageSett; } /** Returns the view settings for this sheet. */ inline SheetViewSettings& getSheetViewSettings() { return maSheetViewSett; } - /** Returns the VML drawing page for this sheet (OOX only!). */ + /** Returns the VML drawing page for this sheet (OOXML/BIFF12 only). */ inline VmlDrawing& getVmlDrawing() { return *mxVmlDrawing; } + /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */ + inline BiffSheetDrawing& getBiffDrawing() const { return *mxBiffDrawing; } /** Changes the current sheet type. */ inline void setSheetType( WorksheetType eSheetType ) { meSheetType = eSheetType; } @@ -543,13 +546,6 @@ private: /** Merges the passed merged range and updates right/bottom cell borders. */ void finalizeMergedRange( const CellRangeAddress& rRange ); - /** Imports the drawing layer of the sheet (DrawingML part). */ - void finalizeDrawing(); - /** Imports the drawing layer of the sheet (VML part). */ - void finalizeVmlDrawing(); - /** Extends the used cell area with the area used by drawing objects. */ - void finalizeUsedArea(); - /** Converts column properties for all columns in the sheet. */ void convertColumns(); /** Converts column properties. */ @@ -565,8 +561,12 @@ private: /** Groups columns or rows for the given range. */ void groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows ); + /** Imports the drawings of the sheet (DML, VML, DFF) and updates the used area. */ + void finalizeDrawings(); + private: - typedef ::std::auto_ptr< VmlDrawing > VmlDrawingPtr; + typedef ::std::auto_ptr< VmlDrawing > VmlDrawingPtr; + typedef ::std::auto_ptr< BiffSheetDrawing > BiffSheetDrawingPtr; const OUString maTrueFormula; /// Replacement formula for TRUE boolean cells. const OUString maFalseFormula; /// Replacement formula for FALSE boolean cells. @@ -592,8 +592,10 @@ private: PageSettings maPageSett; /// Page/print settings for this sheet. SheetViewSettings maSheetViewSett; /// View settings for this sheet. VmlDrawingPtr mxVmlDrawing; /// Collection of all VML shapes. + BiffSheetDrawingPtr mxBiffDrawing; /// Collection of all BIFF/DFF shapes. OUString maDrawingPath; /// Path to DrawingML fragment. OUString maVmlDrawingPath; /// Path to legacy VML drawing fragment. + Size maDrawPageSize; /// Current size of the drawing page in 1/100 mm. Rectangle maShapeBoundingBox; /// Bounding box for all shapes from all drawings. ISegmentProgressBarRef mxProgressBar; /// Sheet progress bar. ISegmentProgressBarRef mxRowProgress; /// Progress bar for row/cell processing. @@ -645,8 +647,17 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar maDefRowModel.mbCollapsed = false; // buffers - if( getFilterType() == FILTER_OOX ) - mxVmlDrawing.reset( new VmlDrawing( *this ) ); + switch( getFilterType() ) + { + case FILTER_OOX: + mxVmlDrawing.reset( new VmlDrawing( *this ) ); + break; + case FILTER_BIFF: + mxBiffDrawing.reset( new BiffSheetDrawing( *this ) ); + break; + case FILTER_UNKNOWN: + break; + } // prepare progress bars if( mxProgressBar.get() ) @@ -771,12 +782,10 @@ Reference< XDrawPage > WorksheetData::getDrawPage() const return xDrawPage; } -Size WorksheetData::getDrawPageSize() const +const Size& WorksheetData::getDrawPageSize() const { - Size aSize; - PropertySet aRangeProp( getCellRange( CellRangeAddress( getSheetIndex(), 0, 0, mrMaxApiPos.Column, mrMaxApiPos.Row ) ) ); - aRangeProp.getProperty( aSize, PROP_Size ); - return aSize; + OSL_ENSURE( (maDrawPageSize.Width > 0) && (maDrawPageSize.Height > 0), "WorksheetData::getDrawPageSize - called too early, size invalid" ); + return maDrawPageSize; } Point WorksheetData::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const @@ -864,7 +873,7 @@ bool lclUpdateInterval( sal_Int32& rnBegAddr, sal_Int32& rnMidAddr, sal_Int32& r } // namespace -CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition, const Size& rDrawPageSize ) const +CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition ) const { // starting cell address and its position in drawing layer (top-left edge) sal_Int32 nBegCol = 0; @@ -874,7 +883,7 @@ CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition, c // end cell address and its position in drawing layer (bottom-right edge) sal_Int32 nEndCol = mrMaxApiPos.Column + 1; sal_Int32 nEndRow = mrMaxApiPos.Row + 1; - Point aEndPos( rDrawPageSize.Width, rDrawPageSize.Height ); + Point aEndPos( maDrawPageSize.Width, maDrawPageSize.Height ); // starting point for interval search sal_Int32 nMidCol, nMidRow; @@ -902,10 +911,9 @@ CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition, c CellRangeAddress WorksheetData::getCellRangeFromRectangle( const Rectangle& rRect ) const { - Size aPageSize = getDrawPageSize(); - CellAddress aStartAddr = getCellAddressFromPosition( Point( rRect.X, rRect.Y ), aPageSize ); + CellAddress aStartAddr = getCellAddressFromPosition( Point( rRect.X, rRect.Y ) ); Point aBotRight( rRect.X + rRect.Width, rRect.Y + rRect.Height ); - CellAddress aEndAddr = getCellAddressFromPosition( aBotRight, aPageSize ); + CellAddress aEndAddr = getCellAddressFromPosition( aBotRight ); bool bMultiCols = aStartAddr.Column < aEndAddr.Column; bool bMultiRows = aStartAddr.Row < aEndAddr.Row; if( bMultiCols || bMultiRows ) @@ -1171,10 +1179,7 @@ void WorksheetData::finalizeWorksheetImport() convertColumns(); convertRows(); lclUpdateProgressBar( mxFinalProgress, 0.75 ); - finalizeDrawing(); - finalizeVmlDrawing(); - maComments.finalizeImport(); // after VML drawing - finalizeUsedArea(); // after DML and VML drawing + finalizeDrawings(); lclUpdateProgressBar( mxFinalProgress, 1.0 ); // reset current sheet index in global data @@ -1561,42 +1566,6 @@ void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange ) } } -void WorksheetData::finalizeDrawing() -{ - OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maDrawingPath.getLength() == 0), - "WorksheetData::finalizeDrawing - unexpected DrawingML path" ); - if( (getFilterType() == FILTER_OOX) && (maDrawingPath.getLength() > 0) ) - importOoxFragment( new OoxDrawingFragment( *this, maDrawingPath ) ); -} - -void WorksheetData::finalizeVmlDrawing() -{ - OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maVmlDrawingPath.getLength() == 0), - "WorksheetData::finalizeVmlDrawing - unexpected VML path" ); - if( (getFilterType() == FILTER_OOX) && (maVmlDrawingPath.getLength() > 0) ) - importOoxFragment( new OoxVmlDrawingFragment( *this, maVmlDrawingPath ) ); -} - -void WorksheetData::finalizeUsedArea() -{ - /* Extend used area of the sheet by cells covered with drawing objects. - Needed if the imported document is inserted as "OLE object from file" - and thus does not provide an OLE size property by itself. */ - if( (maShapeBoundingBox.Width > 0) || (maShapeBoundingBox.Height > 0) ) - extendUsedArea( getCellRangeFromRectangle( maShapeBoundingBox ) ); - - // if no used area is set, default to A1 - if( maUsedArea.StartColumn > maUsedArea.EndColumn ) - maUsedArea.StartColumn = maUsedArea.EndColumn = 0; - if( maUsedArea.StartRow > maUsedArea.EndRow ) - maUsedArea.StartRow = maUsedArea.EndRow = 0; - - /* Register the used area of this sheet in global view settings. The - global view settings will set the visible area if this document is an - embedded OLE object. */ - getViewSettings().setSheetUsedArea( maUsedArea ); -} - void WorksheetData::convertColumns() { sal_Int32 nNextCol = 0; @@ -1761,6 +1730,52 @@ void WorksheetData::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastC } } +void WorksheetData::finalizeDrawings() +{ + // calculate the current drawing page size (after rows/columns are imported) + PropertySet aRangeProp( getCellRange( CellRangeAddress( getSheetIndex(), 0, 0, mrMaxApiPos.Column, mrMaxApiPos.Row ) ) ); + aRangeProp.getProperty( maDrawPageSize, PROP_Size ); + + switch( getFilterType() ) + { + case FILTER_OOX: + // import DML and VML + if( maDrawingPath.getLength() > 0 ) + importOoxFragment( new OoxDrawingFragment( *this, maDrawingPath ) ); + if( maVmlDrawingPath.getLength() > 0 ) + importOoxFragment( new OoxVmlDrawingFragment( *this, maVmlDrawingPath ) ); + break; + + case FILTER_BIFF: + // convert BIFF3-BIFF5 drawing objects, or import and convert DFF stream + getBiffDrawing().finalizeImport(); + break; + + case FILTER_UNKNOWN: + break; + } + + // comments (after callout shapes have been imported from VML/DFF) + maComments.finalizeImport(); + + /* Extend used area of the sheet by cells covered with drawing objects. + Needed if the imported document is inserted as "OLE object from file" + and thus does not provide an OLE size property by itself. */ + if( (maShapeBoundingBox.Width > 0) || (maShapeBoundingBox.Height > 0) ) + extendUsedArea( getCellRangeFromRectangle( maShapeBoundingBox ) ); + + // if no used area is set, default to A1 + if( maUsedArea.StartColumn > maUsedArea.EndColumn ) + maUsedArea.StartColumn = maUsedArea.EndColumn = 0; + if( maUsedArea.StartRow > maUsedArea.EndRow ) + maUsedArea.StartRow = maUsedArea.EndRow = 0; + + /* Register the used area of this sheet in global view settings. The + global view settings will set the visible area if this document is an + embedded OLE object. */ + getViewSettings().setSheetUsedArea( maUsedArea ); +} + // ============================================================================ // ============================================================================ @@ -1957,6 +1972,11 @@ VmlDrawing& WorksheetHelper::getVmlDrawing() const return mrSheetData.getVmlDrawing(); } +BiffSheetDrawing& WorksheetHelper::getBiffDrawing() const +{ + return mrSheetData.getBiffDrawing(); +} + void WorksheetHelper::setStringCell( const Reference< XCell >& rxCell, const OUString& rText ) const { OSL_ENSURE( rxCell.is(), "WorksheetHelper::setStringCell - missing cell interface" ); -- cgit From b68968b86cc749515b42a80884491793cd21d033 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 5 Jan 2011 10:27:09 +0100 Subject: dba34c: #i110584# fix for FN escape function and check if table name is empty --- dbaccess/source/ui/browser/unodatbr.cxx | 56 ++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index d15fb125f234..eb72b2a6492c 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2701,6 +2701,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) sStatus.SearchAndReplaceAscii("$name$", aName); BrowserViewStatusDisplay aShowStatus(static_cast(getView()), sStatus); + + sal_Bool bEscapeProcessing = sal_True; if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName)) { DBTreeListUserData* pData = static_cast(_pEntry->GetUserData()); @@ -2711,38 +2713,42 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) { pData->xObjectProperties = pData->xObjectProperties.query( xObject ); // if the query contains a parameterized statement and preview is enabled we won't get any data. - if ( m_bPreview && nCommandType == CommandType::QUERY && xObject.is() ) + if ( nCommandType == CommandType::QUERY && xObject.is() ) { - ::rtl::OUString sSql; Reference xObjectProps(xObject,UNO_QUERY); - xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql; - Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY ); - if (xFactory.is()) + xObjectProps->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bEscapeProcessing; + if ( m_bPreview ) { - try + ::rtl::OUString sSql; + xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql; + Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY ); + if (xFactory.is()) { - Reference xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); - if ( xAnalyzer.is() ) + try { - xAnalyzer->setQuery(sSql); - Reference xParSup(xAnalyzer,UNO_QUERY); - if ( xParSup->getParameters()->getCount() > 0 ) + Reference xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); + if ( xAnalyzer.is() ) { - String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE ")); - sFilter = sFilter + xAnalyzer->getFilter(); - String sReplace(sSql); - sReplace.SearchAndReplace(sFilter,String()); - xAnalyzer->setQuery(sReplace); - Reference xComposer(xAnalyzer,UNO_QUERY); - xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1"))); - aName = xAnalyzer->getQuery(); - nCommandType = CommandType::COMMAND; + xAnalyzer->setQuery(sSql); + Reference xParSup(xAnalyzer,UNO_QUERY); + if ( xParSup->getParameters()->getCount() > 0 ) + { + String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE ")); + sFilter = sFilter + xAnalyzer->getFilter(); + String sReplace(sSql); + sReplace.SearchAndReplace(sFilter,String()); + xAnalyzer->setQuery(sReplace); + Reference xComposer(xAnalyzer,UNO_QUERY); + xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1"))); + aName = xAnalyzer->getQuery(); + nCommandType = CommandType::COMMAND; + } } } - } - catch (Exception&) - { - DBG_UNHANDLED_EXCEPTION(); + catch (Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } } } } @@ -2751,7 +2757,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) } String sDataSourceName( getDataSourceAcessor( pConnection ) ); - bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection ); + bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection ); if ( !bSuccess ) { // clean up criticalFail(); -- cgit From 3e727eeb92ec7d0b03933c9f66d96e72d91f3f24 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 5 Jan 2011 10:27:09 +0100 Subject: dba34c: #i110584# fix for FN escape function and check if table name is empty --- connectivity/source/commontools/predicateinput.cxx | 23 +++++++--------------- connectivity/source/parse/PColumn.cxx | 16 ++++++++------- connectivity/source/parse/sqlbison.y | 9 +++++++-- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 8ffebb0cfbda..73cb88b90dbf 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -332,26 +332,17 @@ namespace dbtools OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec ); if ( pOdbcSpec ) { - if ( !_bForStatementUse ) - { - if ( ( pOdbcSpec->count() >= 2 ) - && ( SQL_NODE_STRING == pOdbcSpec->getChild(1)->getNodeType() ) - ) - { - - sReturn = pOdbcSpec->getChild(1)->getTokenValue(); - } - else - OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (odbc + param use)!" ); - } - else + if ( _bForStatementUse ) { OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent(); OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" ); if ( pFuncSpecParent ) - pFuncSpecParent->parseNodeToStr( - sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True - ); + pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); + } + else + { + pOdbcSpec->getChild(1)->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); + // sReturn = pOdbcSpec->getChild(1)->getTokenValue(); } } else diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index 10f4b5b4bdcf..8f3014908b10 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -155,13 +155,15 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe _rxResMetaData->isCurrency( _nColumnPos ), _rxDBMetaData->supportsMixedCaseQuotedIdentifiers() ); - pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData, - _rxResMetaData->getCatalogName( _nColumnPos ), - _rxResMetaData->getSchemaName( _nColumnPos ), - _rxResMetaData->getTableName( _nColumnPos ), - sal_False, - eComplete - ) ); + const ::rtl::OUString sTableName = _rxResMetaData->getTableName( _nColumnPos ); + if ( sTableName.getLength() ) + pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData, + _rxResMetaData->getCatalogName( _nColumnPos ), + _rxResMetaData->getSchemaName( _nColumnPos ), + sTableName, + sal_False, + eComplete + ) ); pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) ); pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos )); pColumn->setLabel(sLabel); diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index bfea82a25c7c..ad271e855e20 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -2447,11 +2447,16 @@ odbc_fct_spec: $$->append($1); $$->append($2); } + | SQL_TOKEN_FN set_fct_spec + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } ; odbc_fct_type: - SQL_TOKEN_FN - | SQL_TOKEN_D + SQL_TOKEN_D | SQL_TOKEN_T | SQL_TOKEN_TS ; -- cgit From 147cdcb46cc74754f0756d0d37e811d15c2d430a Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 5 Jan 2011 20:06:03 +0100 Subject: dr78: #i96587# remove ScAnnotationShapeObj class, use generic ScShapeObj for note captions --- sc/inc/notesuno.hxx | 197 +--------------- sc/inc/shapeuno.hxx | 11 + sc/source/ui/unoobj/notesuno.cxx | 491 ++------------------------------------- sc/source/ui/unoobj/shapeuno.cxx | 54 +++++ 4 files changed, 80 insertions(+), 673 deletions(-) diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx index a1648132f8e1..c7e60072698b 100644 --- a/sc/inc/notesuno.hxx +++ b/sc/inc/notesuno.hxx @@ -28,18 +28,14 @@ #ifndef SC_NOTESUNO_HXX #define SC_NOTESUNO_HXX -#include "address.hxx" -#include #include #include #include #include #include -#include -#include #include -#include - +#include +#include "address.hxx" class ScDocShell; class SvxUnoText; @@ -129,193 +125,4 @@ private: SvxUnoText* pUnoText; }; -class ScAnnotationShapeObj : public cppu::WeakImplHelper10< - com::sun::star::lang::XComponent, - com::sun::star::container::XChild, - com::sun::star::text::XText, - com::sun::star::container::XEnumerationAccess, - com::sun::star::text::XTextRangeMover, - com::sun::star::drawing::XShape, - com::sun::star::beans::XPropertySet, - com::sun::star::beans::XMultiPropertySet, - com::sun::star::beans::XPropertyState, - com::sun::star::lang::XServiceInfo >, - public SfxListener -{ -private: - ScDocShell* pDocShell; - ScAddress aCellPos; - SvxUnoText* pUnoText; - com::sun::star::uno::Reference < com::sun::star::drawing::XShape > xShape; - -private: - SvxUnoText& GetUnoText(); - com::sun::star::uno::Reference < com::sun::star::drawing::XShape > GetXShape(); - -public: - ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos); - virtual ~ScAnnotationShapeObj(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - // XChild - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - getParent() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& Parent ) - throw(::com::sun::star::lang::NoSupportException, - ::com::sun::star::uno::RuntimeException); - - // XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - - // XEnumerationAccess - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL - createEnumeration( ) throw (::com::sun::star::uno::RuntimeException); - - // XTextRangeMover - virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextRange >& xRange, - ::sal_Int16 nParagraphs ) - throw (::com::sun::star::uno::RuntimeException); - - // XText - virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextRange >& xRange, - const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextContent >& xContent, - ::sal_Bool bAbsorb ) - throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextContent >& xContent ) - throw (::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException); - - // XSimpleText - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL - createTextCursor() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL - createTextCursorByRange( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextRange >& aTextPosition ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextRange >& xRange, - const ::rtl::OUString& aString, sal_Bool bAbsorb ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< - ::com::sun::star::text::XTextRange >& xRange, - sal_Int16 nControlCharacter, sal_Bool bAbsorb ) - throw(::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - - // XTextRange - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL - getText() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL - getStart() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL - getEnd() throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setString( const ::rtl::OUString& aString ) - throw(::com::sun::star::uno::RuntimeException); - - // XShapeDescriptor - virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException); - - // XShape - virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) - throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException); - - // XPropertyState - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - - // XMultiPropertySet - virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) - throw (::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) - throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) - throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); -}; - - #endif - diff --git a/sc/inc/shapeuno.hxx b/sc/inc/shapeuno.hxx index ddbbf3108daf..a9e5bb09e7ce 100644 --- a/sc/inc/shapeuno.hxx +++ b/sc/inc/shapeuno.hxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -66,8 +67,11 @@ typedef ::cppu::WeakImplHelper5 < ::com::sun::star::beans::XPropertySet > ScShapeObj_Base; typedef ::cppu::ImplHelper1 < ::com::sun::star::text::XText > ScShapeObj_TextBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::container::XChild + > ScShapeObj_ChildBase; class ScShapeObj :public ScShapeObj_Base ,public ScShapeObj_TextBase + ,public ScShapeObj_ChildBase { private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg; @@ -77,6 +81,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo; com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId; BOOL bIsTextShape; + bool bIsNoteCaption; bool bInitializedNotifier; SdrObject* GetSdrObject() const throw(); @@ -219,6 +224,12 @@ public: virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException); + // XChild + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent ) + throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + // XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx index c5dd11977478..eac95f94d779 100644 --- a/sc/source/ui/unoobj/notesuno.cxx +++ b/sc/source/ui/unoobj/notesuno.cxx @@ -27,35 +27,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -#include +#include "notesuno.hxx" -#include "rangelst.hxx" +#include #include #include #include -#include "notesuno.hxx" -#include "textuno.hxx" -#include "cellsuno.hxx" // getParent +#include +#include + +#include "postit.hxx" +#include "cellsuno.hxx" #include "docsh.hxx" #include "docfunc.hxx" #include "hints.hxx" #include "editsrc.hxx" #include "miscuno.hxx" - -// setVisible: -#include -#include "drwlayer.hxx" -#include "detfunc.hxx" -#include "undocell.hxx" #include "unoguard.hxx" -#include "userdat.hxx" -#include -#include -#include -#include -#include -#include using namespace com::sun::star; @@ -75,7 +64,7 @@ const SvxItemPropertySet* lcl_GetAnnotationPropertySet() //------------------------------------------------------------------------ SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" ) -SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" ) +//SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" ) //------------------------------------------------------------------------ @@ -248,7 +237,11 @@ uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape( throw(::com::sun::star::uno::RuntimeException) { ScUnoGuard aGuard; - return new ScAnnotationShapeObj(pDocShell, aCellPos); + uno::Reference < drawing::XShape > xShape; + if( const ScPostIt* pNote = ImplGetNote() ) + if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) ) + xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY ); + return xShape; } SvxUnoText& ScAnnotationObj::GetUnoText() @@ -267,463 +260,5 @@ const ScPostIt* ScAnnotationObj::ImplGetNote() const { return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0; } -//------------------------------------------------------------------------ - -ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) : - pDocShell( pDocSh ), - aCellPos( rPos ), - pUnoText( NULL ) -{ - pDocShell->GetDocument()->AddUnoObject(*this); - - // pUnoText is allocated on demand (GetUnoText) - // can't be aggregated because getString/setString is handled here -} - -SvxUnoText& ScAnnotationShapeObj::GetUnoText() -{ - if (!pUnoText) - { - ScAnnotationEditSource aEditSource( pDocShell, aCellPos ); - pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(), - uno::Reference() ); - pUnoText->acquire(); - } - return *pUnoText; -} - -uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape() -{ - if (!xShape.is()) - if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) ) - if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) ) - xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY ); - return xShape; -} - -ScAnnotationShapeObj::~ScAnnotationShapeObj() -{ - if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); - if (pUnoText) - pUnoText->release(); -} - -void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( rHint.ISA( ScUpdateRefHint ) ) - { -// const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint; - - //! Ref-Update - } - else if ( rHint.ISA( SfxSimpleHint ) && - ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING ) - { - pDocShell = NULL; // ungueltig geworden - } -} - - -// XChild - -uno::Reference SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - - // Parent der Notiz ist die zugehoerige Zelle - //! existierendes Objekt finden und zurueckgeben ??? - - if (pDocShell) - return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos ); - - return NULL; -} - -void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference& /* Parent */ ) - throw(lang::NoSupportException, uno::RuntimeException) -{ - // hamma nich - //! Exception oder so ??! -} - -// XElementAccess -uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().getElementType(); -} - -sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().hasElements(); -} - -// XEnumerationAccess -uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - return GetUnoText().createEnumeration(); -} - -// XTextRangeMover -void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().moveTextRange( xRange, nParagraphs ); -} - -// XText -void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange, - const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb ) - throw (lang::IllegalArgumentException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().insertTextContent( xRange, xContent, bAbsorb ); -} - -void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent ) - throw (container::NoSuchElementException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - - GetUnoText().removeTextContent( xContent ); -} - -// XSimpleText - -uno::Reference SAL_CALL ScAnnotationShapeObj::createTextCursor() - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - // Notizen brauchen keine Extrawurst - return GetUnoText().createTextCursor(); -} - -uno::Reference SAL_CALL ScAnnotationShapeObj::createTextCursorByRange( - const uno::Reference& aTextPosition ) - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - // Notizen brauchen keine Extrawurst - return GetUnoText().createTextCursorByRange(aTextPosition); -} - -rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getString(); -} - -void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().setString(aText); -} - -void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference& xRange, - const rtl::OUString& aString, sal_Bool bAbsorb ) - throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().insertString( xRange, aString, bAbsorb ); -} - -void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference& xRange, - sal_Int16 nControlCharacter, sal_Bool bAbsorb ) - throw(lang::IllegalArgumentException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb ); -} - -uno::Reference SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getText(); -} - -uno::Reference SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getStart(); -} - -uno::Reference SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException) -{ - ScUnoGuard aGuard; - return GetUnoText().getEnd(); -} - -// XShapeDescriptor -::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY); - if (xDesc.is()) - return xDesc->getShapeType(); - return rtl::OUString(); -} - -// XShape -awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - return xShape.is() ? xShape->getPosition() : awt::Point(); -} - -void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - if( xShape.is() ) - xShape->setPosition(aPosition); -} - -awt::Size SAL_CALL ScAnnotationShapeObj::getSize( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - return xShape.is() ? xShape->getSize() : awt::Size(); -} - -void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize ) - throw (beans::PropertyVetoException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - GetXShape(); - if( xShape.is() ) - xShape->setSize(aSize); -} - -// XPropertyState -beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName ) - throw (beans::UnknownPropertyException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyState( PropertyName ); - return beans::PropertyState(); -} - -uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates( - const uno::Sequence< rtl::OUString >& aPropertyName ) - throw (beans::UnknownPropertyException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyStates( aPropertyName ); - return uno::Sequence< beans::PropertyState >(); -} - -void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - xState->setPropertyToDefault( PropertyName ); -} - -uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY); - if (xState.is()) - return xState->getPropertyDefault( aPropertyName ); - return uno::Any(); -} - -// XPropertySet -uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertySetInfo(); - return uno::Reference< beans::XPropertySetInfo >(); -} - -void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue ) - throw (beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->setPropertyValue( aPropertyName, aValue ); -} - -uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertyValue( PropertyName ); - return uno::Any(); -} - -void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName, - const uno::Reference< beans::XPropertyChangeListener >& xListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->addPropertyChangeListener( aPropertyName, xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName, - const uno::Reference< beans::XPropertyChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->removePropertyChangeListener( aPropertyName, aListener ); -} - -void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->addVetoableChangeListener( PropertyName, aListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener >& aListener ) - throw (beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->removeVetoableChangeListener( PropertyName, aListener ); -} - - // XMultiPropertySet -void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Sequence< uno::Any >& aValues ) - throw (beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->setPropertyValues( aPropertyNames, aValues ); -} - -uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues( - const uno::Sequence< rtl::OUString >& aPropertyNames ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - return xProp->getPropertyValues( aPropertyNames ); - return uno::Sequence< uno::Any >(); -} - -void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->addPropertiesChangeListener( aPropertyNames, xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->removePropertiesChangeListener( xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames, - const uno::Reference< beans::XPropertiesChangeListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY); - if (xProp.is()) - xProp->firePropertiesChangeEvent( aPropertyNames, xListener ); -} - - // XComponent -void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->dispose(); - if (xShape.is()) - xShape.clear(); -} - -void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->addEventListener( xListener ); -} - -void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) - throw (uno::RuntimeException) -{ - ScUnoGuard aGuard; - uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener( aListener ); -} //------------------------------------------------------------------------ - - - - diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 1ed384ed2ebd..6ec721198bed 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -103,6 +103,7 @@ ScShapeObj::ScShapeObj( uno::Reference& xShape ) : pShapePropertyState(NULL), pImplementationId(NULL), bIsTextShape(FALSE), + bIsNoteCaption(false), bInitializedNotifier(false) { comphelper::increment( m_refCount ); @@ -127,6 +128,7 @@ ScShapeObj::ScShapeObj( uno::Reference& xShape ) : SdrObject* pObj = GetSdrObject(); if ( pObj ) { + bIsNoteCaption = ScDrawLayer::IsNoteCaption( pObj ); lcl_initializeNotifier( *pObj, *this ); bInitializedNotifier = true; } @@ -151,6 +153,9 @@ uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType ) if ( !aRet.hasValue() && bIsTextShape ) aRet = ScShapeObj_TextBase::queryInterface( rType ); + if ( !aRet.hasValue() && bIsNoteCaption ) + aRet = ScShapeObj_ChildBase::queryInterface( rType ); + if ( !aRet.hasValue() && mxShapeAgg.is() ) aRet = mxShapeAgg->queryAggregation( rType ); @@ -1261,6 +1266,48 @@ void SAL_CALL ScShapeObj::setString( const rtl::OUString& aText ) throw(uno::Run throw uno::RuntimeException(); } +// XChild + +uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent() throw (uno::RuntimeException) +{ + ScUnoGuard aGuard; + + // receive cell position from caption object (parent of a note caption is the note cell) + SdrObject* pObj = GetSdrObject(); + if( pObj ) + { + ScDrawLayer* pModel = (ScDrawLayer*)pObj->GetModel(); + SdrPage* pPage = pObj->GetPage(); + if ( pModel ) + { + ScDocument* pDoc = pModel->GetDocument(); + if ( pDoc ) + { + SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); + if ( pObjSh && pObjSh->ISA(ScDocShell) ) + { + ScDocShell* pDocSh = (ScDocShell*)pObjSh; + + SCTAB nTab = 0; + if ( lcl_GetPageNum( pPage, *pModel, nTab ) ) + { + const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab ); + if( pCaptData ) + return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) ); + } + } + } + } + } + + return 0; +} + +void SAL_CALL ScShapeObj::setParent( const uno::Reference< uno::XInterface >& ) throw (lang::NoSupportException, uno::RuntimeException) +{ + throw lang::NoSupportException(); +} + // XTypeProvider uno::Sequence SAL_CALL ScShapeObj::getTypes() throw(uno::RuntimeException) @@ -1517,5 +1564,12 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ScShapeObj::getSupportedServiceNames( aSupported.realloc( aSupported.getLength() + 1 ); aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) ); + + if( bIsNoteCaption ) + { + aSupported.realloc( aSupported.getLength() + 1 ); + aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.CellAnnotationShape" ) ); + } + return aSupported; } -- cgit From b156d957d5029e80483bfe0da9279243a6fbf439 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 5 Jan 2011 21:25:56 +0100 Subject: dr78: #i96587# import text formatting from OOXML and BIFF12 --- oox/inc/oox/xls/richstring.hxx | 7 ++---- oox/source/xls/commentsbuffer.cxx | 44 ++++++++++++++++++------------------ oox/source/xls/richstring.cxx | 47 +++++++++++++++++++++------------------ 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx index 6293aac4d340..e780d53aaa89 100644 --- a/oox/inc/oox/xls/richstring.hxx +++ b/oox/inc/oox/xls/richstring.hxx @@ -74,7 +74,7 @@ public: /** Converts the portion and appends it to the passed XText. */ void convert( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - sal_Int32 nXfId ); + sal_Int32 nXfId, bool bReplaceOld = false ); private: ::rtl::OUString maText; /// Portion text. @@ -254,13 +254,10 @@ public: /** Final processing after import of all strings. */ void finalizeImport(); - /** Returns the plain text concatenated from all string portions. */ - ::rtl::OUString getPlainText() const; - /** Converts the string and writes it into the passed XText. */ void convert( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - sal_Int32 nXfId ) const; + sal_Int32 nXfId, bool bReplaceOld = false ) const; private: /** Creates, appends, and returns a new empty string portion. */ diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index 190309649789..612568ed0b51 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -48,6 +48,7 @@ using ::com::sun::star::sheet::XSheetAnnotationAnchor; using ::com::sun::star::sheet::XSheetAnnotationShapeSupplier; using ::com::sun::star::sheet::XSheetAnnotations; using ::com::sun::star::sheet::XSheetAnnotationsSupplier; +using ::com::sun::star::text::XText; namespace oox { namespace xls { @@ -96,30 +97,29 @@ void Comment::finalizeImport() CellAddress aNotePos( maModel.maRange.Sheet, maModel.maRange.StartColumn, maModel.maRange.StartRow ); if( getAddressConverter().checkCellAddress( aNotePos, true ) && maModel.mxText.get() ) try { - maModel.mxText->finalizeImport(); - OUString aNoteText = maModel.mxText->getPlainText(); - // non-empty string required by note implementation - if( aNoteText.getLength() > 0 ) + Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW ); + Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW ); + // non-empty string required by note implementation (real text will be added below) + xAnnos->insertNew( aNotePos, OUString( sal_Unicode( ' ' ) ) ); + // receive craeted note from cell (insertNew does not return the note) + Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW ); + Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW ); + Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); + Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); + // convert shape formatting + if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) { - Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW ); - Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW ); - xAnnos->insertNew( aNotePos, aNoteText ); - // receive craeted note from cell (insertNew does not return the note) - Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW ); - Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW ); - Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); - Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); - // convert shape formatting - if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) - { - // position and formatting - pNoteShape->convertFormatting( xAnnoShape ); - // visibility - const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData; - bool bVisible = rxClientData.get() && rxClientData->mbVisible; - xAnno->setIsVisible( bVisible ); - } + // position and formatting + pNoteShape->convertFormatting( xAnnoShape ); + // visibility + const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData; + bool bVisible = rxClientData.get() && rxClientData->mbVisible; + xAnno->setIsVisible( bVisible ); } + // insert text and convert text formatting + maModel.mxText->finalizeImport(); + Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW ); + maModel.mxText->convert( xAnnoText, -1, true ); } catch( Exception& ) { diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 4e82b1e696f0..c967ce60fa3d 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -37,6 +37,7 @@ using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringBuffer; using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::text::XText; using ::com::sun::star::text::XTextRange; @@ -84,21 +85,30 @@ void RichStringPortion::finalizeImport() mxFont = getStyles().getFont( mnFontId ); } -void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXfId ) +void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXfId, bool bReplaceOld ) { - Reference< XTextRange > xRange = rxText->getEnd(); - xRange->setString( maText ); - if( mxFont.get() ) - { - PropertySet aPropSet( xRange ); - mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); - } - if( const Font* pFont = getStyles().getFontFromCellXf( nXfId ).get() ) + Reference< XTextRange > xRange; + if( bReplaceOld ) + xRange.set( rxText, UNO_QUERY ); + else + xRange = rxText->getEnd(); + OSL_ENSURE( xRange.is(), "RichStringPortion::convert - cannot get text range interface" ); + + if( xRange.is() ) { - if( pFont->needsRichTextFormat() ) + xRange->setString( maText ); + if( mxFont.get() ) { PropertySet aPropSet( xRange ); - pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); + mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); + } + if( const Font* pFont = getStyles().getFontFromCellXf( nXfId ).get() ) + { + if( pFont->needsRichTextFormat() ) + { + PropertySet aPropSet( xRange ); + pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); + } } } } @@ -489,20 +499,13 @@ void RichString::finalizeImport() maFontPortions.forEachMem( &RichStringPortion::finalizeImport ); } -OUString RichString::getPlainText() const -{ - OUStringBuffer aBuffer; - for( PortionVec::const_iterator aIt = maFontPortions.begin(), aEnd = maFontPortions.end(); aIt != aEnd; ++aIt ) - aBuffer.append( (*aIt)->getText() ); - return aBuffer.makeStringAndClear(); -} - -void RichString::convert( const Reference< XText >& rxText, sal_Int32 nXfId ) const +void RichString::convert( const Reference< XText >& rxText, sal_Int32 nXfId, bool bReplaceOld ) const { for( PortionVec::const_iterator aIt = maFontPortions.begin(), aEnd = maFontPortions.end(); aIt != aEnd; ++aIt ) { - (*aIt)->convert( rxText, nXfId ); - nXfId = -1; // use passed XF identifier for first portion only + (*aIt)->convert( rxText, nXfId, bReplaceOld ); + nXfId = -1; // use passed XF identifier for first portion only + bReplaceOld = false; // do not replace first portion text with following portions } } -- cgit From 54b40663d23e6a56ce1dabb05a385d895958de34 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 6 Jan 2011 12:32:17 +0100 Subject: dba34c: #i113405# remove row from rowset when it can not be accessed anymore and adjust rowcount --- dbaccess/source/core/api/KeySet.cxx | 23 +++++++++++++++++------ dbaccess/source/core/api/KeySet.hxx | 4 +++- dbaccess/source/core/api/OptimisticSet.cxx | 5 +++-- dbaccess/source/core/api/OptimisticSet.hxx | 3 ++- dbaccess/source/core/api/RowSetCache.cxx | 8 ++------ 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 932314b72fbe..21dc7d8443e6 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -154,7 +154,8 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name const Reference< XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows) + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount) :OCacheSet(i_nMaxRows) ,m_aParameterValueForCache(_aParameterValueForCache) ,m_pKeyColumnNames(NULL) @@ -165,6 +166,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, ,m_xTableKeys(_xTableKeys) ,m_xComposer(_xComposer) ,m_sUpdateTableName(_rUpdateTableName) + ,m_rRowCount(o_nRowCount) ,m_bRowCountFinal(sal_False) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::OKeySet" ); @@ -1239,8 +1241,8 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) ++m_aKeyIter; if(m_aKeyIter == m_aKeyMap.end() && !fetchRow()) m_aKeyIter = m_aKeyMap.end(); - - refreshRow(); + else + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } // ----------------------------------------------------------------------------- @@ -1403,9 +1405,18 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) OSL_ENSURE(m_xSet.is(),"No resultset form statement!"); sal_Bool bOK = m_xSet->next(); if ( !bOK ) - m_aKeyIter = m_aKeyMap.end(); - m_xRow.set(m_xSet,UNO_QUERY); - OSL_ENSURE(m_xRow.is(),"No row form statement!"); + { + OKeySetMatrix::iterator aTemp = m_aKeyIter; + ++m_aKeyIter; + m_aKeyMap.erase(aTemp); + --m_rRowCount; + refreshRow(); + } + else + { + m_xRow.set(m_xSet,UNO_QUERY); + OSL_ENSURE(m_xRow.is(),"No row form statement!"); + } } // ----------------------------------------------------------------------------- sal_Bool OKeySet::fetchRow() diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index c002288bd9de..2f9d1b002cb1 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -113,6 +113,7 @@ namespace dbaccess ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer; ::rtl::OUString m_sUpdateTableName; ::std::vector< ::rtl::OUString > m_aFilterColumns; + sal_Int32& m_rRowCount; sal_Bool m_bRowCountFinal; @@ -160,7 +161,8 @@ namespace dbaccess const ::rtl::OUString& _rUpdateTableName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows); + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount); // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index d984ca2c78c6..2637a4f6bea6 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -103,8 +103,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows) - :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows) + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount) + :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount) ,m_aSqlParser( _rContext.getLegacyServiceFactory() ) ,m_aSqlIterator( i_xConnection, Reference(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL ) ,m_bResultSetChanged(false) diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx index da73eaeee8c5..f3b75e08ed5b 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -80,7 +80,8 @@ namespace dbaccess const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows); + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount); // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 1380c436ff0e..789fbadb794b 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -176,7 +176,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) {// here we have a join or union and nobody told us which table to update, so we update them all m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); + OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount); m_pCacheSet = pCursor; m_xCacheSet = m_pCacheSet; try @@ -309,7 +309,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } } - OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); + OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount); try { m_pCacheSet = pKeySet; @@ -825,7 +825,6 @@ sal_Bool ORowSetCache::moveWindow() if ( nNewStartPos < 1 ) { bCheck = m_pCacheSet->first(); - // aEnd = m_pMatrix->begin() + (sal_Int32)(m_nFetchSize*0.5); OSL_ENSURE((nNewEndPos - m_nStartPos - nNewStartPos) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); aEnd = m_pMatrix->begin() + (nNewEndPos - m_nStartPos - nNewStartPos); aIter = aEnd; @@ -958,9 +957,6 @@ sal_Bool ORowSetCache::moveWindow() sal_Bool bCheck = m_pCacheSet->absolute(nPos); bCheck = fill(aIter,aEnd,nPos,bCheck); // refill the region wew don't need anymore -// // we know that this is the current maximal rowcount here -// if ( !m_bRowCountFinal && bCheck ) -// m_nRowCount = std::max(nPos,m_nRowCount); // we have to read one row forward to enshure that we know when we are on last row // but only when we don't know it already sal_Bool bOk = sal_True; -- cgit From 0ca1b7ace4da7df621d38aa9df8fab3e5984577f Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 6 Jan 2011 12:32:17 +0100 Subject: dba34c: #i113405# remove row from rowset when it can not be accessed anymore and adjust rowcount --- svx/source/fmcomp/gridctrl.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 1944bd47dad5..4defba88e3ef 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2001,6 +2001,18 @@ void DbGridControl::AdjustRows() RowRemoved(GetRowCount() - nDelta, nDelta, sal_False); // es sind Zeilen weggefallen, dann ab der aktuellen Position neu zeichen Invalidate(); + + sal_Int32 nNewPos = AlignSeekCursor(); + if (m_bSynchDisplay) + DbGridControl_Base::GoToRow(nNewPos); + + SetCurrent(nNewPos); + // there are rows so go to the selected current column + if (nRecordCount) + GoToRowColumnId(nNewPos, GetColumnId(GetCurColumnId())); + if (!IsResizing() && GetRowCount()) + RecalcRows(GetTopRow(), GetVisibleRows(), sal_True); + m_aBar.InvalidateAll(m_nCurrentPos, sal_True); } else // zuwenig RowInserted(GetRowCount(), -nDelta, sal_True); -- cgit From 1ed3654a1c0acf899fbe93352b93979f17103528 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 6 Jan 2011 12:32:39 +0100 Subject: dr78: #i96587# oox - import BIFF2-BIFF5 cell notes --- oox/inc/oox/xls/commentsbuffer.hxx | 2 ++ oox/inc/oox/xls/richstring.hxx | 10 +++--- oox/inc/oox/xls/worksheetfragment.hxx | 2 ++ oox/source/dump/biffdumper.cxx | 3 +- oox/source/xls/commentsbuffer.cxx | 59 ++++++++++++++++++++++++++++++----- oox/source/xls/defnamesbuffer.cxx | 4 +++ oox/source/xls/drawingmanager.cxx | 3 +- oox/source/xls/richstring.cxx | 17 ++++++---- oox/source/xls/worksheetfragment.cxx | 11 ++++++- 9 files changed, 91 insertions(+), 20 deletions(-) diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx index 8a43eb7fe9fe..08e75962c9f9 100644 --- a/oox/inc/oox/xls/commentsbuffer.hxx +++ b/oox/inc/oox/xls/commentsbuffer.hxx @@ -57,6 +57,8 @@ public: void importComment( const AttributeList& rAttribs ); /** Imports a cell comment from the passed stream of a COMMENT record. */ void importComment( RecordInputStream& rStrm ); + /** Imports a cell comment from the passed stream of a BIFF3-BIFF5 NOTE record. */ + void importNote( BiffInputStream& rStrm ); /** Creates and returns a new rich-string object for the comment text. */ RichStringRef createText(); diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx index e780d53aaa89..61ce1cbf5481 100644 --- a/oox/inc/oox/xls/richstring.hxx +++ b/oox/inc/oox/xls/richstring.hxx @@ -246,9 +246,11 @@ public: /** Imports a Unicode rich-string from the passed record stream. */ void importString( RecordInputStream& rStrm, bool bRich ); - /** Imports a byte string from the passed BIFF stream. */ - void importByteString( BiffInputStream& rStrm, rtl_TextEncoding eDefaultTextEnc, BiffStringFlags nFlags = BIFF_STR_DEFAULT ); - /** Imports a Unicode rich-string from the passed BIFF stream. */ + /** Imports nChars byte characters from the passed BIFF stream and appends a new text portion. */ + void importCharArray( BiffInputStream& rStrm, sal_uInt16 nChars, rtl_TextEncoding eTextEnc ); + /** Imports a byte string from the passed BIFF stream and appends new text portions. */ + void importByteString( BiffInputStream& rStrm, rtl_TextEncoding eTextEnc, BiffStringFlags nFlags = BIFF_STR_DEFAULT ); + /** Imports a Unicode rich-string from the passed BIFF stream and appends new text portions. */ void importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags = BIFF_STR_DEFAULT ); /** Final processing after import of all strings. */ @@ -266,7 +268,7 @@ private: RichStringPhoneticRef createPhonetic(); /** Create base text portions from the passed string and character formatting. */ - void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eDefaultTextEnc, FontPortionModelList& rPortions ); + void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ); /** Create base text portions from the passed string and character formatting. */ void createFontPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions ); /** Create phonetic text portions from the passed string and portion data. */ diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx index 7234153d7dd3..1e22bd7e4739 100644 --- a/oox/inc/oox/xls/worksheetfragment.hxx +++ b/oox/inc/oox/xls/worksheetfragment.hxx @@ -173,6 +173,8 @@ private: void importLabelRanges(); /** Imports the MEREDCELLS record and merges all cells in the document. */ void importMergedCells(); + /** Imports the NOTE record containing a cell note. */ + void importNote(); /** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */ void importPageBreaks( bool bRowBreak ); /** Imports a pivot table. */ diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 8b3127d0b5e7..3e9e1d77d5c2 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2523,7 +2523,8 @@ void WorkbookStreamObject::implDumpRecordBody() } else { - sal_uInt16 nTextLen = ::std::min( dumpDec< sal_uInt16 >( "text-len" ), static_cast< sal_uInt16 >( rStrm.getRemaining() ) ); + sal_uInt16 nTextLen = dumpDec< sal_uInt16 >( "text-len" ); + nTextLen = ::std::min( nTextLen, static_cast< sal_uInt16 >( rStrm.getRemaining() ) ); writeStringItem( "note-text", rStrm.readCharArrayUC( nTextLen, getBiffData().getTextEncoding(), true ) ); } break; diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index 612568ed0b51..f0d4eb63611c 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -34,6 +34,7 @@ #include "oox/helper/recordinputstream.hxx" #include "oox/vml/vmlshape.hxx" #include "oox/xls/addressconverter.hxx" +#include "oox/xls/biffinputstream.hxx" #include "oox/xls/drawingfragment.hxx" using ::rtl::OUString; @@ -82,6 +83,39 @@ void Comment::importComment( RecordInputStream& rStrm ) getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, getSheetIndex() ); } +void Comment::importNote( BiffInputStream& rStrm ) +{ + BinAddress aBinAddr; + sal_uInt16 nTotalLen; + rStrm >> aBinAddr >> nTotalLen; + // cell range will be checked while inserting the comment into the document + getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, BinRange( aBinAddr ), getSheetIndex() ); + RichStringRef xNoteText = createText(); + + sal_uInt16 nPartLen = ::std::min( nTotalLen, static_cast< sal_uInt16 >( rStrm.getRemaining() ) ); + xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); + + nTotalLen = nTotalLen - nPartLen; // operator-=() gives compiler warning + while( (nTotalLen > 0) && (rStrm.getNextRecId() == BIFF_ID_NOTE) && rStrm.startNextRecord() ) + { + rStrm >> aBinAddr >> nPartLen; + OSL_ENSURE( aBinAddr.mnRow == 0xFFFF, "Comment::importNote - missing continuation NOTE record" ); + if( aBinAddr.mnRow == 0xFFFF ) + { + OSL_ENSURE( nPartLen <= nTotalLen, "Comment::importNote - string too long" ); + // call to RichString::importCharArray() appends new text portion + xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); + nTotalLen = nTotalLen - ::std::min( nTotalLen, nPartLen ); + } + else + { + // seems to be a new note, rewind record, so worksheet fragment loop will find it + rStrm.rewindRecord(); + nTotalLen = 0; + } + } +} + RichStringRef Comment::createText() { maModel.mxText.reset( new RichString( *this ) ); @@ -107,14 +141,25 @@ void Comment::finalizeImport() Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); // convert shape formatting - if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) + switch( getFilterType() ) { - // position and formatting - pNoteShape->convertFormatting( xAnnoShape ); - // visibility - const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData; - bool bVisible = rxClientData.get() && rxClientData->mbVisible; - xAnno->setIsVisible( bVisible ); + case FILTER_OOX: + if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) + { + // position and formatting + pNoteShape->convertFormatting( xAnnoShape ); + // visibility + const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData; + bool bVisible = rxClientData.get() && rxClientData->mbVisible; + xAnno->setIsVisible( bVisible ); + } + break; + case FILTER_BIFF: + // notes are always hidden and unformatted in BIFF3-BIFF5 + xAnno->setIsVisible( sal_False ); + break; + case FILTER_UNKNOWN: + break; } // insert text and convert text formatting maModel.mxText->finalizeImport(); diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx index a02375e2b869..3c1a9169f004 100644 --- a/oox/source/xls/defnamesbuffer.cxx +++ b/oox/source/xls/defnamesbuffer.cxx @@ -491,6 +491,10 @@ void DefinedName::createNameObject() if( /*maModel.mbHidden ||*/ maModel.mbFunction ) return; + // skip BIFF names without stream position (e.g. BIFF3-BIFF4 internal 3D references) + if( (getFilterType() == FILTER_BIFF) && !mxBiffStrm.get() ) + return; + // convert original name to final Calc name if( maModel.mbVBName ) maCalcName = maModel.maName; diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 16e5ceddd27d..0ef734aa86a0 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -891,7 +891,8 @@ void BiffDrawingBase::importObj( BiffInputStream& rStrm ) xDrawingObj = BiffDrawingObjectBase::importObjBiff4( *this, rStrm ); break; case BIFF5: - case BIFF8: +// TODO: add BIFF8 when DFF is supported +// case BIFF8: xDrawingObj = BiffDrawingObjectBase::importObjBiff5( *this, rStrm ); break; default:; diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index c967ce60fa3d..f7aad994c3d5 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -416,7 +416,12 @@ void RichString::importString( RecordInputStream& rStrm, bool bRich ) } } -void RichString::importByteString( BiffInputStream& rStrm, rtl_TextEncoding eDefaultTextEnc, BiffStringFlags nFlags ) +void RichString::importCharArray( BiffInputStream& rStrm, sal_uInt16 nChars, rtl_TextEncoding eTextEnc ) +{ + createPortion()->setText( rStrm.readCharArrayUC( nChars, eTextEnc ) ); +} + +void RichString::importByteString( BiffInputStream& rStrm, rtl_TextEncoding eTextEnc, BiffStringFlags nFlags ) { OSL_ENSURE( !getFlag( nFlags, BIFF_STR_KEEPFONTS ), "RichString::importString - keep fonts not implemented" ); OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_EXTRAFONTS) ) ), "RichString::importByteString - unknown flag" ); @@ -428,11 +433,11 @@ void RichString::importByteString( BiffInputStream& rStrm, rtl_TextEncoding eDef { FontPortionModelList aPortions; aPortions.importPortions( rStrm, false ); - createFontPortions( aBaseText, eDefaultTextEnc, aPortions ); + createFontPortions( aBaseText, eTextEnc, aPortions ); } else { - createPortion()->setText( OStringToOUString( aBaseText, eDefaultTextEnc ) ); + createPortion()->setText( OStringToOUString( aBaseText, eTextEnc ) ); } } @@ -525,7 +530,7 @@ RichStringPhoneticRef RichString::createPhonetic() return xPhonetic; } -void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDefaultTextEnc, FontPortionModelList& rPortions ) +void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ) { maFontPortions.clear(); sal_Int32 nStrLen = rText.getLength(); @@ -545,8 +550,8 @@ void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDef { // convert byte string to unicode string, using current font encoding FontRef xFont = getStyles().getFont( aIt->mnFontId ); - rtl_TextEncoding eTextEnc = xFont.get() ? xFont->getFontEncoding() : eDefaultTextEnc; - OUString aUniStr = OStringToOUString( rText.copy( aIt->mnPos, nPortionLen ), eTextEnc ); + rtl_TextEncoding eFontEnc = xFont.get() ? xFont->getFontEncoding() : eTextEnc; + OUString aUniStr = OStringToOUString( rText.copy( aIt->mnPos, nPortionLen ), eFontEnc ); // create string portion RichStringPortionRef xPortion = createPortion(); xPortion->setText( aUniStr ); diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index 9a8fa57f68cb..cd017cab9cf6 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -823,6 +823,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_COLUMNDEFAULT: importColumnDefault(); break; case BIFF_ID_COLWIDTH: importColWidth(); break; case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight(); break; + case BIFF_ID_NOTE: importNote(); break; case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break; } break; @@ -833,6 +834,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_DEFCOLWIDTH: importDefColWidth(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; + case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break; @@ -849,6 +851,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_COLINFO: importColInfo(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; + case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; @@ -867,6 +870,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; case BIFF_ID_MERGEDCELLS: importMergedCells(); break; // #i62300# also in BIFF5 + case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; @@ -894,7 +898,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_HYPERLINK: importHyperlink(); break; case BIFF_ID_LABELRANGES: importLabelRanges(); break; case BIFF_ID_MERGEDCELLS: importMergedCells(); break; -// case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; + case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( mrStrm ); break; @@ -1149,6 +1153,11 @@ void BiffWorksheetFragment::importMergedCells() setMergedRange( *aIt ); } +void BiffWorksheetFragment::importNote() +{ + getComments().createComment()->importNote( mrStrm ); +} + void BiffWorksheetFragment::importPageBreaks( bool bRowBreak ) { PageBreakModel aModel; -- cgit From 28750c30fb5dac69c63b6b7bfd0d9b0264b91d57 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 6 Jan 2011 13:40:20 +0100 Subject: dba34c: #i113184# remove the order clause when the column is not part of the table --- dbaccess/source/ui/browser/unodatbr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index eb72b2a6492c..85312df66684 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -469,7 +469,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow() // check if the order columns apply to tables which really exist in the statement const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW ); const sal_Int32 nOrderColumns( xOrderColumns->getCount() ); - bool invalidColumn = false; + bool invalidColumn = nOrderColumns == 0; for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c ) { const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW ); -- cgit From b03baea914ff8f45cb1f5cf9703ff316a5396135 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 6 Jan 2011 13:56:27 +0100 Subject: dr78: #i96587# oox - import BIFF8 cell notes --- oox/inc/oox/xls/biffhelper.hxx | 1 + oox/inc/oox/xls/commentsbuffer.hxx | 15 ++++- oox/inc/oox/xls/drawingmanager.hxx | 4 ++ oox/source/dump/biffdumper.cxx | 17 +++++ oox/source/dump/biffdumper.ini | 14 ++++- oox/source/xls/commentsbuffer.cxx | 116 ++++++++++++++++++++++++++--------- oox/source/xls/drawingmanager.cxx | 2 - oox/source/xls/worksheetfragment.cxx | 5 +- 8 files changed, 135 insertions(+), 39 deletions(-) diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index ce43e44fb613..f1a732816d52 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -425,6 +425,7 @@ const sal_uInt16 BIFF_ID_MTHREADSETTINGS = 0x089A; const sal_uInt16 BIFF_ID_MULTBLANK = 0x00BE; const sal_uInt16 BIFF_ID_MULTRK = 0x00BD; const sal_uInt16 BIFF_ID_NOTE = 0x001C; +const sal_uInt16 BIFF_ID_NOTESOUND = 0x0096; const sal_uInt16 BIFF2_ID_NUMBER = 0x0003; const sal_uInt16 BIFF3_ID_NUMBER = 0x0203; const sal_uInt16 BIFF_ID_OBJ = 0x005D; diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx index 08e75962c9f9..2bc395b37c09 100644 --- a/oox/inc/oox/xls/commentsbuffer.hxx +++ b/oox/inc/oox/xls/commentsbuffer.hxx @@ -40,8 +40,11 @@ struct CommentModel { ::com::sun::star::table::CellRangeAddress maRange; /// Position of the comment in the worksheet. - RichStringRef mxText; /// Formatted text of the comment. - sal_Int32 mnAuthorId; /// Identifier of the comment's author. + RichStringRef mxText; /// Formatted text of the comment (not used in BIFF8). + ::rtl::OUString maAuthor; /// Comment author (BIFF8 only). + sal_Int32 mnAuthorId; /// Identifier of the comment's author (OOXML and BIFF12 only). + sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only). + bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only). explicit CommentModel(); }; @@ -66,6 +69,14 @@ public: /** Finalizes the formatted string of the comment. */ void finalizeImport(); +private: + /** Reads a BIFF2-BIFF5 NOTE record. */ + void importNoteBiff2( BiffInputStream& rStrm ); + /** Reads a BIFF8 NOTE record. */ + void importNoteBiff8( BiffInputStream& rStrm ); + /** Reads a NOTESOUND record. */ + void importNoteSound( BiffInputStream& rStrm ); + private: CommentModel maModel; }; diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx index 766d54cf83a3..15c5d54ea543 100755 --- a/oox/inc/oox/xls/drawingmanager.hxx +++ b/oox/inc/oox/xls/drawingmanager.hxx @@ -39,6 +39,10 @@ namespace com { namespace sun { namespace star { namespace oox { namespace xls { +// ============================================================================ + +const sal_uInt16 BIFF_OBJ_INVALID_ID = 0; + // ============================================================================ // Model structures for BIFF OBJ record data // ============================================================================ diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 3e9e1d77d5c2..718a8897d641 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2520,6 +2520,8 @@ void WorkbookStreamObject::implDumpRecordBody() { dumpHex< sal_uInt16 >( "flags", "NOTE-FLAGS" ); dumpDec< sal_uInt16 >( "obj-id" ); + dumpUniString( "author" ); + dumpUnused( 1 ); } else { @@ -2529,6 +2531,21 @@ void WorkbookStreamObject::implDumpRecordBody() } break; + case BIFF_ID_NOTESOUND: + dumpHex< sal_uInt32 >( "identifier" ); + dumpDec< sal_uInt32 >( "total-data-size" ); + dumpDec< sal_uInt32 >( "wave-data-size" ); + if( dumpDec< sal_uInt32 >( "fmt-size" ) >= 16 ) + { + dumpDec< sal_uInt16 >( "format", "NOTESOUND-FORMAT" ); + dumpDec< sal_uInt16 >( "channels" ); + dumpDec< sal_uInt32 >( "sampling-rate" ); + dumpDec< sal_uInt32 >( "data-rate" ); + dumpDec< sal_uInt16 >( "data-block-size" ); + dumpDec< sal_uInt16 >( "bits-per-sample" ); + } + break; + case BIFF2_ID_NUMBER: case BIFF3_ID_NUMBER: dumpCellHeader( nRecId == BIFF2_ID_NUMBER ); diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 18e8cd87e551..d570fcdcf515 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -324,7 +324,7 @@ multilist=RECORD-NAMES-BIFF4 exclude=0x0206,0x0209,0x001E,0x0243 0x0085=SHEET 0x0088=,,,,,,SHEETSOFFSET,SHEETHEADER - 0x0090=,,,,,SOUND,SYNC + 0x0090=,,,,,,NOTESOUND,SYNC 0x0098=LPR,STANDARDWIDTH,FNGROUPNAME,,FNGROUPCOUNT,,, 0x00A0=SCL,PAGESETUP,FNPROTO,PROJEXTSHEET,,,, 0x00A8=DRAGDROP,COORDLIST,,GCW,,,, @@ -1441,6 +1441,18 @@ shortlist=IMGDATA-ENV,1,windows,apple flagslist=NOTE-FLAGS-BIFF8 0x0002=visible + 0x0080=row-hidden + 0x0100=col-hidden +end + +# NOTESOUND ------------------------------------------------------------------ + +constlist=NOTESOUND-FORMAT + 1=pcm + 3=ieee-float + 6=a-law + 7=mu-law + 0xFFFE=extensible end # OBJ ------------------------------------------------------------------------ diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index f0d4eb63611c..8b03be299a50 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -36,6 +36,7 @@ #include "oox/xls/addressconverter.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/drawingfragment.hxx" +#include "oox/xls/drawingmanager.hxx" using ::rtl::OUString; using ::com::sun::star::uno::Reference; @@ -56,8 +57,18 @@ namespace xls { // ============================================================================ +namespace { + +const sal_uInt16 BIFF_NOTE_VISIBLE = 0x0002; + +} // namespace + +// ============================================================================ + CommentModel::CommentModel() : - mnAuthorId( -1 ) + mnAuthorId( -1 ), + mnObjId( BIFF_OBJ_INVALID_ID ), + mbVisible( false ) { } @@ -86,33 +97,29 @@ void Comment::importComment( RecordInputStream& rStrm ) void Comment::importNote( BiffInputStream& rStrm ) { BinAddress aBinAddr; - sal_uInt16 nTotalLen; - rStrm >> aBinAddr >> nTotalLen; + rStrm >> aBinAddr; // cell range will be checked while inserting the comment into the document getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, BinRange( aBinAddr ), getSheetIndex() ); - RichStringRef xNoteText = createText(); - sal_uInt16 nPartLen = ::std::min( nTotalLen, static_cast< sal_uInt16 >( rStrm.getRemaining() ) ); - xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); - - nTotalLen = nTotalLen - nPartLen; // operator-=() gives compiler warning - while( (nTotalLen > 0) && (rStrm.getNextRecId() == BIFF_ID_NOTE) && rStrm.startNextRecord() ) + // remaining record data is BIFF dependent + switch( getBiff() ) { - rStrm >> aBinAddr >> nPartLen; - OSL_ENSURE( aBinAddr.mnRow == 0xFFFF, "Comment::importNote - missing continuation NOTE record" ); - if( aBinAddr.mnRow == 0xFFFF ) - { - OSL_ENSURE( nPartLen <= nTotalLen, "Comment::importNote - string too long" ); - // call to RichString::importCharArray() appends new text portion - xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); - nTotalLen = nTotalLen - ::std::min( nTotalLen, nPartLen ); - } - else - { - // seems to be a new note, rewind record, so worksheet fragment loop will find it - rStrm.rewindRecord(); - nTotalLen = 0; - } + case BIFF2: + case BIFF3: + importNoteBiff2( rStrm ); + break; + case BIFF4: + case BIFF5: + importNoteBiff2( rStrm ); + // in BIFF4 and BIFF5, comments can have an associated sound + if( (rStrm.getNextRecId() == BIFF_ID_NOTESOUND) && rStrm.startNextRecord() ) + importNoteSound( rStrm ); + break; + case BIFF8: + importNoteBiff8( rStrm ); + break; + case BIFF_UNKNOWN: + break; } } @@ -135,12 +142,15 @@ void Comment::finalizeImport() Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW ); // non-empty string required by note implementation (real text will be added below) xAnnos->insertNew( aNotePos, OUString( sal_Unicode( ' ' ) ) ); - // receive craeted note from cell (insertNew does not return the note) + + // receive created note from cell (insertNew does not return the note) Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW ); Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW ); Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); - // convert shape formatting + + // convert shape formatting and visibility + sal_Bool bVisible = sal_True; switch( getFilterType() ) { case FILTER_OOX: @@ -150,17 +160,17 @@ void Comment::finalizeImport() pNoteShape->convertFormatting( xAnnoShape ); // visibility const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData; - bool bVisible = rxClientData.get() && rxClientData->mbVisible; - xAnno->setIsVisible( bVisible ); + bVisible = rxClientData.get() && rxClientData->mbVisible; } break; case FILTER_BIFF: - // notes are always hidden and unformatted in BIFF3-BIFF5 - xAnno->setIsVisible( sal_False ); + bVisible = maModel.mbVisible; break; case FILTER_UNKNOWN: break; } + xAnno->setIsVisible( bVisible ); + // insert text and convert text formatting maModel.mxText->finalizeImport(); Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW ); @@ -171,6 +181,52 @@ void Comment::finalizeImport() } } +// private -------------------------------------------------------------------- + +void Comment::importNoteBiff2( BiffInputStream& rStrm ) +{ + sal_uInt16 nTotalLen; + rStrm >> nTotalLen; + sal_uInt16 nPartLen = ::std::min( nTotalLen, static_cast< sal_uInt16 >( rStrm.getRemaining() ) ); + RichStringRef xNoteText = createText(); + xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); + + nTotalLen = nTotalLen - nPartLen; // operator-=() gives compiler warning + while( (nTotalLen > 0) && (rStrm.getNextRecId() == BIFF_ID_NOTE) && rStrm.startNextRecord() ) + { + sal_uInt16 nMarker; + rStrm >> nMarker; + rStrm.skip( 2 ); + rStrm >> nPartLen; + OSL_ENSURE( nMarker == 0xFFFF, "Comment::importNoteBiff2 - missing continuation NOTE record" ); + if( nMarker == 0xFFFF ) + { + OSL_ENSURE( nPartLen <= nTotalLen, "Comment::importNoteBiff2 - string too long" ); + // call to RichString::importCharArray() appends new text portion + xNoteText->importCharArray( rStrm, nPartLen, getTextEncoding() ); + nTotalLen = nTotalLen - ::std::min( nTotalLen, nPartLen ); + } + else + { + // seems to be a new note, rewind record, so worksheet fragment loop will find it + rStrm.rewindRecord(); + nTotalLen = 0; + } + } +} + +void Comment::importNoteBiff8( BiffInputStream& rStrm ) +{ + sal_uInt16 nFlags; + rStrm >> nFlags >> maModel.mnObjId; + maModel.maAuthor = rStrm.readUniString(); + maModel.mbVisible = getFlag( nFlags, BIFF_NOTE_VISIBLE ); +} + +void Comment::importNoteSound( BiffInputStream& /*rStrm*/ ) +{ +} + // ============================================================================ CommentsBuffer::CommentsBuffer( const WorksheetHelper& rHelper ) : diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 0ef734aa86a0..1016a8fa9da9 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -51,8 +51,6 @@ namespace { // OBJ record ----------------------------------------------------------------- -const sal_uInt16 BIFF_OBJ_INVALID_ID = 0; - const sal_uInt16 BIFF_OBJTYPE_GROUP = 0; const sal_uInt16 BIFF_OBJTYPE_LINE = 1; const sal_uInt16 BIFF_OBJTYPE_RECTANGLE = 2; diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index cd017cab9cf6..72137a1b82d2 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -804,6 +804,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_HORPAGEBREAKS: importPageBreaks( true ); break; case BIFF_ID_ITERATION: rWorkbookSett.importIteration( mrStrm ); break; case BIFF_ID_LEFTMARGIN: rPageSett.importLeftMargin( mrStrm ); break; + case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_PANE: rSheetViewSett.importPane( mrStrm ); break; case BIFF_ID_PASSWORD: rWorksheetSett.importPassword( mrStrm ); break; case BIFF_ID_PRINTGRIDLINES: rPageSett.importPrintGridLines( mrStrm ); break; @@ -823,7 +824,6 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_COLUMNDEFAULT: importColumnDefault(); break; case BIFF_ID_COLWIDTH: importColWidth(); break; case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight(); break; - case BIFF_ID_NOTE: importNote(); break; case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break; } break; @@ -834,7 +834,6 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_DEFCOLWIDTH: importDefColWidth(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; - case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break; @@ -851,7 +850,6 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_COLINFO: importColInfo(); break; case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; - case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; @@ -870,7 +868,6 @@ bool BiffWorksheetFragment::importFragment() case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; case BIFF_ID_MERGEDCELLS: importMergedCells(); break; // #i62300# also in BIFF5 - case BIFF_ID_NOTE: importNote(); break; case BIFF_ID_OBJ: rDrawing.importObj( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; -- cgit From af74e6a8e5b62387f2966412a9277a11330c46b1 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 6 Jan 2011 15:20:20 +0100 Subject: dr78: #i96587# typo in comment --- oox/inc/oox/xls/commentsbuffer.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx index 2bc395b37c09..203c5103b54b 100644 --- a/oox/inc/oox/xls/commentsbuffer.hxx +++ b/oox/inc/oox/xls/commentsbuffer.hxx @@ -60,7 +60,7 @@ public: void importComment( const AttributeList& rAttribs ); /** Imports a cell comment from the passed stream of a COMMENT record. */ void importComment( RecordInputStream& rStrm ); - /** Imports a cell comment from the passed stream of a BIFF3-BIFF5 NOTE record. */ + /** Imports a cell comment from the passed stream of a NOTE record. */ void importNote( BiffInputStream& rStrm ); /** Creates and returns a new rich-string object for the comment text. */ -- cgit From bb282d6533202ce6056d6aed37774c59a2deab2a Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 6 Jan 2011 15:51:51 +0100 Subject: dr78: oox - import children of BIFF3-BIFF5 group shapes --- oox/inc/oox/xls/drawingmanager.hxx | 3 +++ oox/source/xls/drawingmanager.cxx | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx index 15c5d54ea543..75ccb05da117 100755 --- a/oox/inc/oox/xls/drawingmanager.hxx +++ b/oox/inc/oox/xls/drawingmanager.hxx @@ -126,6 +126,9 @@ class BiffDrawingObjectContainer public: explicit BiffDrawingObjectContainer(); + /** Returns true, if the object list is empty. */ + inline bool empty() const { return maObjects.empty(); } + /** Appends the passed object to the list of objects. */ void append( const BiffDrawingObjectRef& rxDrawingObj ); /** Tries to insert the passed object into the last group or appends it. */ diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 1016a8fa9da9..d9a58eafb9d8 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -496,6 +496,7 @@ Reference< XShape > BiffDrawingObjectBase::convertAndInsert( BiffDrawingBase& rD if( rxShapes.is() && mbProcessShape && !mbHidden ) // TODO: support for hidden objects? { // base class 'ShapeAnchor' calculates the shape rectangle in 1/100 mm + // in BIFF3-BIFF5, all shapes have absolute anchor (also children of group shapes) Rectangle aShapeRect = maAnchor.calcAnchorRectHmm( getDrawPageSize() ); // convert the shape, if the calculated rectangle is not empty @@ -762,10 +763,26 @@ void BiffGroupObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nName readMacroBiff5( rStrm, nMacroSize ); } -Reference< XShape > BiffGroupObject::implConvertAndInsert( BiffDrawingBase& /*rDrawing*/, - const Reference< XShapes >& /*rxShapes*/, const Rectangle& /*rShapeRect*/ ) const +Reference< XShape > BiffGroupObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - return Reference< XShape >(); + Reference< XShape > xGroupShape; + if( !maChildren.empty() ) try + { + xGroupShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" ), rxShapes, rShapeRect ); + Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW ); + maChildren.convertAndInsert( rDrawing, xChildShapes, &rShapeRect ); + // no child shape has been created - delete the group shape + if( !xChildShapes->hasElements() ) + { + rxShapes->remove( xGroupShape ); + xGroupShape.clear(); + } + } + catch( Exception& ) + { + } + return xGroupShape; } // ============================================================================ -- cgit From 656c73c2e4138f110f1b08f60482ae66f8f843ef Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 7 Jan 2011 08:37:24 +0100 Subject: dba34c: #i108590# convert number to date --- .../pentaho/layoutprocessor/FormatValueUtility.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index fc1baaa8c9a3..707c2de1c8ab 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -29,6 +29,7 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; +import java.math.BigDecimal; import java.sql.Time; @@ -46,7 +47,6 @@ import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil; - /** * Creation-Date: 06.06.2007, 17:03:30 * @@ -125,18 +125,31 @@ public class FormatValueUtility } else if (value instanceof java.sql.Date) { - if ( "float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + if ("float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); } else + { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + } } else if (value instanceof Date) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float"); variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); } + else if (value instanceof BigDecimal) + { + if ("date".equals(valueType)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); + } + } else if (value instanceof Number) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); -- cgit From b06a3287f38af15af2172e20f2ad29a0d12cd8ff Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 7 Jan 2011 10:03:01 +0100 Subject: dba34c: #i116032# we have to recalc the bounding rect --- reportdesign/source/ui/report/ReportSection.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 04222d6e2f1e..6aa29551bcbf 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -544,22 +544,22 @@ void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) else { uno::Reference xReportDefinition = m_xSection->getReportDefinition(); + const sal_Int32 nLeftMargin = getStyleProperty(xReportDefinition,PROPERTY_LEFTMARGIN); + const sal_Int32 nRightMargin = getStyleProperty(xReportDefinition,PROPERTY_RIGHTMARGIN); + const sal_Int32 nPaperWidth = getStyleProperty(xReportDefinition,PROPERTY_PAPERSIZE).Width; + if ( _rEvent.PropertyName == PROPERTY_LEFTMARGIN ) { - const sal_Int32 nLeftMargin = getStyleProperty(xReportDefinition,PROPERTY_LEFTMARGIN); m_pPage->SetLftBorder(nLeftMargin); } else if ( _rEvent.PropertyName == PROPERTY_RIGHTMARGIN ) { - const sal_Int32 nRightMargin = getStyleProperty(xReportDefinition,PROPERTY_RIGHTMARGIN); m_pPage->SetRgtBorder(nRightMargin); } try { - const sal_Int32 nLeftMargin = getStyleProperty(xReportDefinition,PROPERTY_LEFTMARGIN); - const sal_Int32 nRightMargin = getStyleProperty(xReportDefinition,PROPERTY_RIGHTMARGIN); - const sal_Int32 nPaperWidth = getStyleProperty(xReportDefinition,PROPERTY_PAPERSIZE).Width; + sal_Int32 nRightBorder = nPaperWidth - nRightMargin; const sal_Int32 nCount = m_xSection->getCount(); for (sal_Int32 i = 0; i < nCount; ++i) { @@ -578,9 +578,9 @@ void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) aPos.X = nLeftMargin; bChanged = true; } - if ( (aPos.X + aSize.Width) > (nPaperWidth - nRightMargin) ) + if ( (aPos.X + aSize.Width) > nRightBorder ) { - aPos.X = nPaperWidth - nRightMargin - aSize.Width; + aPos.X = nRightBorder - aSize.Width; if ( aPos.X < nLeftMargin ) { aSize.Width += aPos.X - nLeftMargin; @@ -603,6 +603,8 @@ void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) aRet.setWidth(aRet.getWidth() + 1); if ( m_xSection.is() && (static_cast(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) ) m_xSection->setHeight(aRet.getHeight() + aRet.Top()); + + pObject->RecalcBoundRect(); } pBase->StartListening(); } -- cgit From f9a2b2913692fa1d65200f53c90e77b0bd134445 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Sat, 8 Jan 2011 12:55:26 +0100 Subject: dr78: oox - BIFF3-BIFF5 arcs and polygons, line and fill formatting --- oox/inc/oox/xls/drawingmanager.hxx | 77 +++++- oox/source/drawingml/lineproperties.cxx | 26 +- oox/source/token/properties.txt | 4 + oox/source/xls/drawingmanager.cxx | 472 ++++++++++++++++++++++++++++++-- oox/source/xls/worksheethelper.cxx | 2 - 5 files changed, 535 insertions(+), 46 deletions(-) diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx index 75ccb05da117..0e5610d05d24 100755 --- a/oox/inc/oox/xls/drawingmanager.hxx +++ b/oox/inc/oox/xls/drawingmanager.hxx @@ -53,12 +53,10 @@ struct BiffObjLineModel sal_uInt8 mnColorIdx; /// Index into color palette. sal_uInt8 mnStyle; /// Line dash style. sal_uInt8 mnWidth; /// Line width. - sal_uInt8 mnAuto; /// Automatic line flag. + bool mbAuto; /// True = automatic line format. explicit BiffObjLineModel(); - /** Returns true, if the line formatting is set to automatic. */ - bool isAuto() const; /** Returns true, if the line formatting is visible (automatic or explicit). */ bool isVisible() const; }; @@ -71,12 +69,10 @@ struct BiffObjFillModel sal_uInt8 mnBackColorIdx; /// Index to color palette for background color. sal_uInt8 mnPattColorIdx; /// Index to color palette for pattern foreground color. sal_uInt8 mnPattern; /// Fill pattern. - sal_uInt8 mnAuto; /// Automatic fill flag. + bool mbAuto; /// True = automatic fill format. explicit BiffObjFillModel(); - /** Returns true, if the fill formatting is set to automatic. */ - bool isAuto() const; /** Returns true, if the fill formatting is visible (automatic or explicit). */ bool isFilled() const; }; @@ -204,6 +200,13 @@ protected: /** Reads the contents of the ftMacro sub structure in an OBJ record. */ void readMacroBiff8( BiffInputStream& rStrm ); + /** Converts the passed line formatting to the passed property map. */ + void convertLineProperties( PropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const; + /** Converts the passed fill formatting to the passed property map. */ + void convertFillProperties( PropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const; + /** Converts the passed frame flags to the passed property map. */ + void convertFrameProperties( PropertyMap& rPropMap, sal_uInt16 nFrameFlags ) const; + /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); /** Derived classes read the contents of the a BIFF4 OBJ record from the passed stream. */ @@ -336,6 +339,9 @@ protected: /** Reads the fill model, the line model, and frame flags. */ void readFrameData( BiffInputStream& rStrm ); + /** Converts fill formatting, line formatting, and frame style. */ + void convertRectProperties( PropertyMap& rPropMap ) const; + /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ @@ -371,6 +377,65 @@ protected: const ::com::sun::star::awt::Rectangle& rShapeRect ) const; }; +// ============================================================================ + +/** A simple arc object. */ +class BiffArcObject : public BiffDrawingObjectBase +{ +public: + explicit BiffArcObject( const WorksheetHelper& rHelper ); + +protected: + /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ + virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + +protected: + BiffObjFillModel maFillModel; /// Fill formatting. + BiffObjLineModel maLineModel; /// Line formatting. + sal_uInt8 mnQuadrant; /// Visible quadrant of the circle. +}; + +// ============================================================================ + +/** A simple polygon object. */ +class BiffPolygonObject : public BiffRectObject +{ +public: + explicit BiffPolygonObject( const WorksheetHelper& rHelper ); + +protected: + /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */ + virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); + /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */ + virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ); + + /** Creates the corresponding XShape and insert it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( BiffDrawingBase& rDrawing, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + +private: + /** Reads the COORDLIST record following the OBJ record. */ + void importCoordList( BiffInputStream& rStrm ); + +protected: + typedef ::std::vector< ::com::sun::star::awt::Point > PointVector; + PointVector maCoords; /// Coordinates relative to bounding rectangle. + sal_uInt16 mnPolyFlags; /// Additional flags. + sal_uInt16 mnPointCount; /// Polygon point count. +}; + // ============================================================================ // BIFF drawing page // ============================================================================ diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 9f23cf466d30..a0836612fafb 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -251,9 +251,9 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& case OOX_ARROWSIZE_MEDIUM: fArrowWidth = (bIsArrow ? 4.5 : 3.0); break; case OOX_ARROWSIZE_LARGE: fArrowWidth = (bIsArrow ? 6.0 : 5.0); break; } - // set arrow width relative to line width (convert line width from EMUs to 1/100 mm) - sal_Int32 nApiLineWidth = ::std::max< sal_Int32 >( GetCoordinate( nLineWidth ), 70 ); - nMarkerWidth = static_cast< sal_Int32 >( fArrowWidth * nApiLineWidth ); + // set arrow width relative to line width + sal_Int32 nBaseLineWidth = ::std::max< sal_Int32 >( nLineWidth, 70 ); + nMarkerWidth = static_cast< sal_Int32 >( fArrowWidth * nBaseLineWidth ); // test if the arrow already exists, do not create it again in this case if( !rPropIds.mbNamedLineMarker || !rModelObjHelper.hasLineMarker( aMarkerName ) ) @@ -403,6 +403,9 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM // line style (our core only supports none and solid) LineStyle eLineStyle = (maLineFill.moFillType.get() == XML_noFill) ? LineStyle_NONE : LineStyle_SOLID; + // convert line width from EMUs to 1/100mm + sal_Int32 nLineWidth = convertEmuToHmm( moLineWidth.get( 0 ) ); + // create line dash from preset dash token (not for invisible line) if( (eLineStyle != LineStyle_NONE) && (moPresetDash.differsFrom( XML_solid ) || (!moPresetDash && !maCustomDash.empty())) ) { @@ -416,10 +419,10 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM lclConvertCustomDash( aLineDash, maCustomDash ); // convert relative dash/dot length to absolute length - sal_Int32 nLineWidth = GetCoordinate( moLineWidth.get( 103500 ) ); - aLineDash.DotLen *= nLineWidth; - aLineDash.DashLen *= nLineWidth; - aLineDash.Distance *= nLineWidth; + sal_Int32 nBaseLineWidth = ::std::max< sal_Int32 >( nLineWidth, 35 ); + aLineDash.DotLen *= nBaseLineWidth; + aLineDash.DashLen *= nBaseLineWidth; + aLineDash.Distance *= nBaseLineWidth; if( rPropIds.mbNamedLineDash ) { @@ -444,9 +447,8 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM if( moLineJoint.has() ) rPropMap.setProperty( rPropIds[ LineJointId ], lclGetLineJoint( moLineJoint.get() ) ); - // convert line width from EMUs to 1/100 mm - if( moLineWidth.has() ) - rPropMap.setProperty( rPropIds[ LineWidthId ], GetCoordinate( moLineWidth.get() ) ); + // line width in 1/100mm + rPropMap.setProperty( rPropIds[ LineWidthId ], nLineWidth ); // line color and transparence Color aLineColor = maLineFill.getBestSolidColor(); @@ -458,8 +460,8 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM } // line markers - lclPushMarkerProperties( rPropMap, maStartArrow, rModelObjHelper, rPropIds, moLineWidth.get( 0 ), false ); - lclPushMarkerProperties( rPropMap, maEndArrow, rModelObjHelper, rPropIds, moLineWidth.get( 0 ), true ); + lclPushMarkerProperties( rPropMap, maStartArrow, rModelObjHelper, rPropIds, nLineWidth, false ); + lclPushMarkerProperties( rPropMap, maEndArrow, rModelObjHelper, rPropIds, nLineWidth, true ); } } diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index ba51c3577a8e..2850d422e234 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -76,6 +76,9 @@ CharUnderlineHasColor CharWeight CharWeightAsian CharWeightComplex +CircleEndAngle +CircleKind +CircleStartAngle CodeName Color ColumnGrand @@ -301,6 +304,7 @@ PercentageNumberFormat PersistName Perspective PolyPolygon +PolygonKind Position PositionBottom PositionLeft diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index d9a58eafb9d8..e1607e99e6c6 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -28,9 +28,18 @@ #include "oox/xls/drawingmanager.hxx" #include +#include +#include +#include #include +#include "oox/core/filterbase.hxx" +#include "oox/drawingml/lineproperties.hxx" +#include "oox/helper/propertymap.hxx" +#include "oox/helper/propertyset.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/unitconverter.hxx" +#include "properties.hxx" +#include "tokens.hxx" namespace oox { namespace xls { @@ -115,6 +124,13 @@ const sal_uInt8 BIFF_OBJ_LINE_TR = 1; const sal_uInt8 BIFF_OBJ_LINE_BR = 2; const sal_uInt8 BIFF_OBJ_LINE_BL = 3; +const sal_uInt8 BIFF_OBJ_ARC_TR = 0; +const sal_uInt8 BIFF_OBJ_ARC_TL = 1; +const sal_uInt8 BIFF_OBJ_ARC_BL = 2; +const sal_uInt8 BIFF_OBJ_ARC_BR = 3; + +const sal_uInt16 BIFF_OBJ_POLY_CLOSED = 0x0100; + // fill formatting ------------------------------------------------------------ const sal_uInt8 BIFF_OBJ_FILL_AUTOCOLOR = 65; @@ -170,23 +186,21 @@ BiffObjLineModel::BiffObjLineModel() : mnColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ), mnStyle( BIFF_OBJ_LINE_SOLID ), mnWidth( BIFF_OBJ_LINE_HAIR ), - mnAuto( BIFF_OBJ_LINE_AUTO ) -{ -} - -bool BiffObjLineModel::isAuto() const + mbAuto( true ) { - return getFlag( mnAuto, BIFF_OBJ_LINE_AUTO ); } bool BiffObjLineModel::isVisible() const { - return isAuto() || (mnStyle != BIFF_OBJ_LINE_NONE); + return mbAuto || (mnStyle != BIFF_OBJ_LINE_NONE); } BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjLineModel& rModel ) { - return rStrm >> rModel.mnColorIdx >> rModel.mnStyle >> rModel.mnWidth >> rModel.mnAuto; + sal_uInt8 nFlags; + rStrm >> rModel.mnColorIdx >> rModel.mnStyle >> rModel.mnWidth >> nFlags; + rModel.mbAuto = getFlag( nFlags, BIFF_OBJ_LINE_AUTO ); + return rStrm; } // ============================================================================ @@ -195,23 +209,21 @@ BiffObjFillModel::BiffObjFillModel() : mnBackColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ), mnPattColorIdx( BIFF_OBJ_FILL_AUTOCOLOR ), mnPattern( BIFF_OBJ_PATT_SOLID ), - mnAuto( BIFF_OBJ_FILL_AUTO ) + mbAuto( true ) { } -bool BiffObjFillModel::isAuto() const -{ - return getFlag( mnAuto, BIFF_OBJ_FILL_AUTO ); -} - bool BiffObjFillModel::isFilled() const { - return isAuto() || (mnPattern != BIFF_OBJ_PATT_NONE); + return mbAuto || (mnPattern != BIFF_OBJ_PATT_NONE); } BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjFillModel& rModel ) { - return rStrm >> rModel.mnBackColorIdx >> rModel.mnPattColorIdx >> rModel.mnPattern >> rModel.mnAuto; + sal_uInt8 nFlags; + rStrm >> rModel.mnBackColorIdx >> rModel.mnPattColorIdx >> rModel.mnPattern >> nFlags; + rModel.mbAuto = getFlag( nFlags, BIFF_OBJ_FILL_AUTO ); + return rStrm; } // ============================================================================ @@ -335,15 +347,17 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new BiffArcObject( rHelper ) ); break; #if 0 - case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; #endif default: +#if 0 OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff3 - unknown object type" ); +#endif xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); } } @@ -367,16 +381,18 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new BiffArcObject( rHelper ) ); break; + case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new BiffPolygonObject( rHelper ) ); break; #if 0 - case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; - case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new XclImpPolygonObj( rHelper ) ); break; #endif default: +#if 0 OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff4 - unknown object type" ); +#endif xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); } } @@ -399,14 +415,14 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() case BIFF_OBJTYPE_GROUP: xDrawingObj.reset( new BiffGroupObject( rHelper ) ); break; case BIFF_OBJTYPE_LINE: xDrawingObj.reset( new BiffLineObject( rHelper ) ); break; case BIFF_OBJTYPE_RECTANGLE: xDrawingObj.reset( new BiffRectObject( rHelper ) ); break; - case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; + case BIFF_OBJTYPE_OVAL: xDrawingObj.reset( new BiffOvalObject( rHelper ) ); break; + case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new BiffArcObject( rHelper ) ); break; + case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new BiffPolygonObject( rHelper ) ); break; #if 0 - case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpArcObj( rHelper ) ); break; case BIFF_OBJTYPE_CHART: xDrawingObj.reset( new XclImpChartObj( rHelper ) ); break; case BIFF_OBJTYPE_TEXT: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); break; case BIFF_OBJTYPE_BUTTON: xDrawingObj.reset( new XclImpButtonObj( rHelper ) ); break; case BIFF_OBJTYPE_PICTURE: xDrawingObj.reset( new XclImpPictureObj( rHelper ) ); break; - case BIFF_OBJTYPE_POLYGON: xDrawingObj.reset( new XclImpPolygonObj( rHelper ) ); break; case BIFF_OBJTYPE_CHECKBOX: xDrawingObj.reset( new XclImpCheckBoxObj( rHelper ) ); break; case BIFF_OBJTYPE_OPTIONBUTTON: xDrawingObj.reset( new XclImpOptionButtonObj( rHelper ) ); break; case BIFF_OBJTYPE_EDIT: xDrawingObj.reset( new XclImpEditObj( rHelper ) ); break; @@ -419,7 +435,9 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() case BIFF_OBJTYPE_DROPDOWN: xDrawingObj.reset( new XclImpDropDownObj( rHelper ) ); break; #endif default: +#if 0 OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff5 - unknown object type" ); +#endif xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); } } @@ -447,7 +465,7 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() case BIFF_OBJTYPE_ARC: xDrawingObj.reset( new XclImpTextObj( rHelper ) ); // lines and arcs may be 2-dimensional - xDrawingObj->SetAreaObj( false ); + xDrawingObj->setAreaObj( false ); break; // in BIFF8, all simple objects support text @@ -479,7 +497,9 @@ BiffDrawingObjectBase::~BiffDrawingObjectBase() #endif default: +#if 0 OSL_ENSURE( false, "BiffDrawingObjectBase::importObjBiff8 - unknown object type" ); +#endif xDrawingObj.reset( new BiffPlaceholderObject( rHelper ) ); } } @@ -574,6 +594,210 @@ void BiffDrawingObjectBase::readMacroBiff8( BiffInputStream& rStrm ) } } +void BiffDrawingObjectBase::convertLineProperties( PropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows ) const +{ + if( rLineModel.mbAuto ) + { + BiffObjLineModel aAutoModel; + aAutoModel.mbAuto = false; + convertLineProperties( rPropMap, aAutoModel, nArrows ); + return; + } + + /* Convert line formatting to DrawingML line formatting and let the + DrawingML code do the hard work. */ + LineProperties aLineProps; + + if( rLineModel.mnStyle == BIFF_OBJ_LINE_NONE ) + { + aLineProps.maLineFill.moFillType = XML_noFill; + } + else + { + aLineProps.maLineFill.moFillType = XML_solidFill; + aLineProps.maLineFill.maFillColor.setPaletteClr( rLineModel.mnColorIdx ); + aLineProps.moLineCompound = XML_sng; + aLineProps.moLineCap = XML_flat; + aLineProps.moLineJoint = XML_round; + + // line width: use 0.35 mm per BIFF line width step + sal_Int32 nLineWidth = 0; + switch( rLineModel.mnWidth ) + { + default: + case BIFF_OBJ_LINE_HAIR: nLineWidth = 0; break; + case BIFF_OBJ_LINE_THIN: nLineWidth = 20; break; + case BIFF_OBJ_LINE_MEDIUM: nLineWidth = 40; break; + case BIFF_OBJ_LINE_THICK: nLineWidth = 60; break; + } + aLineProps.moLineWidth = getLimitedValue< sal_Int32, sal_Int64 >( convertHmmToEmu( nLineWidth ), 0, SAL_MAX_INT32 ); + + // dash style and transparency + switch( rLineModel.mnStyle ) + { + default: + case BIFF_OBJ_LINE_SOLID: + aLineProps.moPresetDash = XML_solid; + break; + case BIFF_OBJ_LINE_DASH: + aLineProps.moPresetDash = XML_lgDash; + break; + case BIFF_OBJ_LINE_DOT: + aLineProps.moPresetDash = XML_dot; + break; + case BIFF_OBJ_LINE_DASHDOT: + aLineProps.moPresetDash = XML_lgDashDot; + break; + case BIFF_OBJ_LINE_DASHDOTDOT: + aLineProps.moPresetDash = XML_lgDashDotDot; + break; + case BIFF_OBJ_LINE_MEDTRANS: + aLineProps.moPresetDash = XML_solid; + aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 50 * PER_PERCENT ); + break; + case BIFF_OBJ_LINE_DARKTRANS: + aLineProps.moPresetDash = XML_solid; + aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 75 * PER_PERCENT ); + break; + case BIFF_OBJ_LINE_LIGHTTRANS: + aLineProps.moPresetDash = XML_solid; + aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 25 * PER_PERCENT ); + break; + } + + // line ends + bool bLineStart = false; + bool bLineEnd = false; + bool bFilled = false; + switch( extractValue< sal_uInt8 >( nArrows, 0, 4 ) ) + { + case BIFF_OBJ_ARROW_OPEN: bLineStart = false; bLineEnd = true; bFilled = false; break; + case BIFF_OBJ_ARROW_OPENBOTH: bLineStart = true; bLineEnd = true; bFilled = false; break; + case BIFF_OBJ_ARROW_FILLED: bLineStart = false; bLineEnd = true; bFilled = true; break; + case BIFF_OBJ_ARROW_FILLEDBOTH: bLineStart = true; bLineEnd = true; bFilled = true; break; + } + if( bLineStart || bLineEnd ) + { + // arrow type (open or closed) + sal_Int32 nArrowType = bFilled ? XML_triangle : XML_arrow; + aLineProps.maStartArrow.moArrowType = bLineStart ? nArrowType : XML_none; + aLineProps.maEndArrow.moArrowType = bLineEnd ? nArrowType : XML_none; + + // arrow width + sal_Int32 nArrowWidth = XML_med; + switch( extractValue< sal_uInt8 >( nArrows, 4, 4 ) ) + { + case BIFF_OBJ_ARROW_NARROW: nArrowWidth = XML_sm; break; + case BIFF_OBJ_ARROW_MEDIUM: nArrowWidth = XML_med; break; + case BIFF_OBJ_ARROW_WIDE: nArrowWidth = XML_lg; break; + } + aLineProps.maStartArrow.moArrowWidth = aLineProps.maEndArrow.moArrowWidth = nArrowWidth; + + // arrow length + sal_Int32 nArrowLength = XML_med; + switch( extractValue< sal_uInt8 >( nArrows, 8, 4 ) ) + { + case BIFF_OBJ_ARROW_NARROW: nArrowLength = XML_sm; break; + case BIFF_OBJ_ARROW_MEDIUM: nArrowLength = XML_med; break; + case BIFF_OBJ_ARROW_WIDE: nArrowLength = XML_lg; break; + } + aLineProps.maStartArrow.moArrowLength = aLineProps.maEndArrow.moArrowLength = nArrowLength; + } + } + + aLineProps.pushToPropMap( rPropMap, getBaseFilter().getModelObjectHelper(), getBaseFilter().getGraphicHelper() ); +} + +void BiffDrawingObjectBase::convertFillProperties( PropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const +{ + if( rFillModel.mbAuto ) + { + BiffObjFillModel aAutoModel; + aAutoModel.mbAuto = false; + convertFillProperties( rPropMap, aAutoModel ); + return; + } + + /* Convert fill formatting to DrawingML fill formatting and let the + DrawingML code do the hard work. */ + FillProperties aFillProps; + + if( rFillModel.mnPattern == BIFF_OBJ_PATT_NONE ) + { + aFillProps.moFillType = XML_noFill; + } + else + { + const sal_Int32 spnPatternPresets[] = { + XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_pct50, XML_pct50, XML_pct25, + XML_dkHorz, XML_dkVert, XML_dkDnDiag, XML_dkUpDiag, XML_smCheck, XML_trellis, + XML_ltHorz, XML_ltVert, XML_ltDnDiag, XML_ltUpDiag, XML_smGrid, XML_diagCross, + XML_pct20, XML_pct10 }; + sal_Int32 nPatternPreset = STATIC_ARRAY_SELECT( spnPatternPresets, rFillModel.mnPattern, XML_TOKEN_INVALID ); + if( nPatternPreset == XML_TOKEN_INVALID ) + { + aFillProps.moFillType = XML_solidFill; + aFillProps.maFillColor.setPaletteClr( rFillModel.mnPattColorIdx ); + } + else + { + aFillProps.moFillType = XML_pattFill; + aFillProps.maPatternProps.maPattFgColor.setPaletteClr( rFillModel.mnPattColorIdx ); + aFillProps.maPatternProps.maPattBgColor.setPaletteClr( rFillModel.mnBackColorIdx ); + aFillProps.maPatternProps.moPattPreset = nPatternPreset; + } +#if 0 + static const sal_uInt8 sppnPatterns[][ 8 ] = + { + { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 }, + { 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD }, + { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 }, + { 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00 }, + { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC }, + { 0x33, 0x66, 0xCC, 0x99, 0x33, 0x66, 0xCC, 0x99 }, + { 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99 }, + { 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33 }, + { 0xCC, 0xFF, 0x33, 0xFF, 0xCC, 0xFF, 0x33, 0xFF }, + { 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 }, + { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, + { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, + { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, + { 0xFF, 0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11 }, + { 0xAA, 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11 }, + { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 }, + { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 } + }; + const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_ARRAY_SIZE( sppnPatterns ) ) ]; + // create 2-colored 8x8 DIB + SvMemoryStream aMemStrm; +// { 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00 } + aMemStrm << sal_uInt32( 12 ) << sal_Int16( 8 ) << sal_Int16( 8 ) << sal_uInt16( 1 ) << sal_uInt16( 1 ); + aMemStrm << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF ); + aMemStrm << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 ); + for( size_t nIdx = 0; nIdx < 8; ++nIdx ) + aMemStrm << sal_uInt32( pnPattern[ nIdx ] ); // 32-bit little-endian + aMemStrm.Seek( STREAM_SEEK_TO_BEGIN ); + Bitmap aBitmap; + aBitmap.Read( aMemStrm, FALSE ); + XOBitmap aXOBitmap( aBitmap ); + aXOBitmap.Bitmap2Array(); + aXOBitmap.SetBitmapType( XBITMAP_8X8 ); + if( aXOBitmap.GetBackgroundColor().GetColor() == COL_BLACK ) + ::std::swap( aPattColor, aBackColor ); + aXOBitmap.SetPixelColor( aPattColor ); + aXOBitmap.SetBackgroundColor( aBackColor ); + rSdrObj.SetMergedItem( XFillStyleItem( XFILL_BITMAP ) ); + rSdrObj.SetMergedItem( XFillBitmapItem( EMPTY_STRING, aXOBitmap ) ); +#endif + } + + aFillProps.pushToPropMap( rPropMap, getBaseFilter().getModelObjectHelper(), getBaseFilter().getGraphicHelper() ); +} + +void BiffDrawingObjectBase::convertFrameProperties( PropertyMap& /*rPropMap*/, sal_uInt16 /*nFrameFlags*/ ) const +{ +} + void BiffDrawingObjectBase::implReadObjBiff3( BiffInputStream& /*rStrm*/, sal_uInt16 /*nMacroSize*/ ) { } @@ -820,7 +1044,33 @@ void BiffLineObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameL Reference< XShape > BiffLineObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.LineShape" ), rxShapes, rShapeRect ); + PropertyMap aPropMap; + convertLineProperties( aPropMap, maLineModel, mnArrows ); + + // create the line polygon + PointSequenceSequence aPoints( 1 ); + aPoints[ 0 ].realloc( 2 ); + Point& rBeg = aPoints[ 0 ][ 0 ]; + Point& rEnd = aPoints[ 0 ][ 1 ]; + sal_Int32 nL = rShapeRect.X; + sal_Int32 nT = rShapeRect.Y; + sal_Int32 nR = rShapeRect.X + ::std::max< sal_Int32 >( rShapeRect.Width - 1, 0 ); + sal_Int32 nB = rShapeRect.Y + ::std::max< sal_Int32 >( rShapeRect.Height - 1, 0 ); + switch( mnStartPoint ) + { + default: + case BIFF_OBJ_LINE_TL: rBeg.X = nL; rBeg.Y = nT; rEnd.X = nR; rEnd.Y = nB; break; + case BIFF_OBJ_LINE_TR: rBeg.X = nR; rBeg.Y = nT; rEnd.X = nL; rEnd.Y = nB; break; + case BIFF_OBJ_LINE_BR: rBeg.X = nR; rBeg.Y = nB; rEnd.X = nL; rEnd.Y = nT; break; + case BIFF_OBJ_LINE_BL: rBeg.X = nL; rBeg.Y = nB; rEnd.X = nR; rEnd.Y = nT; break; + } + aPropMap.setProperty( PROP_PolyPolygon, aPoints ); + aPropMap.setProperty( PROP_PolygonKind, PolygonKind_LINE ); + + // create the shape + Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.LineShape" ), rxShapes, rShapeRect ); + PropertySet( xShape ).setProperties( aPropMap ); + return xShape; } // ============================================================================ @@ -837,6 +1087,13 @@ void BiffRectObject::readFrameData( BiffInputStream& rStrm ) rStrm >> maFillModel >> maLineModel >> mnFrameFlags; } +void BiffRectObject::convertRectProperties( PropertyMap& rPropMap ) const +{ + convertLineProperties( rPropMap, maLineModel ); + convertFillProperties( rPropMap, maFillModel ); + convertFrameProperties( rPropMap, mnFrameFlags ); +} + void BiffRectObject::implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) { readFrameData( rStrm ); @@ -859,7 +1116,12 @@ void BiffRectObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameL Reference< XShape > BiffRectObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.RectangleShape" ), rxShapes, rShapeRect ); + PropertyMap aPropMap; + convertRectProperties( aPropMap ); + + Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.RectangleShape" ), rxShapes, rShapeRect ); + PropertySet( xShape ).setProperties( aPropMap ); + return xShape; } // ============================================================================ @@ -872,7 +1134,165 @@ BiffOvalObject::BiffOvalObject( const WorksheetHelper& rHelper ) : Reference< XShape > BiffOvalObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - return rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.EllipseShape" ), rxShapes, rShapeRect ); + PropertyMap aPropMap; + convertRectProperties( aPropMap ); + + Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.EllipseShape" ), rxShapes, rShapeRect ); + PropertySet( xShape ).setProperties( aPropMap ); + return xShape; +} + +// ============================================================================ + +BiffArcObject::BiffArcObject( const WorksheetHelper& rHelper ) : + BiffDrawingObjectBase( rHelper ), + mnQuadrant( BIFF_OBJ_ARC_TR ) +{ + setAreaObj( false ); // arc may be 2-dimensional +} + +void BiffArcObject::implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm >> maFillModel >> maLineModel >> mnQuadrant; + rStrm.skip( 1 ); + readMacroBiff3( rStrm, nMacroSize ); +} + +void BiffArcObject::implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + rStrm >> maFillModel >> maLineModel >> mnQuadrant; + rStrm.skip( 1 ); + readMacroBiff4( rStrm, nMacroSize ); +} + +void BiffArcObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) +{ + rStrm >> maFillModel >> maLineModel >> mnQuadrant; + rStrm.skip( 1 ); + readNameBiff5( rStrm, nNameLen ); + readMacroBiff5( rStrm, nMacroSize ); +} + +Reference< XShape > BiffArcObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + PropertyMap aPropMap; + convertLineProperties( aPropMap, maLineModel ); + convertFillProperties( aPropMap, maFillModel ); + + /* Simulate arc objects with ellipse sections. While the original arc + object uses the entire object rectangle, only one quarter of the + ellipse shape will be visible. Thus, the size of the ellipse shape + needs to be extended and its position adjusted according to the visible + quadrant. */ + Rectangle aNewRect( rShapeRect.X, rShapeRect.Y, rShapeRect.Width * 2, rShapeRect.Height * 2 ); + long nStartAngle = 0; + switch( mnQuadrant ) + { + default: + case BIFF_OBJ_ARC_TR: nStartAngle = 0; aNewRect.X -= rShapeRect.Width; break; + case BIFF_OBJ_ARC_TL: nStartAngle = 9000; break; + case BIFF_OBJ_ARC_BL: nStartAngle = 18000; aNewRect.Y -= rShapeRect.Height; break; + case BIFF_OBJ_ARC_BR: nStartAngle = 27000; aNewRect.X -= rShapeRect.Width; aNewRect.Y -= rShapeRect.Height; break; + } + long nEndAngle = (nStartAngle + 9000) % 36000; + aPropMap.setProperty( PROP_CircleKind, maFillModel.isFilled() ? CircleKind_SECTION : CircleKind_ARC ); + aPropMap.setProperty( PROP_CircleStartAngle, nStartAngle ); + aPropMap.setProperty( PROP_CircleEndAngle, nEndAngle ); + + // create the shape + Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.EllipseShape" ), rxShapes, aNewRect ); + PropertySet( xShape ).setProperties( aPropMap ); + return xShape; +} + +// ============================================================================ + +BiffPolygonObject::BiffPolygonObject( const WorksheetHelper& rHelper ) : + BiffRectObject( rHelper ), + mnPolyFlags( 0 ), + mnPointCount( 0 ) +{ + setAreaObj( false ); // polygon may be 2-dimensional +} + +void BiffPolygonObject::implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize ) +{ + readFrameData( rStrm ); + rStrm >> mnPolyFlags; + rStrm.skip( 10 ); + rStrm >> mnPointCount; + rStrm.skip( 8 ); + readMacroBiff4( rStrm, nMacroSize ); + importCoordList( rStrm ); +} + +void BiffPolygonObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize ) +{ + readFrameData( rStrm ); + rStrm >> mnPolyFlags; + rStrm.skip( 10 ); + rStrm >> mnPointCount; + rStrm.skip( 8 ); + readNameBiff5( rStrm, nNameLen ); + readMacroBiff5( rStrm, nMacroSize ); + importCoordList( rStrm ); +} + +namespace { + +Point lclGetPolyPoint( const Rectangle& rAnchorRect, const Point& rPoint ) +{ + // polygon coordinates are given in 1/16384 of shape size + return Point( + rAnchorRect.X + static_cast< sal_Int32 >( rAnchorRect.Width * getLimitedValue< double >( static_cast< double >( rPoint.X ) / 16384.0, 0.0, 1.0 ) + 0.5 ), + rAnchorRect.Y + static_cast< sal_Int32 >( rAnchorRect.Height * getLimitedValue< double >( static_cast< double >( rPoint.Y ) / 16384.0, 0.0, 1.0 ) + 0.5 ) ); +} + +} // namespace + +Reference< XShape > BiffPolygonObject::implConvertAndInsert( BiffDrawingBase& rDrawing, + const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +{ + Reference< XShape > xShape; + if( maCoords.size() >= 2 ) + { + PropertyMap aPropMap; + convertRectProperties( aPropMap ); + + // create the polygon + PointVector aPolygon; + for( PointVector::const_iterator aIt = maCoords.begin(), aEnd = maCoords.end(); aIt != aEnd; ++aIt ) + aPolygon.push_back( lclGetPolyPoint( rShapeRect, *aIt ) ); + // close polygon if specified + if( getFlag( mnPolyFlags, BIFF_OBJ_POLY_CLOSED ) && ((maCoords.front().X != maCoords.back().X) || (maCoords.front().Y != maCoords.back().Y)) ) + aPolygon.push_back( aPolygon.front() ); + PointSequenceSequence aPoints( 1 ); + aPoints[ 0 ] = ContainerHelper::vectorToSequence( aPolygon ); + aPropMap.setProperty( PROP_PolyPolygon, aPoints ); + + // create the shape + OUString aService = maFillModel.isFilled() ? + CREATE_OUSTRING( "com.sun.star.drawing.PolyPolygonShape" ) : + CREATE_OUSTRING( "com.sun.star.drawing.PolyLineShape" ); + xShape = rDrawing.createAndInsertXShape( aService, rxShapes, rShapeRect ); + PropertySet( xShape ).setProperties( aPropMap ); + } + return xShape; +} + +void BiffPolygonObject::importCoordList( BiffInputStream& rStrm ) +{ + if( (rStrm.getNextRecId() == BIFF_ID_COORDLIST) && rStrm.startNextRecord() ) + { + OSL_ENSURE( rStrm.getRemaining() / 4 == mnPointCount, "BiffPolygonObject::importCoordList - wrong polygon point count" ); + while( rStrm.getRemaining() >= 4 ) + { + sal_uInt16 nX, nY; + rStrm >> nX >> nY; + maCoords.push_back( Point( nX, nY ) ); + } + } } // ============================================================================ diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 626d3b962ceb..cbdb564ac7c5 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -162,8 +162,6 @@ struct ValueRangeComp inline bool operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return rRange.mnLast < nValue; } }; -typedef ::std::vector< ValueRange > ValueRangeVector; - // ---------------------------------------------------------------------------- class ValueRangeSet -- cgit From 1821b0fd528c51a2f8f963a67f2e48fe457f1f27 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 10 Jan 2011 13:41:20 +0100 Subject: dba34c: #i108415# handle structed filter handling --- connectivity/inc/connectivity/predicateinput.hxx | 8 ++ .../qa/connectivity/tools/CRMDatabase.java | 5 +- connectivity/source/commontools/predicateinput.cxx | 125 +++++++++++++++------ 3 files changed, 105 insertions(+), 33 deletions(-) diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx index 5041fd30c060..2f4dfbbd3146 100644 --- a/connectivity/inc/connectivity/predicateinput.hxx +++ b/connectivity/inc/connectivity/predicateinput.hxx @@ -104,6 +104,12 @@ namespace dbtools ::rtl::OUString* _pErrorMessage = NULL ) const; + ::rtl::OUString getPredicateValue( + const ::rtl::OUString& _sField + , const ::rtl::OUString& _rPredicateValue + , sal_Bool _bForStatementUse + , ::rtl::OUString* _pErrorMessage = NULL) const; + private: ::connectivity::OSQLParseNode* implPredicateTree( ::rtl::OUString& _rErrorMessage, @@ -116,6 +122,8 @@ namespace dbtools sal_Unicode& _rDecSep, sal_Unicode& _rThdSep ) const; + + ::rtl::OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const; }; //......................................................................... diff --git a/connectivity/qa/connectivity/tools/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java index a1b457884948..f9b6d52a8038 100644 --- a/connectivity/qa/connectivity/tools/CRMDatabase.java +++ b/connectivity/qa/connectivity/tools/CRMDatabase.java @@ -224,6 +224,7 @@ public class CRMDatabase // -------------------------------------------------------------------------------------------------------- private void validateUnparseable() { + /* // The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query) XSingleSelectQueryComposer composer; QueryDefinition unparseableQuery; @@ -253,6 +254,7 @@ public class CRMDatabase if ( !caughtExpected ) throw new RuntimeException( "Somebody improved the parser! This is bad :), since we need an unparsable query here!" ); + */ } // -------------------------------------------------------------------------------------------------------- @@ -284,9 +286,10 @@ public class CRMDatabase m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" ); m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false ); +/* m_database.getDataSource().createQuery( "unparseable", "SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false ); - +*/ validateUnparseable(); } } diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 73cb88b90dbf..9d088c903dcc 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -31,8 +31,10 @@ #include #include #include +#include #include #include +#include #include //......................................................................... @@ -325,54 +327,113 @@ namespace dbtools ::rtl::OUString sError; OSQLParseNode* pParseNode = implPredicateTree( sError, sValue, _rxField ); - if ( _pErrorMessage ) *_pErrorMessage = sError; + if ( _pErrorMessage ) + *_pErrorMessage = sError; - if ( pParseNode ) + sReturn = implParseNode(pParseNode,_bForStatementUse); + } + + return sReturn; + } + + ::rtl::OUString OPredicateInputController::getPredicateValue( + const ::rtl::OUString& _sField, const ::rtl::OUString& _rPredicateValue, sal_Bool _bForStatementUse, ::rtl::OUString* _pErrorMessage ) const + { + ::rtl::OUString sReturn = _rPredicateValue; + ::rtl::OUString sError; + ::rtl::OUString sField = _sField; + sal_Int32 nIndex = 0; + sField = sField.getToken(0,'(',nIndex); + if(nIndex == -1) + sField = _sField; + sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sField,&m_aParser.getContext()); + if ( nType == DataType::OTHER || !sField.getLength() ) + { + // first try the international version + ::rtl::OUString sSql; + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT * ")); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x WHERE ")); + sSql += sField; + sSql += _rPredicateValue; + ::std::auto_ptr pParseNode( const_cast< OSQLParser& >( m_aParser ).parseTree( sError, sSql, sal_True ) ); + nType = DataType::DOUBLE; + if ( pParseNode.get() ) { - OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec ); - if ( pOdbcSpec ) + OSQLParseNode* pColumnRef = pParseNode->getByRule(OSQLParseNode::column_ref); + if ( pColumnRef ) { - if ( _bForStatementUse ) - { - OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent(); - OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" ); - if ( pFuncSpecParent ) - pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); - } - else - { - pOdbcSpec->getChild(1)->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); - // sReturn = pOdbcSpec->getChild(1)->getTokenValue(); - } + } + } + } + + Reference xMeta = m_xConnection->getMetaData(); + parse::OParseColumn* pColumn = new parse::OParseColumn( sField, + ::rtl::OUString(), + ::rtl::OUString(), + ::rtl::OUString(), + ColumnValue::NULLABLE_UNKNOWN, + 0, + 0, + nType, + sal_False, + sal_False, + xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()); + Reference xColumn = pColumn; + pColumn->setFunction(sal_True); + pColumn->setRealName(sField); + + OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn ); + if ( _pErrorMessage ) + *_pErrorMessage = sError; + return pParseNode ? implParseNode(pParseNode,_bForStatementUse) : sReturn; + } + + ::rtl::OUString OPredicateInputController::implParseNode(OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const + { + ::rtl::OUString sReturn; + if ( pParseNode ) + { + ::std::auto_ptr pTemp(pParseNode); + OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec ); + if ( pOdbcSpec ) + { + if ( _bForStatementUse ) + { + OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent(); + OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" ); + if ( pFuncSpecParent ) + pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); } else { - if ( pParseNode->count() >= 3 ) + pOdbcSpec->getChild(1)->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); + // sReturn = pOdbcSpec->getChild(1)->getTokenValue(); + } + } + else + { + if ( pParseNode->count() >= 3 ) + { + OSQLParseNode* pValueNode = pParseNode->getChild(2); + OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" ); + if ( !_bForStatementUse ) { - OSQLParseNode* pValueNode = pParseNode->getChild(2); - OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" ); - if ( !_bForStatementUse ) - { - if ( SQL_NODE_STRING == pValueNode->getNodeType() ) - sReturn = pValueNode->getTokenValue(); - else - pValueNode->parseNodeToStr( - sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True - ); - } + if ( SQL_NODE_STRING == pValueNode->getNodeType() ) + sReturn = pValueNode->getTokenValue(); else pValueNode->parseNodeToStr( sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True ); } else - OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" ); + pValueNode->parseNodeToStr( + sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True + ); } - - delete pParseNode; + else + OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" ); } } - return sReturn; } //......................................................................... -- cgit From 897ade45672a36ffd278b1cb9ba21694c0ee45c7 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 10 Jan 2011 13:41:20 +0100 Subject: dba34c: #i108415# handle structed filter handling --- .../dbaccess/SingleSelectQueryComposer.java | 84 ++++++++++++---------- .../source/core/api/SingleSelectQueryComposer.cxx | 28 +++++--- .../source/core/inc/SingleSelectQueryComposer.hxx | 30 -------- 3 files changed, 65 insertions(+), 77 deletions(-) diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java index 89d107ed5bb1..4823f5d50e4c 100755 --- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java +++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java @@ -55,11 +55,12 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase { private XSingleSelectQueryComposer m_composer = null; - private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )" + - " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" + - " OR ( \"ID\" = '3' AND \"Postal\" = '6' AND \"Address\" = '7' )" + - " OR ( \"Address\" = '8' )" + - " OR ( \"Postal\" = '9' )"; + private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )" + + " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" + + " OR ( \"ID\" = 3 AND \"Postal\" = '6' AND \"Address\" = '7' )" + + " OR ( \"Address\" = '8' )" + + " OR ( \"Postal\" = '9' )" + + " OR ( NOW( ) = {D '2010-01-01' } )"; private final static String INNERPRODUCTSQUERY = "products (inner)"; // -------------------------------------------------------------------------------------------------------- @@ -135,15 +136,15 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase try { final String table = "SELECT * FROM \"customers\""; - m_composer.setCommand("customers",CommandType.TABLE); + m_composer.setCommand("customers", CommandType.TABLE); assertTrue("setCommand/getQuery TABLE inconsistent", m_composer.getQuery().equals(table)); m_database.getDatabase().getDataSource().createQuery("set command test", "SELECT * FROM \"orders for customer\" \"a\", \"customers\" \"b\" WHERE \"a\".\"Product Name\" = \"b\".\"Name\""); - m_composer.setCommand("set command test",CommandType.QUERY); + m_composer.setCommand("set command test", CommandType.QUERY); assertTrue("setCommand/getQuery QUERY inconsistent", m_composer.getQuery().equals(m_database.getDatabase().getDataSource().getQueryDefinition("set command test").getCommand())); final String sql = "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" = 'test'"; - m_composer.setCommand(sql,CommandType.COMMAND); + m_composer.setCommand(sql, CommandType.COMMAND); assertTrue("setCommand/getQuery COMMAND inconsistent", m_composer.getQuery().equals(sql)); } catch (Exception e) @@ -151,6 +152,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase fail("Exception caught: " + e); } } + /** tests accessing attributes of the composer (order, filter, group by, having) */ @Test @@ -161,6 +163,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase try { System.out.println("check setElementaryQuery"); + final String simpleQuery2 = "SELECT * FROM \"customers\" WHERE \"Name\" = 'oranges'"; m_composer.setElementaryQuery(simpleQuery2); assertTrue("setElementaryQuery/getQuery inconsistent", m_composer.getQuery().equals(simpleQuery2)); @@ -177,16 +180,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase final XIndexAccess orderColumns = m_composer.getOrderColumns(); assertTrue("Order columns doesn't exist: \"Address\"", - orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null); + orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null); final XIndexAccess groupColumns = m_composer.getGroupColumns(); assertTrue("Group columns doesn't exist: \"City\"", - groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null); + groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null); // XColumnsSupplier final XColumnsSupplier xSelectColumns = UnoRuntime.queryInterface(XColumnsSupplier.class, m_composer); assertTrue("no select columns, or wrong number of select columns", - xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6); + xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6); // structured filter m_composer.setQuery("SELECT \"ID\", \"Postal\", \"Address\" FROM \"customers\""); @@ -194,6 +197,11 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase final PropertyValue[][] aStructuredFilter = m_composer.getStructuredFilter(); m_composer.setFilter(""); m_composer.setStructuredFilter(aStructuredFilter); + if (!m_composer.getFilter().equals(COMPLEXFILTER)) + { + System.out.println(COMPLEXFILTER); + System.out.println(m_composer.getFilter()); + } assertTrue("Structured Filter not identical", m_composer.getFilter().equals(COMPLEXFILTER)); // structured having clause @@ -244,6 +252,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase final XIndexAccess parameters = suppParams.getParameters(); final String expectedParamNames[] = + { "cname", "Product Name" @@ -276,6 +285,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase m_composer.setQuery("SELECT * FROM \"customers\""); final Object initArgs[] = + { new NamedValue("AutomaticAddition", Boolean.valueOf(true)) }; @@ -288,8 +298,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR)); final XPropertySet column = UnoRuntime.queryInterface(XPropertySet.class, filter); - m_composer.appendFilterByColumn(column, true,SQLFilterOperator.LIKE); - assertTrue("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next()); + m_composer.appendFilterByColumn(column, true, SQLFilterOperator.LIKE); + assertTrue("At least one row should exist", m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next()); } catch (Exception e) @@ -333,16 +343,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase { // a simple case: WHERE clause simply is a combination of predicates knitted with AND String query = - "SELECT \"customers\".\"Name\", " + - "\"customers\".\"Address\", " + - "\"customers\".\"City\", " + - "\"customers\".\"Postal\", " + - "\"products\".\"Name\" " + - "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " + - "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " + - "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " + - "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " + - ") "; + "SELECT \"customers\".\"Name\", " + + "\"customers\".\"Address\", " + + "\"customers\".\"City\", " + + "\"customers\".\"Postal\", " + + "\"products\".\"Name\" " + + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " + + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " + + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " + + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " + + ") "; impl_testDisjunctiveNormalForm(query, new PropertyValue[][] { @@ -356,20 +366,20 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase // somewhat more challenging: One of the conjunction terms is a disjunction itself query = - "SELECT \"customers\".\"Name\", " + - "\"customers\".\"Address\", " + - "\"customers\".\"City\", " + - "\"customers\".\"Postal\", " + - "\"products\".\"Name\" " + - "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " + - "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " + - "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " + - "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " + - ") " + - "AND " + - "( \"products\".\"Name\" = 'Apples' " + - "OR \"products\".\"ID\" = 2 " + - ")"; + "SELECT \"customers\".\"Name\", " + + "\"customers\".\"Address\", " + + "\"customers\".\"City\", " + + "\"customers\".\"Postal\", " + + "\"products\".\"Name\" " + + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " + + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " + + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " + + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " + + ") " + + "AND " + + "( \"products\".\"Name\" = 'Apples' " + + "OR \"products\".\"ID\" = 2 " + + ")"; impl_testDisjunctiveNormalForm(query, new PropertyValue[][] { diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index fa67a3d8cfdb..f3b40ffe968e 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1243,16 +1244,12 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::rtl::OUString aValue; ::rtl::OUString aColumnName; - pCondition->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast( m_sDecimalSep.toChar() ) ); + pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast( m_sDecimalSep.toChar() ) ); pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast( m_sDecimalSep .toChar() ) ); - // don't display the column name - aValue = aValue.copy(aColumnName.getLength()); - aValue.trim(); - aItem.Name = getColumnName(pCondition->getChild(0),_rIterator); aItem.Value <<= aValue; - aItem.Handle = pCondition->getNodeType(); + aItem.Handle = getPredicateType(pCondition->getChild(1)); rFilter.push_back(aItem); } else // kann sich nur um einen Expr. Ausdruck handeln @@ -1269,7 +1266,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast( m_sDecimalSep.toChar() ) ); // Kriterium - aItem.Handle = pCondition->getChild(1)->getNodeType(); + aItem.Handle = getPredicateType(pCondition->getChild(1)); aValue = pCondition->getChild(1)->getTokenValue(); for(i=0;i< pRhs->count();i++) pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast( m_sDecimalSep.toChar() ) ); @@ -1514,7 +1511,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( // ----------------------------------------------------------------------------- namespace { - ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter ) + ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns) { ::rtl::OUStringBuffer sRet; const Sequence< PropertyValue >* pOrIter = filter.getConstArray(); @@ -1531,6 +1528,15 @@ namespace sRet.append(pAndIter->Name); ::rtl::OUString sValue; pAndIter->Value >>= sValue; + if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(pAndIter->Name) ) + { + Reference xColumn(i_xSelectColumns->getByName(pAndIter->Name),UNO_QUERY); + sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True); + } + else + { + sValue = i_aPredicateInputController.getPredicateValue(pAndIter->Name,sValue,sal_True); + } lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet); ++pAndIter; if ( pAndIter != pAndEnd ) @@ -1549,13 +1555,15 @@ namespace void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" ); - setFilter(lcl_getCondition(filter)); + OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); + setFilter(lcl_getCondition(filter,aPredicateInput,getColumns())); } // ----------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" ); - setHavingClause(lcl_getCondition(filter)); + OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); + setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns())); } // ----------------------------------------------------------------------------- void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t& _aSetFunctor,sal_Int32 filterOperator) diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx index 7c0d2ba4cea3..412fbb1c5231 100644 --- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx +++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx @@ -27,51 +27,21 @@ #ifndef DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX #define DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX -#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ #include -#endif -#ifndef _CPPUHELPER_IMPLBASE5_HXX_ #include -#endif -#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ #include -#endif -#ifndef _CONNECTIVITY_SQLPARSE_HXX #include -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ #include -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include -#endif -#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_ #include -#endif -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX #include -#endif #include -- cgit From a4b723613a86993dc5cce0195576380f28b8fde0 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 10 Jan 2011 13:41:20 +0100 Subject: dba34c: #i108415# handle structed filter handling --- .../com/sun/star/wizards/db/CommandMetaData.java | 877 ++++++++++----------- wizards/com/sun/star/wizards/db/CommandName.java | 4 +- wizards/com/sun/star/wizards/db/QueryMetaData.java | 31 +- .../com/sun/star/wizards/db/SQLQueryComposer.java | 133 ++-- .../sun/star/wizards/query/CallQueryWizard.java | 5 +- .../com/sun/star/wizards/query/QuerySummary.java | 63 +- .../com/sun/star/wizards/query/QueryWizard.java | 73 +- .../com/sun/star/wizards/ui/FilterComponent.java | 63 +- 8 files changed, 594 insertions(+), 655 deletions(-) diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index ad54020e8645..1819d3485994 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -24,7 +24,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.wizards.db; import com.sun.star.lang.XMultiServiceFactory; @@ -39,25 +38,39 @@ import com.sun.star.lang.Locale; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; -import com.sun.star.embed.EntryInitModes; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.NumberFormatter; import com.sun.star.wizards.common.Resource; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import java.util.Vector; public class CommandMetaData extends DBMetaData { + public Map FieldTitleSet = new HashMap(); - public String[] m_aAllFieldNames = new String[]{}; - public FieldColumn[] FieldColumns = new FieldColumn[]{}; - public String[] GroupFieldNames = new String[] {}; - private String[][] SortFieldNames = new String[][] {}; - private String[] RecordFieldNames = new String[] {}; - public String[][] AggregateFieldNames = new String[][] {}; - public String[] NumericFieldNames = new String[] {}; + public String[] m_aAllFieldNames = new String[] + { + }; + public FieldColumn[] FieldColumns = new FieldColumn[] + { + }; + public String[] GroupFieldNames = new String[] + { + }; + private String[][] SortFieldNames = new String[][] + { + }; + private String[] RecordFieldNames = new String[] + { + }; + public String[][] AggregateFieldNames = new String[][] + { + }; + public String[] NumericFieldNames = new String[] + { + }; public String[] NonAggregateFieldNames; private int CommandType; private String Command; @@ -65,442 +78,417 @@ public class CommandMetaData extends DBMetaData String sCatalogSep = ""; String sIdentifierQuote = ""; boolean bCommandComposerAttributesalreadyRetrieved = false; - - private XIndexAccess xIndexKeys; public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter) - { - super(xMSF, _aLocale, oNumberFormatter); - } + { + super(xMSF, _aLocale, oNumberFormatter); + } public CommandMetaData(XMultiServiceFactory xMSF) - { - super(xMSF); - } - + { + super(xMSF); + } public void initializeFieldColumns(boolean _bgetDefaultValue, String _CommandName, String[] _FieldNames) + { + this.setCommandName(_CommandName); + FieldColumns = new FieldColumn[_FieldNames.length]; + for (int i = 0; i < _FieldNames.length; i++) { - this.setCommandName(_CommandName); - FieldColumns = new FieldColumn[_FieldNames.length]; - for (int i = 0; i < _FieldNames.length; i++) - { - FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false); + FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false); // if (_bgetDefaultValue) // { // FieldColumns[i].getDefaultValue(); // } - } } - + } public void initializeFieldColumns(String[] _FieldNames, XNameAccess _xColumns) + { + FieldColumns = new FieldColumn[_FieldNames.length]; + for (int i = 0; i < _FieldNames.length; i++) { - FieldColumns = new FieldColumn[_FieldNames.length]; - for (int i = 0; i < _FieldNames.length; i++) - { - FieldColumns[i] = new FieldColumn(this,_xColumns, _FieldNames[i] ); - } + FieldColumns[i] = new FieldColumn(this, _xColumns, _FieldNames[i]); } - + } public void initializeFieldColumns(String[] _FieldNames, String _CommandName) + { + this.setCommandName(_CommandName); + FieldColumns = new FieldColumn[_FieldNames.length]; + for (int i = 0; i < _FieldNames.length; i++) { - this.setCommandName(_CommandName); - FieldColumns = new FieldColumn[_FieldNames.length]; - for (int i = 0; i < _FieldNames.length; i++) + FieldColumns[i] = new FieldColumn(this, _FieldNames[i], _CommandName, false); + if (FieldTitleSet != null && FieldTitleSet.containsKey(_FieldNames[i])) { - FieldColumns[i] = new FieldColumn(this, _FieldNames[i], _CommandName, false); - if (FieldTitleSet != null) + FieldColumns[i].setFieldTitle((String) FieldTitleSet.get(_FieldNames[i])); + if (FieldColumns[i].getFieldTitle() == null) { - if (FieldTitleSet.containsKey(_FieldNames[i])) - { - FieldColumns[i].setFieldTitle( (String) FieldTitleSet.get(_FieldNames[i]) ); - if (FieldColumns[i].getFieldTitle() == null) - { - FieldColumns[i].setFieldTitle( _FieldNames[i] ); - FieldTitleSet.put(_FieldNames[i], _FieldNames[i]); - } - } + FieldColumns[i].setFieldTitle(_FieldNames[i]); + FieldTitleSet.put(_FieldNames[i], _FieldNames[i]); } } } + } public Map getFieldTitleSet() - { - return FieldTitleSet; - } - + { + return FieldTitleSet; + } public XPropertySet getColumnObjectByFieldName(String _FieldName, boolean _bgetByDisplayName) + { + try { - try + FieldColumn CurFieldColumn = null; + if (_bgetByDisplayName) { - FieldColumn CurFieldColumn = null; - if (_bgetByDisplayName) - { - CurFieldColumn = this.getFieldColumnByDisplayName(_FieldName); - } - else - { - CurFieldColumn = this.getFieldColumnByFieldName(_FieldName); - } - String CurCommandName = CurFieldColumn.getCommandName(); - CommandObject oCommand = getTableByName(CurCommandName); - Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); - XPropertySet xColumn = UnoRuntime.queryInterface( XPropertySet.class, oColumn ); - return xColumn; + CurFieldColumn = this.getFieldColumnByDisplayName(_FieldName); } - catch (Exception exception) + else { - exception.printStackTrace(System.out); - return null; + CurFieldColumn = this.getFieldColumnByFieldName(_FieldName); } + String CurCommandName = CurFieldColumn.getCommandName(); + CommandObject oCommand = getTableByName(CurCommandName); + Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); + XPropertySet xColumn = UnoRuntime.queryInterface(XPropertySet.class, oColumn); + return xColumn; } - + catch (Exception exception) + { + exception.printStackTrace(System.out); + return null; + } + } // @SuppressWarnings("unchecked") public void prependSortFieldNames(String[] _fieldnames) + { + ArrayList aSortFields = new ArrayList(); + for (int i = 0; i < _fieldnames.length; i++) { - Vector aSortFields = new Vector(); - for (int i = 0; i < _fieldnames.length; i++) + String[] sSortFieldName = new String[2]; + sSortFieldName[0] = _fieldnames[i]; + int index = JavaTools.FieldInTable(SortFieldNames, _fieldnames[i]); + if (index > -1) { - String[] sSortFieldName = new String[2]; - sSortFieldName[0] = _fieldnames[i]; - int index = JavaTools.FieldInTable(SortFieldNames, _fieldnames[i]); - if (index > -1) - - { - sSortFieldName[1] = SortFieldNames[index][1]; - } - else - - { - sSortFieldName[1] = "ASC"; - } - aSortFields.add(sSortFieldName); + sSortFieldName[1] = SortFieldNames[index][1]; } - for (int i = 0; i < SortFieldNames.length; i++) + else { - if (JavaTools.FieldInList(_fieldnames, SortFieldNames[i][0]) == -1) - { - aSortFields.add(SortFieldNames[i]); - } + sSortFieldName[1] = "ASC"; } - SortFieldNames = new String[aSortFields.size()][2]; - aSortFields.toArray(SortFieldNames); + aSortFields.add(sSortFieldName); } - - public String[][] getSortFieldNames() + for (int i = 0; i < SortFieldNames.length; i++) { - return SortFieldNames; + if (JavaTools.FieldInList(_fieldnames, SortFieldNames[i][0]) == -1) + { + aSortFields.add(SortFieldNames[i]); + } } + SortFieldNames = new String[aSortFields.size()][2]; + aSortFields.toArray(SortFieldNames); + } + + public String[][] getSortFieldNames() + { + return SortFieldNames; + } + public void setSortFieldNames(String[][] aNewListList) - { - SortFieldNames = aNewListList; - } + { + SortFieldNames = aNewListList; + } public FieldColumn getFieldColumn(String _FieldName, String _CommandName) + { + for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns.length > 0) + if (FieldColumns[i].getFieldName().equals(_FieldName) && FieldColumns[i].getCommandName().equals(_CommandName)) { - for (int i = 0; i < FieldColumns.length; i++) - { - if (FieldColumns[i].getFieldName().equals(_FieldName)) - - { - if (FieldColumns[i].getCommandName().equals(_CommandName)) - { - return FieldColumns[i]; - } - } - } + return FieldColumns[i]; } - return null; } - - + return null; + } public FieldColumn getFieldColumnByFieldName(String _FieldName) + { + for (int i = 0; i < FieldColumns.length; i++) { - for (int i = 0; i < FieldColumns.length; i++) + String sFieldName = FieldColumns[i].getFieldName(); + if (sFieldName.equals(_FieldName)) { - String sFieldName = FieldColumns[i].getFieldName(); - if (sFieldName.equals(_FieldName)) + return FieldColumns[i]; + } + if (_FieldName.indexOf('.') == -1) + { + String sCompound = Command + "." + _FieldName; + if (sFieldName.equals(sCompound)) { return FieldColumns[i]; } - if (_FieldName.indexOf('.') == -1) - { - String sCompound = Command + "." + _FieldName; - if (sFieldName.equals(sCompound)) - { - return FieldColumns[i]; - } - } } - throw new com.sun.star.uno.RuntimeException(); } - + throw new com.sun.star.uno.RuntimeException(); + } public FieldColumn getFieldColumnByDisplayName(String _DisplayName) + { + String identifierQuote = getIdentifierQuote(); + for (int i = 0; i < FieldColumns.length; i++) { - for (int i = 0; i < FieldColumns.length; i++) + String sDisplayName = FieldColumns[i].getDisplayFieldName(); + if (sDisplayName.equals(_DisplayName)) { - String sDisplayName = FieldColumns[i].getDisplayFieldName(); - if (sDisplayName.equals(_DisplayName)) + return FieldColumns[i]; + } + if (_DisplayName.indexOf('.') == -1) + { + String sCompound = Command + "." + _DisplayName; + if (sDisplayName.equals(sCompound)) { return FieldColumns[i]; } - if (_DisplayName.indexOf('.') == -1) - { - String sCompound = Command + "." + _DisplayName; - if (sDisplayName.equals(sCompound)) - { - return FieldColumns[i]; - } - } } - throw new com.sun.star.uno.RuntimeException(); + String quotedName = new StringBuilder(CommandName.quoteName(FieldColumns[i].getCommandName(), identifierQuote)).append('.').append(CommandName.quoteName(FieldColumns[i].getFieldName(), identifierQuote)).toString(); + if (quotedName.equals(_DisplayName)) + { + return FieldColumns[i]; + } } - + throw new com.sun.star.uno.RuntimeException(); + } public FieldColumn getFieldColumnByTitle(String _FieldTitle) + { + for (int i = 0; i < FieldColumns.length; i++) { - for (int i = 0; i < FieldColumns.length; i++) + if (FieldColumns[i].getFieldTitle().equals(_FieldTitle)) { - if (FieldColumns[i].getFieldTitle().equals(_FieldTitle)) - { - return FieldColumns[i]; - } + return FieldColumns[i]; } - // throw new com.sun.star.uno.RuntimeException(); - // LLA: Group works with fields direct - for (int i = 0; i < FieldColumns.length; i++) + } + // throw new com.sun.star.uno.RuntimeException(); + // LLA: Group works with fields direct + for (int i = 0; i < FieldColumns.length; i++) + { + if (FieldColumns[i].getFieldName().equals(_FieldTitle)) { - if (FieldColumns[i].getFieldName().equals(_FieldTitle)) - { - return FieldColumns[i]; - } + return FieldColumns[i]; } - throw new com.sun.star.uno.RuntimeException(); } - + throw new com.sun.star.uno.RuntimeException(); + } public boolean getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode) + { + try { - try + // Object oField; + java.util.ArrayList ResultFieldNames = new java.util.ArrayList(10); + String[] FieldNames; + CommandObject oCommand = this.getCommandByName(_commandname, _commandtype); + FieldNames = oCommand.getColumns().getElementNames(); + if (FieldNames.length > 0) { - // Object oField; - java.util.Vector ResultFieldNames = new java.util.Vector(10); - String[] FieldNames; - CommandObject oCommand = this.getCommandByName(_commandname, _commandtype); - FieldNames = oCommand.getColumns().getElementNames(); - if (FieldNames.length > 0) + for (int n = 0; n < FieldNames.length; n++) { - for (int n = 0; n < FieldNames.length; n++) + final String sFieldName = FieldNames[n]; + Object oField = oCommand.getColumns().getByName(sFieldName); + int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); + // BinaryFieldTypes are not included in the WidthList + if (JavaTools.FieldInIntTable(WidthList, iType) >= 0) { - final String sFieldName = FieldNames[n]; - Object oField = oCommand.getColumns().getByName(sFieldName); - int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); - // BinaryFieldTypes are not included in the WidthList - if (JavaTools.FieldInIntTable(WidthList, iType) >= 0) - { // if (_bAppendMode) // ResultFieldNames.addElement(_commandname + "." + FieldNames[n]); // else - ResultFieldNames.addElement(sFieldName); - } - else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0) - { - ResultFieldNames.addElement(sFieldName); - } + ResultFieldNames.add(sFieldName); + } + else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0) + { + ResultFieldNames.add(sFieldName); } - // FieldNames = new String[FieldNames.length]; - // FieldTypes = new int[FieldNames.length]; - m_aAllFieldNames = new String[ResultFieldNames.size()]; - ResultFieldNames.copyInto(m_aAllFieldNames); - return true; } + // FieldNames = new String[FieldNames.length]; + // FieldTypes = new int[FieldNames.length]; + m_aAllFieldNames = new String[ResultFieldNames.size()]; + m_aAllFieldNames = ResultFieldNames.toArray(m_aAllFieldNames); + return true; } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - Resource oResource = new Resource(xMSF, "Database", "dbw"); - String sMsgNoFieldsFromCommand = oResource.getResText(RID_DB_COMMON + 45); - sMsgNoFieldsFromCommand = JavaTools.replaceSubString(sMsgNoFieldsFromCommand, _commandname, "%NAME"); - showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgNoFieldsFromCommand); - return false; } - - - - - + catch (Exception exception) + { + exception.printStackTrace(System.out); + } + Resource oResource = new Resource(xMSF, "Database", "dbw"); + String sMsgNoFieldsFromCommand = oResource.getResText(RID_DB_COMMON + 45); + sMsgNoFieldsFromCommand = JavaTools.replaceSubString(sMsgNoFieldsFromCommand, _commandname, "%NAME"); + showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgNoFieldsFromCommand); + return false; + } public String[] getOrderableColumns(String[] _fieldnames) + { + ArrayList aOrderableColumns = new ArrayList(); + int ncount = 0; + for (int i = 0; i < _fieldnames.length; i++) { - Vector aOrderableColumns = new Vector(); - int ncount = 0; - for (int i = 0; i < _fieldnames.length; i++) + FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); + if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) { - FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); - if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) - { - aOrderableColumns.addElement(_fieldnames[i]); - ncount++; - } + aOrderableColumns.add(_fieldnames[i]); + ncount++; } - String[] sretfieldnames = new String[ncount]; - aOrderableColumns.toArray(sretfieldnames); - return sretfieldnames; } - + String[] sretfieldnames = new String[ncount]; + aOrderableColumns.toArray(sretfieldnames); + return sretfieldnames; + } /** * @return Returns the command. */ public String getCommandName() - { - return Command; - } + { + return Command; + } + /** * @param _command The command to set. */ public void setCommandName(String _command) - { - Command = _command; - } + { + Command = _command; + } /** * @return Returns the commandType. */ public int getCommandType() - { - return CommandType; - } + { + return CommandType; + } /** * @param _commandType The commandType to set. */ public void setCommandType(int _commandType) - { - CommandType = _commandType; - } - + { + CommandType = _commandType; + } public boolean isnumeric(FieldColumn _oFieldColumn) + { + try { - try + CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName()); + Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName()); + int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); + int ifound = java.util.Arrays.binarySearch(NumericTypes, iType); + if ((ifound < NumericTypes.length) && (ifound > 0)) { - CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName()); - Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName()); - int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); - int ifound = java.util.Arrays.binarySearch(NumericTypes, iType); - if ((ifound < NumericTypes.length) && (ifound > 0)) - { - return (NumericTypes[ifound] == iType); - } - else - { - return false; - } + return (NumericTypes[ifound] == iType); } - catch (Exception exception) + else { - exception.printStackTrace(System.out); return false; } } + catch (Exception exception) + { + exception.printStackTrace(System.out); + return false; + } + } public String[] setNumericFields() + { + try { - try + ArrayList numericfieldsvector = new java.util.ArrayList(); + for (int i = 0; i < FieldColumns.length; i++) { - Vector numericfieldsvector = new java.util.Vector(); - for (int i = 0; i < FieldColumns.length; i++) + if (isnumeric(FieldColumns[i])) { - if (isnumeric(FieldColumns[i])) - { - numericfieldsvector.addElement(FieldColumns[i].getDisplayFieldName()); - } + numericfieldsvector.add(FieldColumns[i].getDisplayFieldName()); } - NumericFieldNames = new String[numericfieldsvector.size()]; - numericfieldsvector.toArray(NumericFieldNames); - return NumericFieldNames; - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - return new String[]{}; } + NumericFieldNames = new String[numericfieldsvector.size()]; + numericfieldsvector.toArray(NumericFieldNames); + return NumericFieldNames; } + catch (Exception exception) + { + exception.printStackTrace(System.out); + return new String[] + { + }; + } + } public String[] getFieldNames(String[] _sDisplayFieldNames, String _sCommandName) + { + ArrayList sFieldNamesVector = new java.util.ArrayList(); + for (int i = 0; i < FieldColumns.length; i++) { - Vector sFieldNamesVector = new java.util.Vector(); - for (int i = 0; i < FieldColumns.length; i++) + if (_sCommandName.equals(FieldColumns[i].getCommandName()) && JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1) { - if (_sCommandName.equals(FieldColumns[i].getCommandName())) - { - if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1) - { - sFieldNamesVector.addElement(FieldColumns[i].getFieldName()); - } - } + sFieldNamesVector.add(FieldColumns[i].getFieldName()); } - String[] sFieldNames = new String[sFieldNamesVector.size()]; - sFieldNamesVector.toArray(sFieldNames); - return sFieldNames; } - - + String[] sFieldNames = new String[sFieldNamesVector.size()]; + sFieldNamesVector.toArray(sFieldNames); + return sFieldNames; + } public String[] getFieldNames() + { + String[] sFieldNames = new String[FieldColumns.length]; + for (int i = 0; i < FieldColumns.length; i++) { - String[] sFieldNames = new String[FieldColumns.length]; - for (int i = 0; i < FieldColumns.length; i++) - { - sFieldNames[i] = FieldColumns[i].getFieldName(); - } - return sFieldNames; + sFieldNames[i] = FieldColumns[i].getFieldName(); } + return sFieldNames; + } public String[] getDisplayFieldNames() + { + String[] sDisplayFieldNames = new String[FieldColumns.length]; + for (int i = 0; i < FieldColumns.length; i++) { - String[] sDisplayFieldNames = new String[FieldColumns.length]; - for (int i = 0; i < FieldColumns.length; i++) - { - sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName(); - } - return sDisplayFieldNames; + sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName(); } - + return sDisplayFieldNames; + } public String[] setNonAggregateFieldNames() + { + try { - try + ArrayList nonaggregatefieldsvector = new java.util.ArrayList(); + for (int i = 0; i < FieldColumns.length; i++) { - Vector nonaggregatefieldsvector = new java.util.Vector(); - for (int i = 0; i < FieldColumns.length; i++) + if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1) { - if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1) - { - nonaggregatefieldsvector.addElement(FieldColumns[i].getDisplayFieldName()); - } + nonaggregatefieldsvector.add(FieldColumns[i].getDisplayFieldName()); } - NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()]; - nonaggregatefieldsvector.toArray(NonAggregateFieldNames); - return NonAggregateFieldNames; - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - return new String[]{}; } + NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()]; + nonaggregatefieldsvector.toArray(NonAggregateFieldNames); + return NonAggregateFieldNames; } + catch (Exception exception) + { + exception.printStackTrace(System.out); + return new String[] + { + }; + } + } /** * the fieldnames passed over are not necessarily the ones that are defined in the class @@ -508,108 +496,103 @@ public class CommandMetaData extends DBMetaData * @return */ public boolean hasNumericalFields(String[] _DisplayFieldNames) - + { + if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0) { - if (_DisplayFieldNames != null) + for (int i = 0; i < _DisplayFieldNames.length; i++) { - if (_DisplayFieldNames.length > 0) + if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i]))) { - for (int i = 0; i < _DisplayFieldNames.length; i++) - { - if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i]))) - { - return true; - } - } + return true; } } - return false; } + return false; + } public String getFieldTitle(String FieldName) + { + String FieldTitle = FieldName; + if (this.FieldTitleSet != null) { - String FieldTitle = FieldName; - if (this.FieldTitleSet != null) + FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex]; + if (FieldTitle == null) { - FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex]; - if (FieldTitle == null) - { - return FieldName; - } + return FieldName; } - return FieldTitle; } - + return FieldTitle; + } public void setFieldTitles(String[] sFieldTitles) + { + int nFieldColLength = FieldColumns.length; + for (int i = 0; i < sFieldTitles.length; i++) { - int nFieldColLength = FieldColumns.length; - for (int i = 0; i < sFieldTitles.length; i++) + if (i < nFieldColLength) { - if (i < nFieldColLength) - { - FieldColumns[i].setFieldTitle(sFieldTitles[i]); - } - + FieldColumns[i].setFieldTitle(sFieldTitles[i]); } - } + } + } public String[] getFieldTitles() + { + String[] sFieldTitles = new String[FieldColumns.length]; + for (int i = 0; i < FieldColumns.length; i++) { - String[] sFieldTitles = new String[FieldColumns.length]; - for (int i = 0; i < FieldColumns.length; i++) - { - sFieldTitles[i] = FieldColumns[i].getFieldTitle(); - } - return sFieldTitles; + sFieldTitles[i] = FieldColumns[i].getFieldTitle(); } - + return sFieldTitles; + } public void setGroupFieldNames(String[] GroupFieldNames) - { - this.GroupFieldNames = GroupFieldNames; - } - + { + this.GroupFieldNames = GroupFieldNames; + } public String[] getGroupFieldNames() - { - return GroupFieldNames; - } + { + return GroupFieldNames; + } public void createRecordFieldNames() - { - String CurFieldName; - int GroupFieldCount; - int TotFieldCount = FieldColumns.length; - // int SortFieldCount = SortFieldNames[0].length; - GroupFieldCount = JavaTools.getArraylength(GroupFieldNames); - RecordFieldNames = new String[TotFieldCount - GroupFieldCount]; + { + String CurFieldName; + int GroupFieldCount; + int TotFieldCount = FieldColumns.length; + // int SortFieldCount = SortFieldNames[0].length; + GroupFieldCount = JavaTools.getArraylength(GroupFieldNames); + RecordFieldNames = new String[TotFieldCount - GroupFieldCount]; - int a = 0; - for (int i = 0; i < TotFieldCount; i++) + int a = 0; + for (int i = 0; i < TotFieldCount; i++) + { + CurFieldName = FieldColumns[i].getFieldName(); + if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0) { - CurFieldName = FieldColumns[i].getFieldName(); - if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0) - { - RecordFieldNames[a] = CurFieldName; - // a += 1; - ++a; - } + RecordFieldNames[a] = CurFieldName; + // a += 1; + ++a; } } - public void setRecordFieldNames(String [] _aNewList) - { - RecordFieldNames = _aNewList; - } - public String[] getRecordFieldNames() - { - return RecordFieldNames; - } - public String getRecordFieldName(int i) - { - return RecordFieldNames[i]; - } + } + + public void setRecordFieldNames(String[] _aNewList) + { + RecordFieldNames = _aNewList; + } + + public String[] getRecordFieldNames() + { + return RecordFieldNames; + } + + public String getRecordFieldName(int i) + { + return RecordFieldNames[i]; + } /**@deprecated use 'RelationController' class instead * @@ -618,46 +601,45 @@ public class CommandMetaData extends DBMetaData * @return */ public String[] getReferencedTables(String _stablename, int _ncommandtype) + { + String[] sTotReferencedTables = new String[] { - String[] sTotReferencedTables = new String[]{}; - try + }; + try + { + if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility()) { - if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE) + java.util.ArrayList TableVector = new java.util.ArrayList(); + Object oTable = getTableNamesAsNameAccess().getByName(_stablename); + XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable); + xIndexKeys = xKeysSupplier.getKeys(); + for (int i = 0; i < xIndexKeys.getCount(); i++) { - if (xDBMetaData.supportsIntegrityEnhancementFacility()) + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); + int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); + if (curtype == KeyType.FOREIGN) { - java.util.Vector TableVector = new java.util.Vector(); - Object oTable = getTableNamesAsNameAccess().getByName(_stablename); - XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface( XKeysSupplier.class, oTable ); - xIndexKeys = xKeysSupplier.getKeys(); - for (int i = 0; i < xIndexKeys.getCount(); i++) - { - XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) ); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) - { - // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475 - String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(sreftablename)) - { - TableVector.addElement(sreftablename); - } - } - } - if (TableVector.size() > 0) + // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475 + String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); + if (getTableNamesAsNameAccess().hasByName(sreftablename)) { - sTotReferencedTables = new String[TableVector.size()]; - TableVector.copyInto(sTotReferencedTables); + TableVector.add(sreftablename); } } } + if (TableVector.size() > 0) + { + sTotReferencedTables = new String[TableVector.size()]; + TableVector.toArray(sTotReferencedTables); + } } - catch (Exception e) - { - e.printStackTrace(System.out); - } - return sTotReferencedTables; } + catch (Exception e) + { + e.printStackTrace(System.out); + } + return sTotReferencedTables; + } /**@deprecated use 'RelationController' class instead * @@ -665,108 +647,95 @@ public class CommandMetaData extends DBMetaData * @return */ public String[][] getKeyColumns(String _sreferencedtablename) + { + String[][] skeycolumnnames = null; + try { - String[][] skeycolumnnames = null; - try + for (int i = 0; i < xIndexKeys.getCount(); i++) { - for (int i = 0; i < xIndexKeys.getCount(); i++) + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); + int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); + if (curtype == KeyType.FOREIGN) { - XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) ); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) + String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); + if (getTableNamesAsNameAccess().hasByName(scurreftablename)) { - String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(scurreftablename)) + if (scurreftablename.equals(_sreferencedtablename)) { - if (scurreftablename.equals(_sreferencedtablename)) + XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet); + String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); + skeycolumnnames = new String[2][smastercolnames.length]; + skeycolumnnames[0] = smastercolnames; + skeycolumnnames[1] = new String[smastercolnames.length]; + for (int n = 0; n < smastercolnames.length; n++) { - XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropertySet ); - String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); - skeycolumnnames = new String[2][smastercolnames.length]; - skeycolumnnames[0] = smastercolnames; - skeycolumnnames[1] = new String[smastercolnames.length]; - for (int n = 0; n < smastercolnames.length; n++) - { - XPropertySet xcolPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xColumnsSupplier.getColumns().getByName( smastercolnames[n] ) ); - skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); - } - return skeycolumnnames; + XPropertySet xcolPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n])); + skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); } + return skeycolumnnames; } } } } - catch (Exception e) - { - e.printStackTrace(); - } - return skeycolumnnames; } - - - public void openFormDocument(boolean _bReadOnly) + catch (Exception e) { - try - { - Object oEmbeddedFactory = super.xMSF.createInstance("com.sun.star.embed.OOoEmbeddedObjectFactory"); - int iEntryInitMode = EntryInitModes.DEFAULT_INIT; //TRUNCATE_INIT??? - } - catch (Exception e) - { - e.printStackTrace(System.out); - } + e.printStackTrace(); } + return skeycolumnnames; + } + public void openFormDocument(boolean _bReadOnly) + { + } public void setCommandComposingAttributes() + { + try { - try - { - boolean bCatalogAtStart2 = xDBMetaData.isCatalogAtStart(); - sCatalogSep = xDBMetaData.getCatalogSeparator(); - sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); - bCommandComposerAttributesalreadyRetrieved = true; - } - catch (SQLException e) - { - e.printStackTrace(System.out); - } + sCatalogSep = xDBMetaData.getCatalogSeparator(); + sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); + bCommandComposerAttributesalreadyRetrieved = true; } - + catch (SQLException e) + { + e.printStackTrace(System.out); + } + } /** * @return Returns the bCatalogAtStart. */ public boolean isCatalogAtStart() + { + if (!bCommandComposerAttributesalreadyRetrieved) { - if (!bCommandComposerAttributesalreadyRetrieved) - { - setCommandComposingAttributes(); - } - return bCatalogAtStart; + setCommandComposingAttributes(); } + return bCatalogAtStart; + } /** * @return Returns the sCatalogSep. */ public String getCatalogSeparator() + { + if (!bCommandComposerAttributesalreadyRetrieved) { - if (!bCommandComposerAttributesalreadyRetrieved) - { - setCommandComposingAttributes(); - } - return sCatalogSep; + setCommandComposingAttributes(); } + return sCatalogSep; + } /** * @return Returns the sIdentifierQuote. */ public String getIdentifierQuote() + { + if (!bCommandComposerAttributesalreadyRetrieved) { - if (!bCommandComposerAttributesalreadyRetrieved) - { - setCommandComposingAttributes(); - } - return sIdentifierQuote; + setCommandComposingAttributes(); } + return sIdentifierQuote; + } } diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java index aa8a4f9c7ea9..3c6686868ff3 100644 --- a/wizards/com/sun/star/wizards/db/CommandName.java +++ b/wizards/com/sun/star/wizards/db/CommandName.java @@ -205,9 +205,7 @@ public class CommandName { sName = ""; } - String ReturnQuote = ""; - ReturnQuote = _sIdentifierQuote + sName + _sIdentifierQuote; - return ReturnQuote; + return new StringBuilder(_sIdentifierQuote).append(sName).append(_sIdentifierQuote).toString(); } public void setAliasName(String _AliasName) diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index bad14c2faa20..5fe6cd55c3a9 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -101,9 +101,10 @@ public class QueryMetaData extends CommandMetaData // FieldColumns = LocFieldColumns; // } // } + public void addSeveralFieldColumns(String[] _FieldNames, String _sCommandName) { - Vector oToBeAddedFieldColumns = new Vector(); + ArrayList oToBeAddedFieldColumns = new ArrayList(); for (int i = 0; i < _FieldNames.length; i++) { FieldColumn oFieldColumn = getFieldColumn(_FieldNames[i], _sCommandName); @@ -119,7 +120,7 @@ public class QueryMetaData extends CommandMetaData System.arraycopy(FieldColumns, 0, LocFieldColumns, 0, nOldFieldCount); for (int i = 0; i < oToBeAddedFieldColumns.size(); i++) { - LocFieldColumns[nOldFieldCount + i] = (FieldColumn) oToBeAddedFieldColumns.elementAt(i); + LocFieldColumns[nOldFieldCount + i] = oToBeAddedFieldColumns.get(i); } FieldColumns = LocFieldColumns; } @@ -138,7 +139,7 @@ public class QueryMetaData extends CommandMetaData public void removeSeveralFieldColumnsByDisplayFieldName(String[] _DisplayFieldNames) { - Vector oRemainingFieldColumns = new Vector(); + ArrayList oRemainingFieldColumns = new ArrayList(); int a = 0; for (int n = 0; n < FieldColumns.length; n++) { @@ -161,13 +162,10 @@ public class QueryMetaData extends CommandMetaData FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1]; for (int i = 0; i < FieldColumns.length; i++) { - if (!FieldColumns[i].getFieldName().equals(_sFieldName)) + if (!FieldColumns[i].getFieldName().equals(_sFieldName) && !FieldColumns[i].getCommandName().equals(_sCommandName)) { - if (!FieldColumns[i].getCommandName().equals(_sCommandName)) - { - LocFieldColumns[a] = FieldColumns[i]; - a++; - } + LocFieldColumns[a] = FieldColumns[i]; + a++; } } FieldColumns = LocFieldColumns; @@ -177,7 +175,7 @@ public class QueryMetaData extends CommandMetaData public String[] getIncludedCommandNames() { // FieldColumn CurQueryField; - Vector CommandNamesV = new Vector(1); + ArrayList CommandNamesV = new ArrayList(1); // String CurCommandName; for (int i = 0; i < FieldColumns.length; i++) { @@ -185,7 +183,7 @@ public class QueryMetaData extends CommandMetaData final String CurCommandName = CurQueryField.getCommandName(); if (!CommandNamesV.contains(CurCommandName)) { - CommandNamesV.addElement(CurCommandName); + CommandNamesV.add(CurCommandName); } } String[] sIncludedCommandNames = new String[CommandNamesV.size()]; @@ -195,7 +193,7 @@ public class QueryMetaData extends CommandMetaData public static String[] getIncludedCommandNames(String[] _FieldNames) { - Vector CommandNames = new Vector(1); + ArrayList CommandNames = new ArrayList(1); for (int i = 0; i < _FieldNames.length; i++) { String CurCommandName = ""; @@ -208,7 +206,7 @@ public class QueryMetaData extends CommandMetaData } if (!CommandNames.contains(CurCommandName)) { - CommandNames.addElement(CurCommandName); + CommandNames.add(CurCommandName); } } } @@ -257,7 +255,7 @@ public class QueryMetaData extends CommandMetaData public String[] getUniqueAggregateFieldNames() { - Vector UniqueAggregateFieldVector = new Vector(0); + ArrayList UniqueAggregateFieldVector = new ArrayList(); for (int i = 0; i < AggregateFieldNames.length; i++) { if (!UniqueAggregateFieldVector.contains(AggregateFieldNames[i][0])) @@ -291,10 +289,13 @@ public class QueryMetaData extends CommandMetaData } return iAggregate; } + public SQLQueryComposer getSQLQueryComposer() { - if ( oSQLQueryComposer == null ) + if (oSQLQueryComposer == null) + { oSQLQueryComposer = new SQLQueryComposer(this); + } return oSQLQueryComposer; } } diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 038f00a58bd7..e088fb75641f 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -26,7 +26,6 @@ ************************************************************************/ package com.sun.star.wizards.db; -import java.util.Vector; // import com.sun.star.lang.IllegalArgumentException; // import com.sun.star.lang.WrappedTargetException; @@ -37,7 +36,6 @@ import com.sun.star.container.XIndexAccess; // import com.sun.star.container.XNameAccess; import com.sun.star.sdbcx.XColumnsSupplier; // import com.sun.star.sdb.XColumn; -import com.sun.star.sdb.XSQLQueryComposerFactory; import com.sun.star.sdb.XSingleSelectQueryComposer; import com.sun.star.sdb.XSingleSelectQueryAnalyzer; import com.sun.star.ui.dialogs.XExecutableDialog; @@ -50,6 +48,7 @@ import com.sun.star.awt.XWindow; import com.sun.star.sdb.SQLFilterOperator; import com.sun.star.wizards.common.*; +import java.util.ArrayList; public class SQLQueryComposer { @@ -60,7 +59,7 @@ public class SQLQueryComposer // String m_sSelectClause; // String m_sFromClause; public XSingleSelectQueryAnalyzer m_xQueryAnalyzer; - Vector composedCommandNames = new Vector(1); + ArrayList composedCommandNames = new ArrayList(1); private XSingleSelectQueryComposer m_queryComposer; XMultiServiceFactory xMSF; boolean bincludeGrouping = true; @@ -74,9 +73,6 @@ public class SQLQueryComposer final Object oQueryComposer = xMSF.createInstance("com.sun.star.sdb.SingleSelectQueryComposer"); m_xQueryAnalyzer = (XSingleSelectQueryAnalyzer) UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer); m_queryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer); - XSQLQueryComposerFactory xSQLComposerFactory; - xSQLComposerFactory = (XSQLQueryComposerFactory) UnoRuntime.queryInterface(XSQLQueryComposerFactory.class, CurDBMetaData.DBConnection); - // /* XSQLQueryComposer */ xSQLQueryComposer = xSQLComposerFactory.createQueryComposer(); } catch (Exception exception) { @@ -86,18 +82,9 @@ public class SQLQueryComposer private boolean addtoSelectClause(String DisplayFieldName) throws SQLException { - if (bincludeGrouping) + if (bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.GroupFieldNames != null && JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1) { - if (CurDBMetaData.xDBMetaData.supportsGroupByUnrelated()) - { - if (CurDBMetaData.GroupFieldNames != null) - { - if (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1) - { - return false; - } - } - } + return false; } return true; } @@ -234,7 +221,6 @@ public class SQLQueryComposer } // just for debug! sOrder = m_queryComposer.getOrder(); - int dummy = 0; } public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException @@ -244,7 +230,6 @@ public class SQLQueryComposer XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames); m_queryComposer.appendGroupByColumn(xColumn); } - String s = m_xQueryAnalyzer.getQuery(); } public void setDBMetaData(QueryMetaData _oDBMetaData) @@ -269,19 +254,19 @@ public class SQLQueryComposer return m_xQueryAnalyzer.getQuery(); } - public String getFromClause() + public StringBuilder getFromClause() { - String sFromClause = "FROM"; + StringBuilder sFromClause = new StringBuilder("FROM"); composedCommandNames.clear(); String[] sCommandNames = CurDBMetaData.getIncludedCommandNames(); for (int i = 0; i < sCommandNames.length; i++) { CommandName curCommandName = new CommandName(CurDBMetaData, sCommandNames[i]); //(setComposedCommandName) curCommandName.setAliasName(getuniqueAliasName(curCommandName.getTableName())); - sFromClause += " " + curCommandName.getComposedName() + " " + quoteName(curCommandName.getAliasName()); + sFromClause.append(" ").append(curCommandName.getComposedName()).append(" ").append(quoteName(curCommandName.getAliasName())); if (i < sCommandNames.length - 1) { - sFromClause += ", "; + sFromClause.append(", "); } // fill composedCommandNames composedCommandNames.add(curCommandName); @@ -291,30 +276,25 @@ public class SQLQueryComposer public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) { - return setQueryCommand(_xParentWindow,_bincludeGrouping, _baddAliasFieldNames,true); + return setQueryCommand(_xParentWindow, _bincludeGrouping, _baddAliasFieldNames, true); } + public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery) { try { - String s; bincludeGrouping = _bincludeGrouping; - if ( addQuery ) + if (addQuery) { - String sFromClause = getFromClause(); String sSelectClause = getSelectClause(_baddAliasFieldNames); - String queryclause = sSelectClause + " " + sFromClause; - m_xQueryAnalyzer.setQuery(queryclause); - if (CurDBMetaData.getFilterConditions() != null) + StringBuilder queryclause = new StringBuilder(sSelectClause).append(" ").append(getFromClause()); + m_xQueryAnalyzer.setQuery(queryclause.toString()); + if (CurDBMetaData.getFilterConditions() != null && CurDBMetaData.getFilterConditions().length > 0) { - if (CurDBMetaData.getFilterConditions().length > 0) - { - CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions())); - m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); - } + CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions())); + m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); } } - s = m_xQueryAnalyzer.getQuery(); if (_bincludeGrouping) { appendGroupByColumns(_baddAliasFieldNames); @@ -325,7 +305,6 @@ public class SQLQueryComposer } appendSortingcriteria(_baddAliasFieldNames); - s = m_xQueryAnalyzer.getQuery(); return true; } catch (Exception exception) @@ -340,8 +319,10 @@ public class SQLQueryComposer { FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname); CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName()); - if ( curComposedCommandName == null ) + if (curComposedCommandName == null) + { return _fieldname; + } String curAliasName = curComposedCommandName.getAliasName(); return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName()); } @@ -350,13 +331,11 @@ public class SQLQueryComposer { if (composedCommandNames != null) { - CommandName curComposedName; - for (int i = 0; i < composedCommandNames.size(); i++) + for (CommandName commandName : composedCommandNames) { - curComposedName = (CommandName) composedCommandNames.elementAt(i); - if (curComposedName.getAliasName().equals(_AliasName)) + if (commandName.getAliasName().equals(_AliasName)) { - return curComposedName; + return commandName; } } } @@ -367,13 +346,11 @@ public class SQLQueryComposer { if (composedCommandNames != null) { - CommandName curComposedName; - for (int i = 0; i < composedCommandNames.size(); i++) + for (CommandName commandName : composedCommandNames) { - curComposedName = (CommandName) composedCommandNames.elementAt(i); - if (curComposedName.getDisplayName().equals(_DisplayName)) + if (commandName.getDisplayName().equals(_DisplayName)) { - return curComposedName; + return commandName; } } } @@ -420,7 +397,7 @@ public class SQLQueryComposer rDispatchArguments[2] = Properties.createProperty("SQLException", _exception); xInitialize.initialize(rDispatchArguments); xExecute.execute(); - //TODO dispose??? + //TODO dispose??? } catch (Exception typeexception) { @@ -443,38 +420,40 @@ public class SQLQueryComposer public PropertyValue[][] getNormalizedStructuredFilter() { final PropertyValue[][] structuredFilter = m_queryComposer.getStructuredFilter(); - for ( int i=0; i 0) { - if (_filterconditions.length > 0) + String sconditions = ""; + String sStart = oResource.getResText(_InitResID); + String BaseString = oResource.getResText(RID_QUERY + 96); + if (_filterconditions.length == 1) { - String sconditions = ""; - String sStart = oResource.getResText(_InitResID); - String BaseString = oResource.getResText(RID_QUERY + 96); - if (_filterconditions.length == 1) + PropertyValue[] curfilterconditions = _filterconditions[0]; + for (int i = 0; i < curfilterconditions.length; i++) { - PropertyValue[] curfilterconditions = _filterconditions[0]; - for (int i = 0; i < curfilterconditions.length; i++) - { - sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this); - sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length); - } + sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this); + sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length); } - else - { + } + else + { - for (int i = 0; i < _filterconditions.length; i++) - { - sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this); - sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length); - } + for (int i = 0; i < _filterconditions.length; i++) + { + sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this); + sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length); } - String sreturn = sStart + sconditions; - return sreturn; } + String sreturn = sStart + sconditions; + return sreturn; } return oResource.getResText(_AlternativeResID); } @@ -173,14 +161,12 @@ public class QuerySummary extends QueryMetaData return _basestring; } // TODO: How can you merge the following two methods to a single one in a smarter way?? + public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID) { - if (_FieldNames != null) + if (_FieldNames != null && _FieldNames.length > 0) { - if (_FieldNames.length > 0) - { - return ArrayFieldsToString(_InitResID, _FieldNames); - } + return ArrayFieldsToString(_InitResID, _FieldNames); } return oResource.getResText(_AlternativeResID); } @@ -202,12 +188,9 @@ public class QuerySummary extends QueryMetaData public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags) { - if (_FieldNames != null) + if (_FieldNames != null && _FieldNames.length > 0) { - if (_FieldNames.length > 0) - { - return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags); - } + return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags); } return oResource.getResText(_AlternativeResID); } diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index c31315b965a0..a0696a435e77 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -53,6 +53,7 @@ import com.sun.star.wizards.ui.TitlesComponent; public class QueryWizard extends DatabaseObjectWizard { + public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; private static final int SOFIELDSELECTION_PAGE = 1; private static final int SOSORTING_PAGE = 2; @@ -81,16 +82,19 @@ public class QueryWizard extends DatabaseObjectWizard private String resmsgNonNumericAsGroupBy; private String m_createdQuery; - public QueryWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext ) + public QueryWizard(XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext) { - super( xMSF, 40970, i_wizardContext ); + super(xMSF, 40970, i_wizardContext); addResourceHandler("QueryWizard", "dbw"); m_DBMetaData = new QuerySummary(xMSF, m_oResource); } public static void main(String i_args[]) { - final String settings[] = new String[] { null, null, null }; + final String settings[] = new String[] + { + null, null, null + }; final int IDX_PIPE_NAME = 0; final int IDX_LOCATION = 1; final int IDX_DSN = 2; @@ -98,28 +102,28 @@ public class QueryWizard extends DatabaseObjectWizard // some simple parsing boolean failure = false; int settingsIndex = -1; - for ( int i=0; i= 0 ) + if (settingsIndex >= 0) { - settings[ settingsIndex ] = i_args[i]; + settings[ settingsIndex] = i_args[i]; settingsIndex = -1; continue; } - if ( i_args[i].equals( "--pipe-name" ) ) + if (i_args[i].equals("--pipe-name")) { settingsIndex = IDX_PIPE_NAME; continue; } - if ( i_args[i].equals( "--database-location" ) ) + if (i_args[i].equals("--database-location")) { settingsIndex = IDX_LOCATION; continue; } - if ( i_args[i].equals( "--data-source-name" ) ) + if (i_args[i].equals("--data-source-name")) { settingsIndex = IDX_DSN; continue; @@ -128,18 +132,22 @@ public class QueryWizard extends DatabaseObjectWizard failure = true; } - if ( settings[ IDX_PIPE_NAME ] == null ) + if (settings[ IDX_PIPE_NAME] == null) + { failure = true; + } - if ( ( settings[ IDX_DSN ] == null ) && ( settings[ IDX_LOCATION ] == null ) ) + if ((settings[ IDX_DSN] == null) && (settings[ IDX_LOCATION] == null)) + { failure = true; + } - if ( failure ) + if (failure) { - System.err.println( "supported arguments: " ); - System.err.println( " --pipe-name : specifies the name of the pipe to connect to the running OOo instance" ); - System.err.println( " --database-location : specifies the URL of the database document to work with" ); - System.err.println( " --data-source-name : specifies the name of the data source to work with" ); + System.err.println("supported arguments: "); + System.err.println(" --pipe-name : specifies the name of the pipe to connect to the running OOo instance"); + System.err.println(" --database-location : specifies the URL of the database document to work with"); + System.err.println(" --data-source-name : specifies the name of the data source to work with"); return; } @@ -150,12 +158,16 @@ public class QueryWizard extends DatabaseObjectWizard if (serviceFactory != null) { PropertyValue[] curproperties = new PropertyValue[1]; - if ( settings[ IDX_LOCATION ] != null ) - curproperties[0] = Properties.createProperty( "DatabaseLocation", settings[ IDX_LOCATION ] ); + if (settings[ IDX_LOCATION] != null) + { + curproperties[0] = Properties.createProperty("DatabaseLocation", settings[ IDX_LOCATION]); + } else - curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] ); + { + curproperties[0] = Properties.createProperty("DataSourceName", settings[ IDX_DSN]); + } - QueryWizard CurQueryWizard = new QueryWizard( serviceFactory, curproperties ); + QueryWizard CurQueryWizard = new QueryWizard(serviceFactory, curproperties); CurQueryWizard.startQueryWizard(); } } @@ -174,7 +186,7 @@ public class QueryWizard extends DatabaseObjectWizard { try { - if ( m_DBMetaData.getConnection( m_wizardContext ) ) + if (m_DBMetaData.getConnection(m_wizardContext)) { reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4); reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent @@ -196,13 +208,13 @@ public class QueryWizard extends DatabaseObjectWizard setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); this.setMaxStep(8); buildSteps(); - this.m_DBCommandFieldSelectio.preselectCommand( m_wizardContext, false ); + this.m_DBCommandFieldSelectio.preselectCommand(m_wizardContext, false); - XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() ); + XWindowPeer windowPeer = UnoRuntime.queryInterface(XWindowPeer.class, m_frame.getContainerWindow()); createWindowPeer(windowPeer); m_DBMetaData.setWindowPeer(this.xControl.getPeer()); insertQueryRelatedSteps(); - executeDialog( m_frame.getContainerWindow().getPosSize() ); + executeDialog(m_frame.getContainerWindow().getPosSize()); } } catch (java.lang.Exception jexception) @@ -310,8 +322,8 @@ public class QueryWizard extends DatabaseObjectWizard try { m_DBCommandFieldSelectio = new CommandFieldSelection( - this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables, - m_DBMetaData.supportsQueriesInFrom(), 40850); + this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables, + m_DBMetaData.supportsQueriesInFrom(), 40850); m_DBCommandFieldSelectio.setAppendMode(true); m_DBCommandFieldSelectio.addFieldSelectionListener(new FieldSelectionListener()); m_sortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865); @@ -341,14 +353,13 @@ public class QueryWizard extends DatabaseObjectWizard public boolean finishWizard() { int ncurStep = getCurrentStep(); - if ( ( ncurStep == SOSUMMARY_PAGE ) - || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) ) - ) + if ((ncurStep == SOSUMMARY_PAGE) + || (switchToStep(ncurStep, SOSUMMARY_PAGE))) { m_createdQuery = m_finalizer.finish(); - if ( m_createdQuery.length() > 0 ) + if (m_createdQuery.length() > 0) { - loadSubComponent( CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign() ); + loadSubComponent(CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign()); xDialog.endExecute(); return true; } diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 8dfc12e21fb3..09937a6af6d4 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -113,6 +113,7 @@ public class FilterComponent final int SO_FOURTHBOOLFIELDNAME = 256 + 4; int SO_BOOLEANLIST[] = + { SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME }; @@ -254,11 +255,10 @@ public class FilterComponent if (composer.getQuery().length() == 0) { - final String fromClause = composer.getFromClause(); StringBuilder sql = new StringBuilder(); sql.append(composer.getSelectClause(true)); sql.append(' '); - sql.append(fromClause); + sql.append(composer.getFromClause()); composer.getQueryComposer().setElementaryQuery(sql.toString()); } composer.getQueryComposer().setStructuredFilter(new PropertyValue[][] @@ -267,39 +267,36 @@ public class FilterComponent for (int i = 0; i < RowCount; i++) { ControlRow currentControlRow = oControlRows[i]; - if (currentControlRow.isEnabled()) + if (currentControlRow.isEnabled() && currentControlRow.isConditionComplete()) { - if (currentControlRow.isConditionComplete()) + String sFieldName = currentControlRow.getSelectedFieldName(); + int nOperator = (int) currentControlRow.getSelectedOperator(); + FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); + columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName()); + columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type")); + Object value = currentControlRow.getValue(); + switch (aFieldColumn.getFieldType()) { - String sFieldName = currentControlRow.getSelectedFieldName(); - int nOperator = (int) currentControlRow.getSelectedOperator(); - FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); - columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName()); - columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type")); - Object value = currentControlRow.getValue(); - switch (aFieldColumn.getFieldType()) - { - case DataType.TIMESTAMP: - case DataType.DATE: - value = ((Double) value) - oQueryMetaData.getNullDateCorrection(); - break; - } - column.removeProperty("Value"); - final short operator = currentControlRow.getSelectedOperator(); - if ((operator == SQLFilterOperator.SQLNULL) - || (operator == SQLFilterOperator.NOT_SQLNULL) - || AnyConverter.isVoid(value)) - { - column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), new String()); - value = new Any(new Type(TypeClass.VOID), null); - } - else - { - column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), value); - } - columnSet.setPropertyValue("Value", value); - composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator); + case DataType.TIMESTAMP: + case DataType.DATE: + value = ((Double) value) - oQueryMetaData.getNullDateCorrection(); + break; + } + column.removeProperty("Value"); + final short operator = currentControlRow.getSelectedOperator(); + if ((operator == SQLFilterOperator.SQLNULL) + || (operator == SQLFilterOperator.NOT_SQLNULL) + || AnyConverter.isVoid(value)) + { + column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), new String()); + value = new Any(new Type(TypeClass.VOID), null); + } + else + { + column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), value); } + columnSet.setPropertyValue("Value", value); + composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator); } } filterconditions = composer.getNormalizedStructuredFilter(); @@ -342,7 +339,7 @@ public class FilterComponent FieldName = _filtercondition.Name; } String sreturn = JavaTools.replaceSubString(_BaseString, FieldName, ""); - String soperator = sLogicOperators[_filtercondition.Handle-1]; + String soperator = sLogicOperators[_filtercondition.Handle - 1]; sreturn = JavaTools.replaceSubString(sreturn, soperator, ""); String sDisplayValue = ""; if ((_filtercondition.Handle != SQLFilterOperator.SQLNULL) -- cgit From d4c7fa84b7856918328bee20a5387cb32442bec3 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 11 Jan 2011 13:26:59 +0100 Subject: dr78: oox - encapsulate shape property handling in own class ShapePropertyMap --- oox/inc/oox/drawingml/color.hxx | 8 +- oox/inc/oox/drawingml/drawingmltypes.hxx | 3 + oox/inc/oox/drawingml/fillproperties.hxx | 55 +------ oox/inc/oox/drawingml/lineproperties.hxx | 48 +----- oox/inc/oox/drawingml/shapepropertymap.hxx | 148 +++++++++++++++++ oox/inc/oox/helper/modelobjecthelper.hxx | 16 +- oox/inc/oox/helper/propertymap.hxx | 16 +- oox/inc/oox/helper/propertyset.hxx | 38 ++--- oox/inc/oox/ppt/slidepersist.hxx | 4 +- oox/inc/oox/vml/vmlformatting.hxx | 13 +- oox/inc/oox/xls/drawingmanager.hxx | 10 +- oox/source/drawingml/chart/objectformatter.cxx | 214 ++++++++++++------------- oox/source/drawingml/color.cxx | 4 +- oox/source/drawingml/fillproperties.cxx | 121 +++----------- oox/source/drawingml/lineproperties.cxx | 148 ++++++----------- oox/source/drawingml/makefile.mk | 1 + oox/source/drawingml/shape.cxx | 30 ++-- oox/source/drawingml/shapepropertymap.cxx | 195 ++++++++++++++++++++++ oox/source/drawingml/table/tablecell.cxx | 8 +- oox/source/helper/modelobjecthelper.cxx | 18 +-- oox/source/helper/propertymap.cxx | 4 - oox/source/helper/propertyset.cxx | 49 ++---- oox/source/ppt/slidefragmenthandler.cxx | 2 +- oox/source/ppt/slidepersist.cxx | 26 +-- oox/source/token/properties.txt | 1 + oox/source/vml/vmlformatting.cxx | 11 +- oox/source/vml/vmlshape.cxx | 14 +- oox/source/xls/drawingmanager.cxx | 26 +-- 28 files changed, 649 insertions(+), 582 deletions(-) create mode 100755 oox/inc/oox/drawingml/shapepropertymap.hxx create mode 100755 oox/source/drawingml/shapepropertymap.cxx diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx index 51e9501205cf..ae5b82022f59 100644 --- a/oox/inc/oox/drawingml/color.hxx +++ b/oox/inc/oox/drawingml/color.hxx @@ -92,10 +92,10 @@ public: @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */ sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; - /** Returns true, if the color has a transparence set. */ - bool hasTransparence() const; - /** Returns the transparence of the color (0 = opaque, 100 = full transparent). */ - sal_Int16 getTransparence() const; + /** Returns true, if the color is transparent. */ + bool hasTransparency() const; + /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */ + sal_Int16 getTransparency() const; private: /** Internal helper for getColor(). */ diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx index 3ceb0e82838a..f0b66de6c273 100644 --- a/oox/inc/oox/drawingml/drawingmltypes.hxx +++ b/oox/inc/oox/drawingml/drawingmltypes.hxx @@ -167,6 +167,7 @@ inline sal_Int32 convertEmuToHmm( sal_Int64 nValue ) // ============================================================================ +/** A structure for a point with 64-bit interger components. */ struct EmuPoint { sal_Int64 X; @@ -178,6 +179,7 @@ struct EmuPoint // ============================================================================ +/** A structure for a size with 64-bit interger components. */ struct EmuSize { sal_Int64 Width; @@ -189,6 +191,7 @@ struct EmuSize // ============================================================================ +/** A structure for a rectangle with 64-bit interger components. */ struct EmuRectangle : public EmuPoint, public EmuSize { inline explicit EmuRectangle() {} diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx index d62651ebdc20..9f0271e418e8 100644 --- a/oox/inc/oox/drawingml/fillproperties.hxx +++ b/oox/inc/oox/drawingml/fillproperties.hxx @@ -36,7 +36,6 @@ namespace oox { class GraphicHelper; - class ModelObjectHelper; class PropertyMap; class PropertySet; } @@ -44,38 +43,7 @@ namespace oox { namespace oox { namespace drawingml { -// ============================================================================ - -enum FillPropertyId -{ - FillStyleId, - FillColorId, - FillTransparenceId, - FillGradientId, - FillBitmapUrlId, - FillBitmapModeId, - FillBitmapSizeXId, - FillBitmapSizeYId, - FillBitmapOffsetXId, - FillBitmapOffsetYId, - FillBitmapRectanglePointId, - FillId_END -}; - -struct FillPropertyIds -{ - const sal_Int32* mpnPropertyIds; - bool mbNamedFillGradient; - bool mbNamedFillBitmap; - - explicit FillPropertyIds( - const sal_Int32* pnPropertyIds, - bool bNamedFillGradient, - bool bNamedFillBitmap ); - - inline bool has( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } - inline sal_Int32 operator[]( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } -}; +class ShapePropertyMap; // ============================================================================ @@ -147,8 +115,6 @@ struct FillProperties PatternFillProperties maPatternProps; /// Properties for pattern fills. BlipFillProperties maBlipProps; /// Properties for bitmap fills. - static FillPropertyIds DEFAULT_IDS; /// Default fill property identifiers for shape fill. - /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const FillProperties& rSourceProps ); @@ -158,19 +124,8 @@ struct FillProperties /** Writes the properties to the passed property map. */ void pushToPropMap( - PropertyMap& rPropMap, - ModelObjectHelper& rModelObjHelper, + ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, - const FillPropertyIds& rPropIds = DEFAULT_IDS, - sal_Int32 nShapeRotation = 0, - sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; - - /** Writes the properties to the passed property set. */ - void pushToPropSet( - PropertySet& rPropSet, - ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, - const FillPropertyIds& rPropIds = DEFAULT_IDS, sal_Int32 nShapeRotation = 0, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; }; @@ -189,12 +144,6 @@ struct GraphicProperties PropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; - - /** Writes the properties to the passed property set. */ - void pushToPropSet( - PropertySet& rPropSet, - const GraphicHelper& rGraphicHelper, - sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx index 0f034a89f65b..2ddb21d2fb93 100644 --- a/oox/inc/oox/drawingml/lineproperties.hxx +++ b/oox/inc/oox/drawingml/lineproperties.hxx @@ -35,40 +35,6 @@ namespace drawingml { // ============================================================================ -enum LinePropertyId -{ - LineStyleId, - LineWidthId, - LineColorId, - LineTransparenceId, - LineDashId, - LineJointId, - LineStartId, - LineStartWidthId, - LineStartCenterId, - LineEndId, - LineEndWidthId, - LineEndCenterId, - LineId_END -}; - -struct LinePropertyIds -{ - const sal_Int32* mpnPropertyIds; - bool mbNamedLineDash; - bool mbNamedLineMarker; - - explicit LinePropertyIds( - const sal_Int32* pnPropertyIds, - bool bNamedLineDash, - bool bNamedLineMarker ); - - inline bool has( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } - inline sal_Int32 operator[]( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } -}; - -// ============================================================================ - struct LineArrowProperties { OptValue< sal_Int32 > moArrowType; @@ -96,25 +62,13 @@ struct LineProperties OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token). OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token). - static LinePropertyIds DEFAULT_IDS; /// Default line property identifiers. - /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const LineProperties& rSourceProps ); /** Writes the properties to the passed property map. */ void pushToPropMap( - PropertyMap& rPropMap, - ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, - const LinePropertyIds& rPropIds = DEFAULT_IDS, - sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; - - /** Writes the properties to the passed property map. */ - void pushToPropSet( - PropertySet& rPropSet, - ModelObjectHelper& rModelObjHelper, + ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, - const LinePropertyIds& rPropIds = DEFAULT_IDS, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const; }; diff --git a/oox/inc/oox/drawingml/shapepropertymap.hxx b/oox/inc/oox/drawingml/shapepropertymap.hxx new file mode 100755 index 000000000000..e012d4b2a9ac --- /dev/null +++ b/oox/inc/oox/drawingml/shapepropertymap.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX +#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX + +#include "oox/helper/propertymap.hxx" + +namespace oox { class ModelObjectHelper; } + +namespace oox { +namespace drawingml { + +// ============================================================================ + +/** Enumeration for various properties related to drawing shape formatting. + + This is an abstraction for shape formatting properties that have different + names in various implementations, e.g. drawing shapes vs. chart objects. + */ +enum ShapePropertyId +{ + SHAPEPROP_LineStyle, + SHAPEPROP_LineWidth, + SHAPEPROP_LineColor, + SHAPEPROP_LineTransparency, + SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container. + SHAPEPROP_LineJoint, + SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container. + SHAPEPROP_LineStartWidth, + SHAPEPROP_LineStartCenter, + SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container. + SHAPEPROP_LineEndWidth, + SHAPEPROP_LineEndCenter, + SHAPEPROP_FillStyle, + SHAPEPROP_FillColor, + SHAPEPROP_FillTransparency, + SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container. + SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container. + SHAPEPROP_FillBitmapMode, + SHAPEPROP_FillBitmapSizeX, + SHAPEPROP_FillBitmapSizeY, + SHAPEPROP_FillBitmapOffsetX, + SHAPEPROP_FillBitmapOffsetY, + SHAPEPROP_FillBitmapRectanglePoint, + SHAPEPROP_END +}; + +// ============================================================================ + +struct ShapePropertyInfo +{ + const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties. + bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker. + bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash. + bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient. + bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL. + + static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods). + + explicit ShapePropertyInfo( + const sal_Int32* pnPropertyIds, + bool bNamedLineMarker, + bool bNamedLineDash, + bool bNamedFillGradient, + bool bNamedFillBitmapUrl ); + + inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } + inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } +}; + +// ============================================================================ + +class ShapePropertyMap : public PropertyMap +{ +public: + explicit ShapePropertyMap( + ModelObjectHelper& rModelObjHelper, + const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT ); + + /** Returns true, if the specified property is supported. */ + bool supportsProperty( ShapePropertyId ePropId ) const; + + /** Returns true, if named line markers are supported, and the specified + line marker has already been inserted into the marker table. */ + bool hasNamedLineMarkerInTable( const ::rtl::OUString& rMarkerName ) const; + + /** Sets the specified shape property to the passed value. */ + bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue ); + + /** Sets the specified shape property to the passed value. */ + template< typename Type > + inline bool setProperty( ShapePropertyId ePropId, const Type& rValue ) + { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); } + + using PropertyMap::setAnyProperty; + using PropertyMap::setProperty; + using PropertyMap::operator[]; + +private: + /** Sets an explicit line marker, or creates a named line marker. */ + bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); + /** Sets an explicit line dash, or creates a named line dash. */ + bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); + /** Sets an explicit fill gradient, or creates a named fill gradient. */ + bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); + /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */ + bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); + + // not implemented, to prevent implicit conversion from enum to int + ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ); + const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const; + +private: + ModelObjectHelper& mrModelObjHelper; + ShapePropertyInfo maShapePropInfo; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx index a9ef27e8cb98..6c0d97960894 100644 --- a/oox/inc/oox/helper/modelobjecthelper.hxx +++ b/oox/inc/oox/helper/modelobjecthelper.hxx @@ -45,9 +45,9 @@ namespace oox { /** Contains tables for named drawing objects for a document model. Contains tables for named line markers, line dashes, fill gradients, and - fill bitmaps. The class is needed to handle different document models in - the same filter (e.g. embedded charts) which carry their own drawing object - tables. + fill bitmap URLs. The class is needed to handle different document models + in the same filter (e.g. embedded charts) which carry their own drawing + object tables. */ class ModelObjectHelper { @@ -72,18 +72,18 @@ public: an internal constant name with a new unused index appended. */ ::rtl::OUString insertFillGradient( const ::com::sun::star::awt::Gradient& rGradient ); - /** Inserts a new named fill bitmap, returns the bitmap name, based on an - internal constant name with a new unused index appended. */ - ::rtl::OUString insertFillBitmap( const ::rtl::OUString& rGraphicUrl ); + /** Inserts a new named fill bitmap URL, returns the bitmap name, based on + an internal constant name with a new unused index appended. */ + ::rtl::OUString insertFillBitmapUrl( const ::rtl::OUString& rGraphicUrl ); private: ObjectContainer maMarkerContainer; ObjectContainer maDashContainer; ObjectContainer maGradientContainer; - ObjectContainer maBitmapContainer; + ObjectContainer maBitmapUrlContainer; const ::rtl::OUString maDashNameBase; const ::rtl::OUString maGradientNameBase; - const ::rtl::OUString maBitmapNameBase; + const ::rtl::OUString maBitmapUrlNameBase; }; // ============================================================================ diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx index 150f5c3d9364..7480b8153656 100644 --- a/oox/inc/oox/helper/propertymap.hxx +++ b/oox/inc/oox/helper/propertymap.hxx @@ -58,7 +58,6 @@ class PropertyMap : public PropertyMapBase { public: explicit PropertyMap(); - ~PropertyMap(); /** Returns the name of the passed property identifier. */ static const ::rtl::OUString& getPropertyName( sal_Int32 nPropId ); @@ -70,11 +69,20 @@ public: /** Returns the property value of the specified property, or 0 if not found. */ const ::com::sun::star::uno::Any* getProperty( sal_Int32 nPropId ) const; + /** Sets the specified property to the passed value. Does nothing, if the + identifier is invalid. */ + inline bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) + { if( nPropId < 0 ) return false; (*this)[ nPropId ] = rValue; return true; } + /** Sets the specified property to the passed value. Does nothing, if the identifier is invalid. */ template< typename Type > - inline void setProperty( sal_Int32 nPropId, const Type& rValue ) - { if( nPropId >= 0 ) (*this)[ nPropId ] <<= rValue; } + inline bool setProperty( sal_Int32 nPropId, const Type& rValue ) + { if( nPropId < 0 ) return false; (*this)[ nPropId ] <<= rValue; return true; } + + /** Inserts all properties contained in the passed property map. */ + inline void assignUsed( const PropertyMap& rPropMap ) + { insert( rPropMap.begin(), rPropMap.end() ); } /** Returns a sequence of property values, filled with all contained properties. */ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > @@ -85,7 +93,7 @@ public: ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const; - /** Creates and fills a new instance supporting the XPropertySet interface. */ + /** Creates a property set supporting the XPropertySet interface and inserts all properties. */ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > makePropertySet() const; diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx index 8ddfaff44421..c3952e9f6723 100644 --- a/oox/inc/oox/helper/propertyset.hxx +++ b/oox/inc/oox/helper/propertyset.hxx @@ -84,21 +84,19 @@ public: // Get properties --------------------------------------------------------- /** Gets the specified property from the property set. - @return true, if the any could be filled with the property value. */ - bool getAnyProperty( ::com::sun::star::uno::Any& orValue, sal_Int32 nPropId ) const; + @return the property value, or an empty Any, if the property is missing. */ + ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const; /** Gets the specified property from the property set. @return true, if the passed variable could be filled with the property value. */ template< typename Type > - inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const; - - /** Gets the specified property from the property set. - @return the property value, or an empty Any, if the property is missing. */ - ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const; + inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const + { return getAnyProperty( nPropId ) >>= orValue; } /** Gets the specified boolean property from the property set. @return true = property contains true; false = property contains false or error occured. */ - bool getBoolProperty( sal_Int32 nPropId ) const; + inline bool getBoolProperty( sal_Int32 nPropId ) const + { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; } /** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface. @param orValues (out-parameter) The related property values. @@ -110,11 +108,12 @@ public: // Set properties --------------------------------------------------------- /** Puts the passed any into the property set. */ - void setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); + bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ); /** Puts the passed value into the property set. */ template< typename Type > - inline void setProperty( sal_Int32 nPropId, const Type& rValue ); + inline bool setProperty( sal_Int32 nPropId, const Type& rValue ) + { return setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) ); } /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface. @param rPropNames The property names. MUST be ordered alphabetically. @@ -135,10 +134,10 @@ public: private: /** Gets the specified property from the property set. @return true, if the any could be filled with the property value. */ - bool getAnyProperty( ::com::sun::star::uno::Any& orValue, const ::rtl::OUString& rPropName ) const; + bool implGetPropertyValue( ::com::sun::star::uno::Any& orValue, const ::rtl::OUString& rPropName ) const; /** Puts the passed any into the property set. */ - void setAnyProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue ); + bool implSetPropertyValue( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue ); private: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > @@ -147,21 +146,6 @@ private: mxMultiPropSet; /// The optional multi property set interface. }; -// ---------------------------------------------------------------------------- - -template< typename Type > -inline bool PropertySet::getProperty( Type& orValue, sal_Int32 nPropId ) const -{ - ::com::sun::star::uno::Any aAny; - return getAnyProperty( aAny, nPropId ) && (aAny >>= orValue); -} - -template< typename Type > -inline void PropertySet::setProperty( sal_Int32 nPropId, const Type& rValue ) -{ - setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) ); -} - // ============================================================================ } // namespace oox diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx index bcb0c5803d61..444d12546f12 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -91,7 +91,7 @@ public: void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; } oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } - oox::drawingml::Color& getBackgroundColorRef() { return maBackgroundColorRef; } + oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; } sal_Bool isMasterPage() const { return mbMaster; } sal_Bool isNotesPage() const { return mbNotes; } @@ -131,7 +131,7 @@ private: SlidePersistPtr mpMasterPagePtr; oox::drawingml::ShapePtr maShapesPtr; - oox::drawingml::Color maBackgroundColorRef; + oox::drawingml::Color maBackgroundColor; oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList; diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index 76242fca3418..7bf4135b3f81 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -30,11 +30,8 @@ #include "oox/helper/helper.hxx" -namespace oox { - class GraphicHelper; - class ModelObjectHelper; - class PropertyMap; -} +namespace oox { class GraphicHelper; } +namespace oox { namespace drawingml { class ShapePropertyMap; } } namespace oox { namespace vml { @@ -149,8 +146,7 @@ struct StrokeModel /** Writes the properties to the passed property map. */ void pushToPropMap( - PropertyMap& rPropMap, - ModelObjectHelper& rModelObjectHelper, + ::oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const; }; @@ -176,8 +172,7 @@ struct FillModel /** Writes the properties to the passed property map. */ void pushToPropMap( - PropertyMap& rPropMap, - ModelObjectHelper& rModelObjectHelper, + ::oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const; }; diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx index 0e5610d05d24..91fba91ee271 100755 --- a/oox/inc/oox/xls/drawingmanager.hxx +++ b/oox/inc/oox/xls/drawingmanager.hxx @@ -36,6 +36,8 @@ namespace com { namespace sun { namespace star { namespace drawing { class XShapes; } } } } +namespace oox { namespace drawingml { class ShapePropertyMap; } } + namespace oox { namespace xls { @@ -201,11 +203,11 @@ protected: void readMacroBiff8( BiffInputStream& rStrm ); /** Converts the passed line formatting to the passed property map. */ - void convertLineProperties( PropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const; + void convertLineProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const; /** Converts the passed fill formatting to the passed property map. */ - void convertFillProperties( PropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const; + void convertFillProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const; /** Converts the passed frame flags to the passed property map. */ - void convertFrameProperties( PropertyMap& rPropMap, sal_uInt16 nFrameFlags ) const; + void convertFrameProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, sal_uInt16 nFrameFlags ) const; /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); @@ -340,7 +342,7 @@ protected: void readFrameData( BiffInputStream& rStrm ); /** Converts fill formatting, line formatting, and frame style. */ - void convertRectProperties( PropertyMap& rPropMap ) const; + void convertRectProperties( ::oox::drawingml::ShapePropertyMap& rPropMap ) const; /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize ); diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index d96e2d43dd6f..8fd1a376abd6 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -32,14 +32,15 @@ #include #include "properties.hxx" #include "tokens.hxx" -#include "oox/helper/modelobjecthelper.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" +#include "oox/drawingml/shapepropertymap.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/textparagraph.hxx" #include "oox/drawingml/theme.hxx" #include "oox/drawingml/chart/chartspacemodel.hxx" +#include "oox/helper/modelobjecthelper.hxx" using ::rtl::OStringBuffer; using ::rtl::OUString; @@ -494,19 +495,50 @@ const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int // ---------------------------------------------------------------------------- -/** Enumerates different sets of property names for chart object formatting. */ -enum PropertyType +/** Property identifiers for common chart objects, to be used in ShapePropertyInfo. */ +static const sal_Int32 spnCommonPropIds[] = +{ + PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName, + PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, + PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradientName, + PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, + PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint +}; + +/** Property identifiers for linear data series, to be used in ShapePropertyInfo. */ +static const sal_Int32 spnLinearPropIds[] = { - PROPERTYTYPE_COMMON, /// Common objects, no special handling. - PROPERTYTYPE_LINEARSERIES, /// Specific to linear data series. - PROPERTYTYPE_FILLEDSERIES /// Specific to filled data series. + PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName, + PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, + PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, + PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, + PROP_INVALID, PROP_INVALID, PROP_INVALID }; +/** Property identifiers for filled data series, to be used in ShapePropertyInfo. */ +static const sal_Int32 spnFilledPropIds[] = +{ + PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName, + PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, + PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName, + PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, + PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint +}; + +/** Property info for common chart objects, to be used in ShapePropertyMap. */ +static const ShapePropertyInfo saCommonPropInfo( spnCommonPropIds, false, true, true, true ); +/** Property info for linear data series, to be used in ShapePropertyMap. */ +static const ShapePropertyInfo saLinearPropInfo( spnLinearPropIds, false, true, true, true ); +/** Property info for filled data series, to be used in ShapePropertyMap. */ +static const ShapePropertyInfo saFilledPropInfo( spnFilledPropIds, false, true, true, true ); + +// ---------------------------------------------------------------------------- + /** Contains information about formatting of a specific chart object type. */ struct ObjectTypeFormatEntry { ObjectType meObjType; /// Object type for automatic format. - PropertyType mePropType; /// Property type for property names. + const ShapePropertyInfo* mpPropInfo; /// Property info for the ShapePropertyMap class. const AutoFormatEntry* mpAutoLines; /// Automatic line formatting for all chart styles. const AutoFormatEntry* mpAutoFills; /// Automatic fill formatting for all chart styles. const AutoFormatEntry* mpAutoEffects; /// Automatic effect formatting for all chart styles. @@ -522,37 +554,38 @@ struct ObjectTypeFormatEntry static const ObjectTypeFormatEntry spObjTypeFormatEntries[] = { - // object type property type auto text auto line auto fill auto effect - TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, PROPERTYTYPE_COMMON, 0, spChartSpaceLines, spChartSpaceFills, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, PROPERTYTYPE_COMMON, spChartTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, PROPERTYTYPE_COMMON, spOtherTexts, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, PROPERTYTYPE_COMMON, 0, 0 /* eq to Ch2 */, spPlotArea2dFills, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA3D, PROPERTYTYPE_COMMON, 0, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_WALL, PROPERTYTYPE_COMMON, 0, 0 /* eq to Ch2 */, spWallFloorFills, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_FLOOR, PROPERTYTYPE_COMMON, 0, spFloorLines, spWallFloorFills, 0 /* eq to Ch2 */ ), - TYPEFORMAT_LINE( OBJECTTYPE_AXIS, PROPERTYTYPE_COMMON, spOtherTexts, spAxisLines ), - TYPEFORMAT_FRAME( OBJECTTYPE_AXISTITLE, PROPERTYTYPE_COMMON, spAxisTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), - TYPEFORMAT_FRAME( OBJECTTYPE_AXISUNIT, PROPERTYTYPE_COMMON, spAxisTitleTexts, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */ ), - TYPEFORMAT_LINE( OBJECTTYPE_MAJORGRIDLINE, PROPERTYTYPE_COMMON, 0, spMajorGridLines ), - TYPEFORMAT_LINE( OBJECTTYPE_MINORGRIDLINE, PROPERTYTYPE_COMMON, 0, spMinorGridLines ), - TYPEFORMAT_LINE( OBJECTTYPE_LINEARSERIES2D, PROPERTYTYPE_LINEARSERIES, 0, spLinearSeriesLines ), - TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES2D, PROPERTYTYPE_FILLEDSERIES, 0, spFilledSeriesLines, spFilledSeries2dFills, spFilledSeriesEffects ), - TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES3D, PROPERTYTYPE_FILLEDSERIES, 0, spFilledSeriesLines, spFilledSeries3dFills, spFilledSeriesEffects ), - TYPEFORMAT_FRAME( OBJECTTYPE_DATALABEL, PROPERTYTYPE_COMMON, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), - TYPEFORMAT_LINE( OBJECTTYPE_TRENDLINE, PROPERTYTYPE_COMMON, 0, spOtherLines ), - TYPEFORMAT_FRAME( OBJECTTYPE_TRENDLINELABEL, PROPERTYTYPE_COMMON, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), - TYPEFORMAT_LINE( OBJECTTYPE_ERRORBAR, PROPERTYTYPE_COMMON, 0, spOtherLines ), - TYPEFORMAT_LINE( OBJECTTYPE_SERLINE, PROPERTYTYPE_COMMON, 0, spOtherLines ), - TYPEFORMAT_LINE( OBJECTTYPE_LEADERLINE, PROPERTYTYPE_COMMON, 0, spOtherLines ), - TYPEFORMAT_LINE( OBJECTTYPE_DROPLINE, PROPERTYTYPE_COMMON, 0, spOtherLines ), - TYPEFORMAT_LINE( OBJECTTYPE_HILOLINE, PROPERTYTYPE_LINEARSERIES, 0, spOtherLines ), - TYPEFORMAT_FRAME( OBJECTTYPE_UPBAR, PROPERTYTYPE_COMMON, 0, spUpDownBarLines, spUpBarFills, spUpDownBarEffects ), - TYPEFORMAT_FRAME( OBJECTTYPE_DOWNBAR, PROPERTYTYPE_COMMON, 0, spUpDownBarLines, spDownBarFills, spUpDownBarEffects ), - TYPEFORMAT_LINE( OBJECTTYPE_DATATABLE, PROPERTYTYPE_COMMON, spOtherTexts, spChartSpaceLines ) + // object type property info auto text auto line auto fill auto effect + TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, &saCommonPropInfo, 0, spChartSpaceLines, spChartSpaceFills, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, &saCommonPropInfo, spChartTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, &saCommonPropInfo, spOtherTexts, spNoFormats, spNoFormats, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, spPlotArea2dFills, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA3D, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_WALL, &saCommonPropInfo, 0, 0 /* eq to Ch2 */, spWallFloorFills, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_FLOOR, &saCommonPropInfo, 0, spFloorLines, spWallFloorFills, 0 /* eq to Ch2 */ ), + TYPEFORMAT_LINE( OBJECTTYPE_AXIS, &saCommonPropInfo, spOtherTexts, spAxisLines ), + TYPEFORMAT_FRAME( OBJECTTYPE_AXISTITLE, &saCommonPropInfo, spAxisTitleTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), + TYPEFORMAT_FRAME( OBJECTTYPE_AXISUNIT, &saCommonPropInfo, spAxisTitleTexts, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */, 0 /* eq in Ch2 */ ), + TYPEFORMAT_LINE( OBJECTTYPE_MAJORGRIDLINE, &saCommonPropInfo, 0, spMajorGridLines ), + TYPEFORMAT_LINE( OBJECTTYPE_MINORGRIDLINE, &saCommonPropInfo, 0, spMinorGridLines ), + TYPEFORMAT_LINE( OBJECTTYPE_LINEARSERIES2D, &saLinearPropInfo, 0, spLinearSeriesLines ), + TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES2D, &saFilledPropInfo, 0, spFilledSeriesLines, spFilledSeries2dFills, spFilledSeriesEffects ), + TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES3D, &saFilledPropInfo, 0, spFilledSeriesLines, spFilledSeries3dFills, spFilledSeriesEffects ), + TYPEFORMAT_FRAME( OBJECTTYPE_DATALABEL, &saCommonPropInfo, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), + TYPEFORMAT_LINE( OBJECTTYPE_TRENDLINE, &saCommonPropInfo, 0, spOtherLines ), + TYPEFORMAT_FRAME( OBJECTTYPE_TRENDLINELABEL, &saCommonPropInfo, spOtherTexts, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */, 0 /* eq to Ch2 */ ), + TYPEFORMAT_LINE( OBJECTTYPE_ERRORBAR, &saCommonPropInfo, 0, spOtherLines ), + TYPEFORMAT_LINE( OBJECTTYPE_SERLINE, &saCommonPropInfo, 0, spOtherLines ), + TYPEFORMAT_LINE( OBJECTTYPE_LEADERLINE, &saCommonPropInfo, 0, spOtherLines ), + TYPEFORMAT_LINE( OBJECTTYPE_DROPLINE, &saCommonPropInfo, 0, spOtherLines ), + TYPEFORMAT_LINE( OBJECTTYPE_HILOLINE, &saLinearPropInfo, 0, spOtherLines ), + TYPEFORMAT_FRAME( OBJECTTYPE_UPBAR, &saCommonPropInfo, 0, spUpDownBarLines, spUpBarFills, spUpDownBarEffects ), + TYPEFORMAT_FRAME( OBJECTTYPE_DOWNBAR, &saCommonPropInfo, 0, spUpDownBarLines, spDownBarFills, spUpDownBarEffects ), + TYPEFORMAT_LINE( OBJECTTYPE_DATATABLE, &saCommonPropInfo, spOtherTexts, spChartSpaceLines ) }; #undef TYPEFORMAT_FRAME #undef TYPEFORMAT_LINE + // ---------------------------------------------------------------------------- void lclConvertPictureOptions( FillProperties& orFillProps, const PictureOptionsModel& rPicOptions ) @@ -561,15 +594,6 @@ void lclConvertPictureOptions( FillProperties& orFillProps, const PictureOptions orFillProps.maBlipProps.moBitmapMode = bStacked ? XML_tile : XML_stretch; } -// ---------------------------------------------------------------------------- - -const sal_Int32 spnCommonLineIds[ LineId_END ] = { PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID }; -const sal_Int32 spnLinearLineIds[ LineId_END ] = { PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID }; -const sal_Int32 spnFilledLineIds[ LineId_END ] = { PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID }; - -const sal_Int32 spnCommonFillIds[ FillId_END ] = { PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradientName, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint }; -const sal_Int32 spnFilledFillIds[ FillId_END ] = { PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint }; - } // namespace // ============================================================================ @@ -611,18 +635,16 @@ class LineFormatter : public DetailFormatterBase public: explicit LineFormatter( ObjectFormatterData& rData, - const AutoFormatEntry* pAutoFormatEntry, - PropertyType ePropType ); + const AutoFormatEntry* pAutoFormatEntry ); /** Converts line formatting to the passed property set. */ void convertFormatting( - PropertySet& rPropSet, + ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, sal_Int32 nSeriesIdx ); private: LinePropertiesPtr mxAutoLine; /// Automatic line properties. - LinePropertyIds& mrLinePropIds; /// Property identifiers for border/line formatting. }; // ---------------------------------------------------------------------------- @@ -632,19 +654,17 @@ class FillFormatter : public DetailFormatterBase public: explicit FillFormatter( ObjectFormatterData& rData, - const AutoFormatEntry* pAutoFormatEntry, - PropertyType ePropType ); + const AutoFormatEntry* pAutoFormatEntry ); /** Converts area formatting to the passed property set. */ void convertFormatting( - PropertySet& rPropSet, + ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx ); private: FillPropertiesPtr mxAutoFill; /// Automatic fill properties. - FillPropertyIds& mrFillPropIds; /// Property identifiers for fill formatting. }; // ---------------------------------------------------------------------------- @@ -654,12 +674,11 @@ class EffectFormatter : public DetailFormatterBase public: explicit EffectFormatter( ObjectFormatterData& rData, - const AutoFormatEntry* pAutoFormatEntry, - PropertyType ePropType ); + const AutoFormatEntry* pAutoFormatEntry ); /** Converts effect formatting to the passed property set. */ void convertFormatting( - PropertySet& rPropSet, + ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, sal_Int32 nSeriesIdx ); }; @@ -736,6 +755,7 @@ private: FillFormatter maFillFormatter; /// Converter for fill formatting. EffectFormatter maEffectFormatter; /// Converter for effect formatting. TextFormatter maTextFormatter; /// Converter for text formatting. + ModelObjectHelper& mrModelObjHelper; /// Helper for named drawing formatting. const ObjectTypeFormatEntry& mrEntry; /// Additional settings. }; @@ -748,11 +768,6 @@ struct ObjectFormatterData const XmlFilterBase& mrFilter; /// Base filter object. ObjectTypeFormatterMap maTypeFormatters; /// Formatters for all types of objects in a chart. ModelObjectHelper maModelObjHelper; /// Helper for named drawing formatting (dashes, gradients, bitmaps). - LinePropertyIds maCommonLineIds; /// Property identifiers for common border formatting. - LinePropertyIds maLinearLineIds; /// Property identifiers for line formatting of linear series. - LinePropertyIds maFilledLineIds; /// Property identifiers for line formatting of filled series. - FillPropertyIds maCommonFillIds; /// Property identifiers for common area fill. - FillPropertyIds maFilledFillIds; /// Property identifiers for area fill of filled series. Reference< XNumberFormats > mxNumFmts; /// Number formats collection of container document. Reference< XNumberFormatTypes > mxNumTypes; /// Number format types collection of container document. Locale maEnUsLocale; /// Locale struct containing en-US. @@ -765,9 +780,6 @@ struct ObjectFormatterData const ChartSpaceModel& rChartSpace ); ObjectTypeFormatter* getTypeFormatter( ObjectType eObjType ); - - LinePropertyIds& getLinePropertyIds( PropertyType ePropType ); - FillPropertyIds& getFillPropertyIds( PropertyType ePropType ); }; // ============================================================================ @@ -864,9 +876,8 @@ sal_Int32 DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32 // ============================================================================ -LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, PropertyType ePropType ) : - DetailFormatterBase( rData, pAutoFormatEntry ), - mrLinePropIds( rData.getLinePropertyIds( ePropType ) ) +LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) : + DetailFormatterBase( rData, pAutoFormatEntry ) { if( pAutoFormatEntry ) { @@ -881,21 +892,20 @@ LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* } } -void LineFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, sal_Int32 nSeriesIdx ) +void LineFormatter::convertFormatting( ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, sal_Int32 nSeriesIdx ) { LineProperties aLineProps; if( mxAutoLine.get() ) aLineProps.assignUsed( *mxAutoLine ); if( rxShapeProp.is() ) aLineProps.assignUsed( rxShapeProp->getLineProperties() ); - aLineProps.pushToPropSet( rPropSet, mrData.maModelObjHelper, mrData.mrFilter.getGraphicHelper(), mrLinePropIds, getPhColor( nSeriesIdx ) ); + aLineProps.pushToPropMap( rPropMap, mrData.mrFilter.getGraphicHelper(), getPhColor( nSeriesIdx ) ); } // ============================================================================ -FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, PropertyType ePropType ) : - DetailFormatterBase( rData, pAutoFormatEntry ), - mrFillPropIds( rData.getFillPropertyIds( ePropType ) ) +FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) : + DetailFormatterBase( rData, pAutoFormatEntry ) { if( pAutoFormatEntry ) { @@ -907,7 +917,7 @@ FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* } } -void FillFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx ) +void FillFormatter::convertFormatting( ShapePropertyMap& rPropMap, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx ) { FillProperties aFillProps; if( mxAutoFill.get() ) @@ -916,17 +926,17 @@ void FillFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh aFillProps.assignUsed( rxShapeProp->getFillProperties() ); if( pPicOptions ) lclConvertPictureOptions( aFillProps, *pPicOptions ); - aFillProps.pushToPropSet( rPropSet, mrData.maModelObjHelper, mrData.mrFilter.getGraphicHelper(), mrFillPropIds, 0, getPhColor( nSeriesIdx ) ); + aFillProps.pushToPropMap( rPropMap, mrData.mrFilter.getGraphicHelper(), 0, getPhColor( nSeriesIdx ) ); } // ============================================================================ -EffectFormatter::EffectFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, PropertyType /*ePropType*/ ) : +EffectFormatter::EffectFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) : DetailFormatterBase( rData, pAutoFormatEntry ) { } -void EffectFormatter::convertFormatting( PropertySet& /*rPropSet*/, const ModelRef< Shape >& /*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ ) +void EffectFormatter::convertFormatting( ShapePropertyMap& /*rPropMap*/, const ModelRef< Shape >& /*rxShapeProp*/, sal_Int32 /*nSeriesIdx*/ ) { } @@ -984,20 +994,23 @@ void TextFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Te // ============================================================================ ObjectTypeFormatter::ObjectTypeFormatter( ObjectFormatterData& rData, const ObjectTypeFormatEntry& rEntry, const ChartSpaceModel& rChartSpace ) : - maLineFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoLines, rChartSpace.mnStyle ), rEntry.mePropType ), - maFillFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoFills, rChartSpace.mnStyle ), rEntry.mePropType ), - maEffectFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoEffects, rChartSpace.mnStyle ), rEntry.mePropType ), + maLineFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoLines, rChartSpace.mnStyle ) ), + maFillFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoFills, rChartSpace.mnStyle ) ), + maEffectFormatter( rData, lclGetAutoFormatEntry( rEntry.mpAutoEffects, rChartSpace.mnStyle ) ), maTextFormatter( rData, lclGetAutoTextEntry( rEntry.mpAutoTexts, rChartSpace.mnStyle ), rChartSpace.mxTextProp ), + mrModelObjHelper( rData.maModelObjHelper ), mrEntry( rEntry ) { } void ObjectTypeFormatter::convertFrameFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx ) { - maLineFormatter.convertFormatting( rPropSet, rxShapeProp, nSeriesIdx ); + ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo ); + maLineFormatter.convertFormatting( aPropMap, rxShapeProp, nSeriesIdx ); if( mrEntry.mbIsFrame ) - maFillFormatter.convertFormatting( rPropSet, rxShapeProp, pPicOptions, nSeriesIdx ); - maEffectFormatter.convertFormatting( rPropSet, rxShapeProp, nSeriesIdx ); + maFillFormatter.convertFormatting( aPropMap, rxShapeProp, pPicOptions, nSeriesIdx ); + maEffectFormatter.convertFormatting( aPropMap, rxShapeProp, nSeriesIdx ); + rPropSet.setProperties( aPropMap ); } void ObjectTypeFormatter::convertTextFormatting( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp ) @@ -1018,16 +1031,20 @@ void ObjectTypeFormatter::convertTextFormatting( PropertySet& rPropSet, const Te void ObjectTypeFormatter::convertAutomaticLine( PropertySet& rPropSet, sal_Int32 nSeriesIdx ) { + ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo ); ModelRef< Shape > xShapeProp; - maLineFormatter.convertFormatting( rPropSet, xShapeProp, nSeriesIdx ); - maEffectFormatter.convertFormatting( rPropSet, xShapeProp, nSeriesIdx ); + maLineFormatter.convertFormatting( aPropMap, xShapeProp, nSeriesIdx ); + maEffectFormatter.convertFormatting( aPropMap, xShapeProp, nSeriesIdx ); + rPropSet.setProperties( aPropMap ); } void ObjectTypeFormatter::convertAutomaticFill( PropertySet& rPropSet, sal_Int32 nSeriesIdx ) { + ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo ); ModelRef< Shape > xShapeProp; - maFillFormatter.convertFormatting( rPropSet, xShapeProp, 0, nSeriesIdx ); - maEffectFormatter.convertFormatting( rPropSet, xShapeProp, nSeriesIdx ); + maFillFormatter.convertFormatting( aPropMap, xShapeProp, 0, nSeriesIdx ); + maEffectFormatter.convertFormatting( aPropMap, xShapeProp, nSeriesIdx ); + rPropSet.setProperties( aPropMap ); } // ============================================================================ @@ -1035,11 +1052,6 @@ void ObjectTypeFormatter::convertAutomaticFill( PropertySet& rPropSet, sal_Int32 ObjectFormatterData::ObjectFormatterData( const XmlFilterBase& rFilter, const Reference< XChartDocument >& rxChartDoc, const ChartSpaceModel& rChartSpace ) : mrFilter( rFilter ), maModelObjHelper( Reference< XMultiServiceFactory >( rxChartDoc, UNO_QUERY ) ), - maCommonLineIds( spnCommonLineIds, true, false ), - maLinearLineIds( spnLinearLineIds, true, false ), - maFilledLineIds( spnFilledLineIds, true, false ), - maCommonFillIds( spnCommonFillIds, true, true ), - maFilledFillIds( spnFilledFillIds, true, true ), maEnUsLocale( CREATE_OUSTRING( "en" ), CREATE_OUSTRING( "US" ), OUString() ), mnMaxSeriesIdx( -1 ) { @@ -1065,28 +1077,6 @@ ObjectTypeFormatter* ObjectFormatterData::getTypeFormatter( ObjectType eObjType return maTypeFormatters.get( eObjType ).get(); } -LinePropertyIds& ObjectFormatterData::getLinePropertyIds( PropertyType ePropType ) -{ - switch( ePropType ) - { - case PROPERTYTYPE_COMMON: return maCommonLineIds; - case PROPERTYTYPE_LINEARSERIES: return maLinearLineIds; - case PROPERTYTYPE_FILLEDSERIES: return maFilledLineIds; - } - return maCommonLineIds; -} - -FillPropertyIds& ObjectFormatterData::getFillPropertyIds( PropertyType ePropType ) -{ - switch( ePropType ) - { - case PROPERTYTYPE_COMMON: return maCommonFillIds; - case PROPERTYTYPE_LINEARSERIES: return maCommonFillIds; - case PROPERTYTYPE_FILLEDSERIES: return maFilledFillIds; - } - return maCommonFillIds; -} - // ============================================================================ ObjectFormatter::ObjectFormatter( const XmlFilterBase& rFilter, const Reference< XChartDocument >& rxChartDoc, const ChartSpaceModel& rChartSpace ) : @@ -1165,7 +1155,7 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat; if( rNumberFormat.mbSourceLinked || (rNumberFormat.maFormatCode.getLength() == 0) ) { - rPropSet.setProperty( nPropId, Any() ); + rPropSet.setAnyProperty( nPropId, Any() ); } else try { diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 8653d787517d..ad626b670fae 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -512,12 +512,12 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr return mnC1; } -bool Color::hasTransparence() const +bool Color::hasTransparency() const { return mnAlpha < MAX_PERCENT; } -sal_Int16 Color::getTransparence() const +sal_Int16 Color::getTransparency() const { return static_cast< sal_Int16 >( (MAX_PERCENT - mnAlpha) / PER_PERCENT ); } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 08d001f09a62..4285286c623d 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -39,10 +39,8 @@ #include "properties.hxx" #include "tokens.hxx" #include "oox/helper/graphichelper.hxx" -#include "oox/helper/modelobjecthelper.hxx" -#include "oox/helper/propertymap.hxx" -#include "oox/helper/propertyset.hxx" #include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/shapepropertymap.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::drawing; @@ -62,21 +60,6 @@ namespace drawingml { namespace { -static const sal_Int32 spnDefaultFillIds[ FillId_END ] = -{ - PROP_FillStyle, - PROP_FillColor, - PROP_FillTransparence, - PROP_FillGradient, - PROP_FillBitmapURL, - PROP_FillBitmapMode, - PROP_FillBitmapSizeX, - PROP_FillBitmapSizeY, - PROP_FillBitmapPositionOffsetX, - PROP_FillBitmapPositionOffsetY, - PROP_FillBitmapRectanglePoint -}; - BitmapMode lclGetBitmapMode( sal_Int32 nToken ) { switch( nToken ) @@ -130,16 +113,6 @@ const awt::Size lclGetOriginalSize( const GraphicHelper& rGraphicHelper, const R // ============================================================================ -FillPropertyIds::FillPropertyIds( const sal_Int32* pnPropertyIds, bool bNamedFillGradient, bool bNamedFillBitmap ) : - mpnPropertyIds( pnPropertyIds ), - mbNamedFillGradient( bNamedFillGradient ), - mbNamedFillBitmap( bNamedFillBitmap ) -{ - OSL_ENSURE( mpnPropertyIds != 0, "FillPropertyIds::FillPropertyIds - missing property identifiers" ); -} - -// ============================================================================ - void GradientFillProperties::assignUsed( const GradientFillProperties& rSourceProps ) { if( !rSourceProps.maGradientStops.empty() ) @@ -186,8 +159,6 @@ void BlipFillProperties::assignUsed( const BlipFillProperties& rSourceProps ) // ============================================================================ -FillPropertyIds FillProperties::DEFAULT_IDS( spnDefaultFillIds, false, false ); - void FillProperties::assignUsed( const FillProperties& rSourceProps ) { moFillType.assignIfUsed( rSourceProps.moFillType ); @@ -216,9 +187,8 @@ Color FillProperties::getBestSolidColor() const return aSolidColor; } -void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, const FillPropertyIds& rPropIds, - sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const +void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, + const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const { if( moFillType.has() ) { @@ -232,16 +202,16 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM case XML_solidFill: if( maFillColor.isUsed() ) { - rPropMap.setProperty( rPropIds[ FillColorId ], maFillColor.getColor( rGraphicHelper, nPhClr ) ); - if( maFillColor.hasTransparence() ) - rPropMap.setProperty( rPropIds[ FillTransparenceId ], maFillColor.getTransparence() ); + rPropMap.setProperty( SHAPEPROP_FillColor, maFillColor.getColor( rGraphicHelper, nPhClr ) ); + if( maFillColor.hasTransparency() ) + rPropMap.setProperty( SHAPEPROP_FillTransparency, maFillColor.getTransparency() ); eFillStyle = FillStyle_SOLID; } break; case XML_gradFill: // do not create gradient struct if property is not supported... - if( rPropIds.has( FillGradientId ) ) + if( rPropMap.supportsProperty( SHAPEPROP_FillGradient ) ) { awt::Gradient aGradient; aGradient.Angle = 900; @@ -291,62 +261,35 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM aGradient.Angle = static_cast< sal_Int16 >( (4500 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 ); // push gradient or named gradient to property map - if( rPropIds.mbNamedFillGradient ) - { - OUString aGradientName = rModelObjHelper.insertFillGradient( aGradient ); - if( aGradientName.getLength() > 0 ) - { - rPropMap.setProperty( rPropIds[ FillGradientId ], aGradientName ); - eFillStyle = FillStyle_GRADIENT; - } - } - else - { - rPropMap.setProperty( rPropIds[ FillGradientId ], aGradient ); + if( rPropMap.setProperty( SHAPEPROP_FillGradient, aGradient ) ) eFillStyle = FillStyle_GRADIENT; - } } break; case XML_blipFill: // do not start complex graphic transformation if property is not supported... - if( maBlipProps.mxGraphic.is() && rPropIds.has( FillBitmapUrlId ) ) + if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapUrl ) ) { // TODO: "rotate with shape" is not possible with our current core OUString aGraphicUrl = rGraphicHelper.createGraphicObject( maBlipProps.mxGraphic ); - if( aGraphicUrl.getLength() > 0 ) - { - // push bitmap or named bitmap to property map - if( rPropIds.mbNamedFillBitmap ) - { - OUString aBitmapName = rModelObjHelper.insertFillBitmap( aGraphicUrl ); - if( aBitmapName.getLength() > 0 ) - { - rPropMap.setProperty( rPropIds[ FillBitmapUrlId ], aBitmapName ); - eFillStyle = FillStyle_BITMAP; - } - } - else - { - rPropMap.setProperty( rPropIds[ FillBitmapUrlId ], aGraphicUrl ); - eFillStyle = FillStyle_BITMAP; - } - } + // push bitmap or named bitmap to property map + if( (aGraphicUrl.getLength() > 0) && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) ) + eFillStyle = FillStyle_BITMAP; // set other bitmap properties, if bitmap has been inserted into the map if( eFillStyle == FillStyle_BITMAP ) { // bitmap mode (single, repeat, stretch) BitmapMode eBitmapMode = lclGetBitmapMode( maBlipProps.moBitmapMode.get( XML_TOKEN_INVALID ) ); - rPropMap.setProperty( rPropIds[ FillBitmapModeId ], eBitmapMode ); + rPropMap.setProperty( SHAPEPROP_FillBitmapMode, eBitmapMode ); // additional settings for repeated bitmap if( eBitmapMode == BitmapMode_REPEAT ) { // anchor position inside bitmap RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.get( XML_tl ) ); - rPropMap.setProperty( rPropIds[ FillBitmapRectanglePointId ], eRectPoint ); + rPropMap.setProperty( SHAPEPROP_FillBitmapRectanglePoint, eRectPoint ); awt::Size aOriginalSize = lclGetOriginalSize( rGraphicHelper, maBlipProps.mxGraphic ); if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) ) @@ -354,16 +297,16 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM // size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm double fScaleX = maBlipProps.moTileScaleX.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1, SAL_MAX_INT32 ); - rPropMap.setProperty( rPropIds[ FillBitmapSizeXId ], nFillBmpSizeX ); + rPropMap.setProperty( SHAPEPROP_FillBitmapSizeX, nFillBmpSizeX ); double fScaleY = maBlipProps.moTileScaleY.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT ); sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 ); - rPropMap.setProperty( rPropIds[ FillBitmapSizeYId ], nFillBmpSizeY ); + rPropMap.setProperty( SHAPEPROP_FillBitmapSizeY, nFillBmpSizeY ); // offset of the first bitmap tile (given as EMUs), convert to percent sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 ); - rPropMap.setProperty( rPropIds[ FillBitmapOffsetXId ], nTileOffsetX ); + rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetX, nTileOffsetX ); sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 ); - rPropMap.setProperty( rPropIds[ FillBitmapOffsetYId ], nTileOffsetY ); + rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetY, nTileOffsetY ); } } } @@ -376,9 +319,9 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM Color aColor = getBestSolidColor(); if( aColor.isUsed() ) { - rPropMap.setProperty( rPropIds[ FillColorId ], aColor.getColor( rGraphicHelper, nPhClr ) ); - if( aColor.hasTransparence() ) - rPropMap.setProperty( rPropIds[ FillTransparenceId ], aColor.getTransparence() ); + rPropMap.setProperty( SHAPEPROP_FillColor, aColor.getColor( rGraphicHelper, nPhClr ) ); + if( aColor.hasTransparency() ) + rPropMap.setProperty( SHAPEPROP_FillTransparency, aColor.getTransparency() ); eFillStyle = FillStyle_SOLID; } } @@ -391,19 +334,10 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM } // set final fill style property - rPropMap.setProperty( rPropIds[ FillStyleId ], eFillStyle ); + rPropMap.setProperty( SHAPEPROP_FillStyle, eFillStyle ); } } -void FillProperties::pushToPropSet( PropertySet& rPropSet, ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, const FillPropertyIds& rPropIds, - sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const -{ - PropertyMap aPropMap; - pushToPropMap( aPropMap, rModelObjHelper, rGraphicHelper, rPropIds, nShapeRotation, nPhClr ); - rPropSet.setProperties( aPropMap ); -} - // ============================================================================ void GraphicProperties::assignUsed( const GraphicProperties& rSourceProps ) @@ -421,9 +355,9 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe { sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr ); sal_Int32 nToColor = maBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr ); - if ( (nFromColor != nToColor) || maBlipProps.maColorChangeTo.hasTransparence() ) try + if ( (nFromColor != nToColor) || maBlipProps.maColorChangeTo.hasTransparency() ) try { - sal_Int16 nToTransparence = maBlipProps.maColorChangeTo.getTransparence(); + sal_Int16 nToTransparence = maBlipProps.maColorChangeTo.getTransparency(); sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) / 39.062 ); // ?!? correct ?!? Reference< XGraphicTransformer > xTransformer( maBlipProps.mxGraphic, UNO_QUERY_THROW ); xGraphic = xTransformer->colorChange( maBlipProps.mxGraphic, nFromColor, 9, nToColor, nToAlpha ); @@ -476,13 +410,6 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe rPropMap[ PROP_AdjustContrast ] <<= nContrast; } -void GraphicProperties::pushToPropSet( PropertySet& rPropSet, const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const -{ - PropertyMap aPropMap; - pushToPropMap( aPropMap, rGraphicHelper, nPhClr ); - rPropSet.setProperties( aPropMap ); -} - // ============================================================================ } // namespace drawingml diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index a0836612fafb..c24166e4a8c0 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -28,6 +28,7 @@ #include "oox/drawingml/lineproperties.hxx" #include #include +#include #include #include #include @@ -38,12 +39,11 @@ #include "properties.hxx" #include "tokens.hxx" #include "oox/helper/graphichelper.hxx" -#include "oox/helper/modelobjecthelper.hxx" -#include "oox/helper/propertymap.hxx" -#include "oox/helper/propertyset.hxx" #include "oox/core/namespaces.hxx" #include "oox/drawingml/drawingmltypes.hxx" +#include "oox/drawingml/shapepropertymap.hxx" +using namespace ::com::sun::star::beans; using namespace ::com::sun::star::drawing; using ::rtl::OUString; @@ -60,24 +60,6 @@ namespace drawingml { namespace { -static const sal_Int32 spnDefaultLineIds[ LineId_END ] = -{ - PROP_LineStyle, - PROP_LineWidth, - PROP_LineColor, - PROP_LineTransparence, - PROP_LineDash, - PROP_LineJoint, - PROP_LineStartName, - PROP_LineStartWidth, - PROP_LineStartCenter, - PROP_LineEndName, - PROP_LineEndWidth, - PROP_LineEndCenter -}; - -// ---------------------------------------------------------------------------- - void lclSetDashData( LineDash& orLineDash, sal_Int16 nDots, sal_Int32 nDotLen, sal_Int16 nDashes, sal_Int32 nDashLen, sal_Int32 nDistance ) { @@ -196,15 +178,16 @@ sal_Int32 lclGetArrowSize( sal_Int32 nToken ) // ---------------------------------------------------------------------------- -void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& rArrowProps, - ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nLineWidth, bool bLineEnd ) +void lclPushMarkerProperties( ShapePropertyMap& rPropMap, + const LineArrowProperties& rArrowProps, sal_Int32 nLineWidth, bool bLineEnd ) { - PolyPolygonBezierCoords aMarker; - OUString aMarkerName; - sal_Int32 nMarkerWidth = 0; - bool bMarkerCenter = false; + /* Store the marker polygon and the marker name in a single value, to be + able to pass both to the ShapePropertyMap::setProperty() function. */ + NamedValue aNamedMarker; OUStringBuffer aBuffer; + sal_Int32 nMarkerWidth = 0; + bool bMarkerCenter = false; sal_Int32 nArrowType = rArrowProps.moArrowType.get( XML_none ); switch( nArrowType ) { @@ -234,7 +217,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& sal_Int32 nNameIndex = nWidth * 3 + nLength + 1; aBuffer.append( sal_Unicode( ' ' ) ).append( nNameIndex ); - aMarkerName = aBuffer.makeStringAndClear(); + OUString aMarkerName = aBuffer.makeStringAndClear(); bool bIsArrow = nArrowType == XML_arrow; double fArrowLength = 1.0; @@ -255,8 +238,11 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& sal_Int32 nBaseLineWidth = ::std::max< sal_Int32 >( nLineWidth, 70 ); nMarkerWidth = static_cast< sal_Int32 >( fArrowWidth * nBaseLineWidth ); - // test if the arrow already exists, do not create it again in this case - if( !rPropIds.mbNamedLineMarker || !rModelObjHelper.hasLineMarker( aMarkerName ) ) + /* Test if the marker already exists in the marker table, do not + create it again in this case. If markers are inserted explicitly + instead by their name, the polygon will be created always. + TODO: this can be optimized by using a map. */ + if( !rPropMap.hasNamedLineMarkerInTable( aMarkerName ) ) { // pass X and Y as percentage to OOX_ARROW_POINT #define OOX_ARROW_POINT( x, y ) Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) ) @@ -311,46 +297,44 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& } #undef OOX_ARROW_POINT - OSL_ENSURE( !aPoints.empty(), "ApiLineMarkerProperties::ApiLineMarkerProperties - missing arrow coordinates" ); + OSL_ENSURE( !aPoints.empty(), "lclPushMarkerProperties - missing arrow coordinates" ); if( !aPoints.empty() ) { - aMarker.Coordinates.realloc( 1 ); - aMarker.Coordinates[ 0 ] = ContainerHelper::vectorToSequence( aPoints ); + PolyPolygonBezierCoords aMarkerCoords; + aMarkerCoords.Coordinates.realloc( 1 ); + aMarkerCoords.Coordinates[ 0 ] = ContainerHelper::vectorToSequence( aPoints ); ::std::vector< PolygonFlags > aFlags( aPoints.size(), PolygonFlags_NORMAL ); - aMarker.Flags.realloc( 1 ); - aMarker.Flags[ 0 ] = ContainerHelper::vectorToSequence( aFlags ); + aMarkerCoords.Flags.realloc( 1 ); + aMarkerCoords.Flags[ 0 ] = ContainerHelper::vectorToSequence( aFlags ); - if( rPropIds.mbNamedLineMarker && !rModelObjHelper.insertLineMarker( aMarkerName, aMarker ) ) - aMarkerName = OUString(); - } - else - { - aMarkerName = OUString(); + aNamedMarker.Name = aMarkerName; + aNamedMarker.Value <<= aMarkerCoords; } } + else + { + /* Named marker object exists already in the marker table, pass + its name only. This will set the name as property value, but + does not create a new object in the marker table. */ + aNamedMarker.Name = aMarkerName; + } } - // push the properties (filled aMarkerName indicates valid marker) - if( aMarkerName.getLength() > 0 ) + // push the properties (filled aNamedMarker.Name indicates valid marker) + if( aNamedMarker.Name.getLength() > 0 ) { if( bLineEnd ) { - if( rPropIds.mbNamedLineMarker ) - rPropMap.setProperty( rPropIds[ LineEndId ], aMarkerName ); - else - rPropMap.setProperty( rPropIds[ LineEndId ], aMarker ); - rPropMap.setProperty( rPropIds[ LineEndWidthId ], nMarkerWidth ); - rPropMap.setProperty( rPropIds[ LineEndCenterId ], bMarkerCenter ); + rPropMap.setProperty( SHAPEPROP_LineEnd, aNamedMarker ); + rPropMap.setProperty( SHAPEPROP_LineEndWidth, nMarkerWidth ); + rPropMap.setProperty( SHAPEPROP_LineEndCenter, bMarkerCenter ); } else { - if( rPropIds.mbNamedLineMarker ) - rPropMap.setProperty( rPropIds[ LineStartId ], aMarkerName ); - else - rPropMap.setProperty( rPropIds[ LineStartId ], aMarker ); - rPropMap.setProperty( rPropIds[ LineStartWidthId ], nMarkerWidth ); - rPropMap.setProperty( rPropIds[ LineStartCenterId ], bMarkerCenter ); + rPropMap.setProperty( SHAPEPROP_LineStart, aNamedMarker ); + rPropMap.setProperty( SHAPEPROP_LineStartWidth, nMarkerWidth ); + rPropMap.setProperty( SHAPEPROP_LineStartCenter, bMarkerCenter ); } } } @@ -359,16 +343,6 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& // ============================================================================ -LinePropertyIds::LinePropertyIds( const sal_Int32* pnPropertyIds, bool bNamedLineDash, bool bNamedLineMarker ) : - mpnPropertyIds( pnPropertyIds ), - mbNamedLineDash( bNamedLineDash ), - mbNamedLineMarker( bNamedLineMarker ) -{ - OSL_ENSURE( mpnPropertyIds != 0, "LinePropertyIds::LinePropertyIds - missing property identifiers" ); -} - -// ============================================================================ - void LineArrowProperties::assignUsed( const LineArrowProperties& rSourceProps ) { moArrowType.assignIfUsed( rSourceProps.moArrowType ); @@ -378,8 +352,6 @@ void LineArrowProperties::assignUsed( const LineArrowProperties& rSourceProps ) // ============================================================================ -LinePropertyIds LineProperties::DEFAULT_IDS( spnDefaultLineIds, false, true ); - void LineProperties::assignUsed( const LineProperties& rSourceProps ) { maStartArrow.assignUsed( rSourceProps.maStartArrow ); @@ -394,8 +366,8 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps ) moLineJoint.assignIfUsed( rSourceProps.moLineJoint ); } -void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const +void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, + const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const { // line fill type must exist, otherwise ignore other properties if( maLineFill.moFillType.has() ) @@ -424,55 +396,35 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM aLineDash.DashLen *= nBaseLineWidth; aLineDash.Distance *= nBaseLineWidth; - if( rPropIds.mbNamedLineDash ) - { - OUString aDashName = rModelObjHelper.insertLineDash( aLineDash ); - if( aDashName.getLength() > 0 ) - { - rPropMap.setProperty( rPropIds[ LineDashId ], aDashName ); - eLineStyle = LineStyle_DASH; - } - } - else - { - rPropMap.setProperty( rPropIds[ LineDashId ], aLineDash ); + if( rPropMap.setProperty( SHAPEPROP_LineDash, aLineDash ) ) eLineStyle = LineStyle_DASH; - } } // set final line style property - rPropMap.setProperty( rPropIds[ LineStyleId ], eLineStyle ); + rPropMap.setProperty( SHAPEPROP_LineStyle, eLineStyle ); // line joint type if( moLineJoint.has() ) - rPropMap.setProperty( rPropIds[ LineJointId ], lclGetLineJoint( moLineJoint.get() ) ); + rPropMap.setProperty( SHAPEPROP_LineJoint, lclGetLineJoint( moLineJoint.get() ) ); // line width in 1/100mm - rPropMap.setProperty( rPropIds[ LineWidthId ], nLineWidth ); + rPropMap.setProperty( SHAPEPROP_LineWidth, nLineWidth ); // line color and transparence Color aLineColor = maLineFill.getBestSolidColor(); if( aLineColor.isUsed() ) { - rPropMap.setProperty( rPropIds[ LineColorId ], aLineColor.getColor( rGraphicHelper, nPhClr ) ); - if( aLineColor.hasTransparence() ) - rPropMap.setProperty( rPropIds[ LineTransparenceId ], aLineColor.getTransparence() ); + rPropMap.setProperty( SHAPEPROP_LineColor, aLineColor.getColor( rGraphicHelper, nPhClr ) ); + if( aLineColor.hasTransparency() ) + rPropMap.setProperty( SHAPEPROP_LineTransparency, aLineColor.getTransparency() ); } // line markers - lclPushMarkerProperties( rPropMap, maStartArrow, rModelObjHelper, rPropIds, nLineWidth, false ); - lclPushMarkerProperties( rPropMap, maEndArrow, rModelObjHelper, rPropIds, nLineWidth, true ); + lclPushMarkerProperties( rPropMap, maStartArrow, nLineWidth, false ); + lclPushMarkerProperties( rPropMap, maEndArrow, nLineWidth, true ); } } -void LineProperties::pushToPropSet( PropertySet& rPropSet, ModelObjectHelper& rModelObjHelper, - const GraphicHelper& rGraphicHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const -{ - PropertyMap aPropMap; - pushToPropMap( aPropMap, rModelObjHelper, rGraphicHelper, rPropIds, nPhClr ); - rPropSet.setProperties( aPropMap ); -} - // ============================================================================ } // namespace drawingml diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk index e2d4ea6b8f3d..0546fb4c233d 100644 --- a/oox/source/drawingml/makefile.mk +++ b/oox/source/drawingml/makefile.mk @@ -62,6 +62,7 @@ SLOFILES = \ $(SLO)$/shapecontext.obj\ $(SLO)$/shapegroupcontext.obj\ $(SLO)$/shapepropertiescontext.obj\ + $(SLO)$/shapepropertymap.obj\ $(SLO)$/shapestylecontext.obj\ $(SLO)$/spdefcontext.obj\ $(SLO)$/textbody.obj\ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 4d15886a641a..af44469a6ced 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -30,6 +30,7 @@ #include "oox/drawingml/theme.hxx" #include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" +#include "oox/drawingml/shapepropertymap.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/table/tableproperties.hxx" #include "oox/core/namespaces.hxx" @@ -397,7 +398,6 @@ Reference< XShape > Shape::createAndInsert( } } - ModelObjectHelper& rModelObjectHelper = rFilterBase.getModelObjectHelper(); const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper(); LineProperties aLineProperties; @@ -432,33 +432,23 @@ Reference< XShape > Shape::createAndInsert( aLineProperties.assignUsed( getLineProperties() ); aFillProperties.assignUsed( getFillProperties() ); - PropertyMap aShapeProperties; - PropertyMap::const_iterator aShapePropIter; + ShapePropertyMap aShapeProps( rFilterBase.getModelObjectHelper() ); if( mxCreateCallback.get() ) - { - for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin(); - aShapePropIter != mxCreateCallback->getShapeProperties().end(); aShapePropIter++ ) - aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; - } + aShapeProps.assignUsed( mxCreateCallback->getShapeProperties() ); // add properties from textbody to shape properties if( mpTextBody.get() ) - { - for ( aShapePropIter = mpTextBody->getTextProperties().maPropertyMap.begin(); - aShapePropIter != mpTextBody->getTextProperties().maPropertyMap.end(); aShapePropIter++ ) - aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; - } + aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap ); - aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); // applying properties - PropertySet aPropSet( xSet ); + aShapeProps.assignUsed( getShapeProperties() ); if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) - mpGraphicPropertiesPtr->pushToPropSet( aPropSet, rGraphicHelper ); + mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper ); if ( mpTablePropertiesPtr.get() && ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.TableShape" ) ) ) mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle ); - aFillProperties.pushToPropSet( aPropSet, rModelObjectHelper, rGraphicHelper, FillProperties::DEFAULT_IDS, mnRotation, nFillPhClr ); - aLineProperties.pushToPropSet( aPropSet, rModelObjectHelper, rGraphicHelper, LineProperties::DEFAULT_IDS, nLinePhClr ); + aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr ); + aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr ); // applying autogrowheight property before setting shape size, because // the shape size might be changed if currently autogrowheight is true @@ -466,12 +456,12 @@ Reference< XShape > Shape::createAndInsert( Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() ); const OUString& rPropName = PropertyMap::getPropertyName( PROP_TextAutoGrowHeight ); if( xSetInfo.is() && xSetInfo->hasPropertyByName( rPropName ) ) - if( /*const Any* pAutoGrowHeight =*/ aShapeProperties.getProperty( PROP_TextAutoGrowHeight ) ) + if( aShapeProps.hasProperty( PROP_TextAutoGrowHeight ) ) xSet->setPropertyValue( rPropName, Any( false ) ); // do not set properties at a group shape (this causes assertions from svx) if( aServiceName != OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) - aPropSet.setProperties( aShapeProperties ); + PropertySet( xSet ).setProperties( aShapeProps ); if( bIsCustomShape ) { diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx new file mode 100755 index 000000000000..9d2397cf5f7e --- /dev/null +++ b/oox/source/drawingml/shapepropertymap.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "oox/drawingml/shapepropertymap.hxx" + +#include +#include +#include +#include +#include "oox/helper/modelobjecthelper.hxx" +#include "properties.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::uno; + +using ::rtl::OUString; + +// ============================================================================ + +namespace { + +static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] = +{ + PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint, + PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter, + PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradient, + PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, + PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint +}; + +} // namespace + +ShapePropertyInfo ShapePropertyInfo::DEFAULT( spnDefaultShapeIds, true, false, false, false ); + +ShapePropertyInfo::ShapePropertyInfo( const sal_Int32* pnPropertyIds, + bool bNamedLineMarker, bool bNamedLineDash, bool bNamedFillGradient, bool bNamedFillBitmapUrl ) : + mpnPropertyIds( pnPropertyIds ), + mbNamedLineMarker( bNamedLineMarker ), + mbNamedLineDash( bNamedLineDash ), + mbNamedFillGradient( bNamedFillGradient ), + mbNamedFillBitmapUrl( bNamedFillBitmapUrl ) +{ + OSL_ENSURE( mpnPropertyIds != 0, "ShapePropertyInfo::ShapePropertyInfo - missing property identifiers" ); +} + +// ============================================================================ + +ShapePropertyMap::ShapePropertyMap( ModelObjectHelper& rModelObjHelper, const ShapePropertyInfo& rShapePropInfo ) : + mrModelObjHelper( rModelObjHelper ), + maShapePropInfo( rShapePropInfo ) +{ +} + +bool ShapePropertyMap::supportsProperty( ShapePropertyId ePropId ) const +{ + return maShapePropInfo.has( ePropId ); +} + +bool ShapePropertyMap::hasNamedLineMarkerInTable( const OUString& rMarkerName ) const +{ + return maShapePropInfo.mbNamedLineMarker && mrModelObjHelper.hasLineMarker( rMarkerName ); +} + +bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValue ) +{ + // get current property identifier for the specified property + sal_Int32 nPropId = maShapePropInfo[ ePropId ]; + if( nPropId < 0 ) return false; + + // special handling for properties supporting named objects in tables + switch( ePropId ) + { + case SHAPEPROP_LineStart: + case SHAPEPROP_LineEnd: + return setLineMarker( nPropId, rValue ); + + case SHAPEPROP_LineDash: + return setLineDash( nPropId, rValue ); + + case SHAPEPROP_FillGradient: + return setFillGradient( nPropId, rValue ); + + case SHAPEPROP_FillBitmapUrl: + return setFillBitmapUrl( nPropId, rValue ); + + default:; // suppress compiler warnings + } + + // set plain property value + operator[]( nPropId ) = rValue; + return true; +} + +// private -------------------------------------------------------------------- + +bool ShapePropertyMap::setLineMarker( sal_Int32 nPropId, const Any& rValue ) +{ + NamedValue aNamedMarker; + if( (rValue >>= aNamedMarker) && (aNamedMarker.Name.getLength() > 0) ) + { + // push line marker explicitly + if( !maShapePropInfo.mbNamedLineMarker ) + return setAnyProperty( nPropId, aNamedMarker.Value ); + + // create named line marker (if coordinates have been passed) and push its name + bool bInserted = !aNamedMarker.Value.has< PolyPolygonBezierCoords >() || + mrModelObjHelper.insertLineMarker( aNamedMarker.Name, aNamedMarker.Value.get< PolyPolygonBezierCoords >() ); + return bInserted && setProperty( nPropId, aNamedMarker.Name ); + } + return false; +} + +bool ShapePropertyMap::setLineDash( sal_Int32 nPropId, const Any& rValue ) +{ + // push line dash explicitly + if( !maShapePropInfo.mbNamedLineDash ) + return setAnyProperty( nPropId, rValue ); + + // create named line dash and push its name + if( rValue.has< LineDash >() ) + { + OUString aDashName = mrModelObjHelper.insertLineDash( rValue.get< LineDash >() ); + return (aDashName.getLength() > 0) && setProperty( nPropId, aDashName ); + } + + return false; +} + +bool ShapePropertyMap::setFillGradient( sal_Int32 nPropId, const Any& rValue ) +{ + // push gradient explicitly + if( !maShapePropInfo.mbNamedFillGradient ) + return setAnyProperty( nPropId, rValue ); + + // create named gradient and push its name + if( rValue.has< Gradient >() ) + { + OUString aGradientName = mrModelObjHelper.insertFillGradient( rValue.get< Gradient >() ); + return (aGradientName.getLength() > 0) && setProperty( nPropId, aGradientName ); + } + + return false; +} + +bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue ) +{ + // push bitmap URL explicitly + if( !maShapePropInfo.mbNamedFillBitmapUrl ) + return setAnyProperty( nPropId, rValue ); + + // create named bitmap URL and push its name + if( rValue.has< OUString >() ) + { + OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() ); + return (aBitmapUrlName.getLength() > 0) && setProperty( nPropId, aBitmapUrlName ); + } + + return false; +} + +// ============================================================================ + +} // namespace drawingml +} // namespace oox diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index ee3ac495f4d6..d31627e61148 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -27,12 +27,13 @@ #include "oox/drawingml/table/tablecell.hxx" #include "oox/drawingml/table/tableproperties.hxx" +#include "oox/drawingml/shapepropertymap.hxx" #include "oox/drawingml/textbody.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" +#include "oox/helper/propertyset.hxx" #include "properties.hxx" #include "tokens.hxx" -#include "oox/helper/propertyset.hxx" #include #include #include @@ -358,9 +359,10 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR ); aFillProperties.assignUsed( maFillProperties ); - PropertySet aPropSet( xPropSet ); + ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() ); // TODO: phClr? - aFillProperties.pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() ); + aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() ); + PropertySet( xPropSet ).setProperties( aPropMap ); } } } } diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx index 6528fea5634d..21dbe9c3a2eb 100644 --- a/oox/source/helper/modelobjecthelper.cxx +++ b/oox/source/helper/modelobjecthelper.cxx @@ -45,13 +45,13 @@ namespace oox { // ============================================================================ ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) : - maMarkerContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ), - maDashContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ), - maGradientContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ), - maBitmapContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ), - maDashNameBase( CREATE_OUSTRING( "msLineDash " ) ), - maGradientNameBase( CREATE_OUSTRING( "msFillGradient " ) ), - maBitmapNameBase( CREATE_OUSTRING( "msFillBitmap " ) ) + maMarkerContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ), + maDashContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ), + maGradientContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ), + maBitmapUrlContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ), + maDashNameBase( CREATE_OUSTRING( "msLineDash " ) ), + maGradientNameBase( CREATE_OUSTRING( "msFillGradient " ) ), + maBitmapUrlNameBase( CREATE_OUSTRING( "msFillBitmap " ) ) { } @@ -78,10 +78,10 @@ OUString ModelObjectHelper::insertFillGradient( const Gradient& rGradient ) return maGradientContainer.insertObject( maGradientNameBase, Any( rGradient ), true ); } -OUString ModelObjectHelper::insertFillBitmap( const OUString& rGraphicUrl ) +OUString ModelObjectHelper::insertFillBitmapUrl( const OUString& rGraphicUrl ) { if( rGraphicUrl.getLength() > 0 ) - return maBitmapContainer.insertObject( maBitmapNameBase, Any( rGraphicUrl ), true ); + return maBitmapUrlContainer.insertObject( maBitmapUrlNameBase, Any( rGraphicUrl ), true ); return OUString(); } diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 31072fe449e5..155b2015dffa 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -186,10 +186,6 @@ PropertyMap::PropertyMap() : { } -PropertyMap::~PropertyMap() -{ -} - /*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId ) { OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" ); diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx index e7071ba402a2..a46c189f9a2b 100644 --- a/oox/source/helper/propertyset.cxx +++ b/oox/source/helper/propertyset.cxx @@ -52,22 +52,10 @@ void PropertySet::set( const Reference< XPropertySet >& rxPropSet ) // Get properties ------------------------------------------------------------- -bool PropertySet::getAnyProperty( Any& orValue, sal_Int32 nPropId ) const -{ - return getAnyProperty( orValue, PropertyMap::getPropertyName( nPropId ) ); -} - Any PropertySet::getAnyProperty( sal_Int32 nPropId ) const { Any aValue; - return getAnyProperty( aValue, nPropId ) ? aValue : Any(); -} - -bool PropertySet::getBoolProperty( sal_Int32 nPropId ) const -{ - Any aAny; - bool bValue = false; - return getAnyProperty( aAny, nPropId ) && (aAny >>= bValue) && bValue; + return implGetPropertyValue( aValue, PropertyMap::getPropertyName( nPropId ) ) ? aValue : Any(); } void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUString >& rPropNames ) const @@ -90,15 +78,15 @@ void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUSt orValues.realloc( nLen ); Any* pValue = orValues.getArray(); for( ; pPropName != pPropNameEnd; ++pPropName, ++pValue ) - getAnyProperty( *pValue, *pPropName ); + implGetPropertyValue( *pValue, *pPropName ); } } // Set properties ------------------------------------------------------------- -void PropertySet::setAnyProperty( sal_Int32 nPropId, const Any& rValue ) +bool PropertySet::setAnyProperty( sal_Int32 nPropId, const Any& rValue ) { - setAnyProperty( PropertyMap::getPropertyName( nPropId ), rValue ); + return implSetPropertyValue( PropertyMap::getPropertyName( nPropId ), rValue ); } void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const Sequence< Any >& rValues ) @@ -122,7 +110,7 @@ void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const S const OUString* pPropNameEnd = pPropName + rPropNames.getLength(); const Any* pValue = rValues.getConstArray(); for( ; pPropName != pPropNameEnd; ++pPropName, ++pValue ) - setAnyProperty( *pPropName, *pValue ); + implSetPropertyValue( *pPropName, *pValue ); } } @@ -139,37 +127,34 @@ void PropertySet::setProperties( const PropertyMap& rPropertyMap ) // private -------------------------------------------------------------------- -bool PropertySet::getAnyProperty( Any& orValue, const OUString& rPropName ) const +bool PropertySet::implGetPropertyValue( Any& orValue, const OUString& rPropName ) const { - bool bHasValue = false; - try + if( mxPropSet.is() ) try { - if( mxPropSet.is() ) - { - orValue = mxPropSet->getPropertyValue( rPropName ); - bHasValue = true; - } + orValue = mxPropSet->getPropertyValue( rPropName ); + return true; } catch( Exception& ) { - OSL_ENSURE( false, OStringBuffer( "PropertySet::getAnyProperty - cannot get property \"" ). + OSL_ENSURE( false, OStringBuffer( "PropertySet::implGetPropertyValue - cannot get property \"" ). append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() ); } - return bHasValue; + return false; } -void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue ) +bool PropertySet::implSetPropertyValue( const OUString& rPropName, const Any& rValue ) { - try + if( mxPropSet.is() ) try { - if( mxPropSet.is() ) - mxPropSet->setPropertyValue( rPropName, rValue ); + mxPropSet->setPropertyValue( rPropName, rValue ); + return true; } catch( Exception& ) { - OSL_ENSURE( false, OStringBuffer( "PropertySet::setAnyProperty - cannot set property \"" ). + OSL_ENSURE( false, OStringBuffer( "PropertySet::implSetPropertyValue - cannot set property \"" ). append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() ); } + return false; } #if OSL_DEBUG_LEVEL > 0 diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 7e77f5a54938..7db7cba4c68c 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -150,7 +150,7 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s { FillPropertiesPtr pFillPropertiesPtr( new FillProperties( *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) ); - xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColorRef() ) ); + xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ) ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); } break; diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 8555ba371b77..f6f6eb8f42c7 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -25,14 +25,16 @@ * ************************************************************************/ -#include "oox/helper/propertyset.hxx" #include "oox/ppt/timenode.hxx" #include "oox/ppt/pptshape.hxx" #include "oox/ppt/slidepersist.hxx" #include "oox/drawingml/fillproperties.hxx" +#include "oox/drawingml/shapepropertymap.hxx" +#include "oox/helper/propertyset.hxx" #include "oox/vml/vmldrawing.hxx" #include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" +#include "properties.hxx" #include "tokens.hxx" #include @@ -171,24 +173,12 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase ) { if ( mpBackgroundPropertiesPtr ) { - try - { - sal_Int32 nPhClr = API_RGB_TRANSPARENT; - if ( maBackgroundColorRef.isUsed() ) - nPhClr = maBackgroundColorRef.getColor( rFilterBase.getGraphicHelper() ); + sal_Int32 nPhClr = maBackgroundColor.isUsed() ? + maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : API_RGB_TRANSPARENT; - PropertyMap aPropMap; - static const rtl::OUString sBackground( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ); - uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() ); - PropertySet aPropSet( xPropertySet ); - mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), - rFilterBase.getGraphicHelper(), oox::drawingml::FillProperties::DEFAULT_IDS, 0, nPhClr ); - xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) ); - } - catch( Exception ) - { - } + ::oox::drawingml::ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() ); + mpBackgroundPropertiesPtr->pushToPropMap( aPropMap, rFilterBase.getGraphicHelper(), 0, nPhClr ); + PropertySet( mxPage ).setProperty( PROP_Background, aPropMap.makePropertySet() ); } } diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 2850d422e234..d1b7cb8c3bf2 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -16,6 +16,7 @@ AutoShowInfo Autocomplete BackGraphicLocation BackGraphicURL +Background BackgroundColor BasicLibraries BlackDay diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 9ee8a4ec3215..1e846457f9a5 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -43,6 +43,7 @@ using ::oox::drawingml::Color; using ::oox::drawingml::FillProperties; using ::oox::drawingml::LineArrowProperties; using ::oox::drawingml::LineProperties; +using ::oox::drawingml::ShapePropertyMap; namespace oox { namespace vml { @@ -430,8 +431,7 @@ void StrokeModel::assignUsed( const StrokeModel& rSource ) moJoinStyle.assignIfUsed( rSource.moJoinStyle ); } -void StrokeModel::pushToPropMap( PropertyMap& rPropMap, - ModelObjectHelper& rModelObjectHelper, const GraphicHelper& rGraphicHelper ) const +void StrokeModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const { /* Convert VML line formatting to DrawingML line formatting and let the DrawingML code do the hard work. */ @@ -454,7 +454,7 @@ void StrokeModel::pushToPropMap( PropertyMap& rPropMap, aLineProps.maLineFill.moFillType = XML_noFill; } - aLineProps.pushToPropMap( rPropMap, rModelObjectHelper, rGraphicHelper ); + aLineProps.pushToPropMap( rPropMap, rGraphicHelper ); } // ============================================================================ @@ -475,8 +475,7 @@ void FillModel::assignUsed( const FillModel& rSource ) moRotate.assignIfUsed( rSource.moRotate ); } -void FillModel::pushToPropMap( PropertyMap& rPropMap, - ModelObjectHelper& rModelObjectHelper, const GraphicHelper& rGraphicHelper ) const +void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const { /* Convert VML fill formatting to DrawingML fill formatting and let the DrawingML code do the hard work. */ @@ -594,7 +593,7 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap, aFillProps.moFillType = XML_noFill; } - aFillProps.pushToPropMap( rPropMap, rModelObjectHelper, rGraphicHelper ); + aFillProps.pushToPropMap( rPropMap, rGraphicHelper ); } // ============================================================================ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d557a7f50354..52b2217b290d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -36,8 +36,8 @@ #include #include #include "properties.hxx" +#include "oox/drawingml/shapepropertymap.hxx" #include "oox/helper/graphichelper.hxx" -#include "oox/helper/propertymap.hxx" #include "oox/helper/propertyset.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/ole/axcontrol.hxx" @@ -313,15 +313,11 @@ Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) const { - ModelObjectHelper& rModelObjectHelper = mrDrawing.getFilter().getModelObjectHelper(); + ::oox::drawingml::ShapePropertyMap aPropMap( mrDrawing.getFilter().getModelObjectHelper() ); const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); - - PropertyMap aPropMap; - maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rModelObjectHelper, rGraphicHelper ); - maTypeModel.maFillModel.pushToPropMap( aPropMap, rModelObjectHelper, rGraphicHelper ); - - PropertySet aPropSet( rxShape ); - aPropSet.setProperties( aPropMap ); + maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rGraphicHelper ); + maTypeModel.maFillModel.pushToPropMap( aPropMap, rGraphicHelper ); + PropertySet( rxShape ).setProperties( aPropMap ); } // ============================================================================ diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index e1607e99e6c6..dbc6ae19b703 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -33,9 +33,9 @@ #include #include #include "oox/core/filterbase.hxx" +#include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" -#include "oox/helper/propertymap.hxx" -#include "oox/helper/propertyset.hxx" +#include "oox/drawingml/shapepropertymap.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/unitconverter.hxx" #include "properties.hxx" @@ -594,7 +594,7 @@ void BiffDrawingObjectBase::readMacroBiff8( BiffInputStream& rStrm ) } } -void BiffDrawingObjectBase::convertLineProperties( PropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows ) const +void BiffDrawingObjectBase::convertLineProperties( ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows ) const { if( rLineModel.mbAuto ) { @@ -705,10 +705,10 @@ void BiffDrawingObjectBase::convertLineProperties( PropertyMap& rPropMap, const } } - aLineProps.pushToPropMap( rPropMap, getBaseFilter().getModelObjectHelper(), getBaseFilter().getGraphicHelper() ); + aLineProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() ); } -void BiffDrawingObjectBase::convertFillProperties( PropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const +void BiffDrawingObjectBase::convertFillProperties( ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const { if( rFillModel.mbAuto ) { @@ -791,10 +791,10 @@ void BiffDrawingObjectBase::convertFillProperties( PropertyMap& rPropMap, const #endif } - aFillProps.pushToPropMap( rPropMap, getBaseFilter().getModelObjectHelper(), getBaseFilter().getGraphicHelper() ); + aFillProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() ); } -void BiffDrawingObjectBase::convertFrameProperties( PropertyMap& /*rPropMap*/, sal_uInt16 /*nFrameFlags*/ ) const +void BiffDrawingObjectBase::convertFrameProperties( ShapePropertyMap& /*rPropMap*/, sal_uInt16 /*nFrameFlags*/ ) const { } @@ -1044,7 +1044,7 @@ void BiffLineObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameL Reference< XShape > BiffLineObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - PropertyMap aPropMap; + ShapePropertyMap aPropMap( getBaseFilter().getModelObjectHelper() ); convertLineProperties( aPropMap, maLineModel, mnArrows ); // create the line polygon @@ -1087,7 +1087,7 @@ void BiffRectObject::readFrameData( BiffInputStream& rStrm ) rStrm >> maFillModel >> maLineModel >> mnFrameFlags; } -void BiffRectObject::convertRectProperties( PropertyMap& rPropMap ) const +void BiffRectObject::convertRectProperties( ShapePropertyMap& rPropMap ) const { convertLineProperties( rPropMap, maLineModel ); convertFillProperties( rPropMap, maFillModel ); @@ -1116,7 +1116,7 @@ void BiffRectObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameL Reference< XShape > BiffRectObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - PropertyMap aPropMap; + ShapePropertyMap aPropMap( getBaseFilter().getModelObjectHelper() ); convertRectProperties( aPropMap ); Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.RectangleShape" ), rxShapes, rShapeRect ); @@ -1134,7 +1134,7 @@ BiffOvalObject::BiffOvalObject( const WorksheetHelper& rHelper ) : Reference< XShape > BiffOvalObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - PropertyMap aPropMap; + ShapePropertyMap aPropMap( getBaseFilter().getModelObjectHelper() ); convertRectProperties( aPropMap ); Reference< XShape > xShape = rDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.EllipseShape" ), rxShapes, rShapeRect ); @@ -1176,7 +1176,7 @@ void BiffArcObject::implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLe Reference< XShape > BiffArcObject::implConvertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { - PropertyMap aPropMap; + ShapePropertyMap aPropMap( getBaseFilter().getModelObjectHelper() ); convertLineProperties( aPropMap, maLineModel ); convertFillProperties( aPropMap, maFillModel ); @@ -1257,7 +1257,7 @@ Reference< XShape > BiffPolygonObject::implConvertAndInsert( BiffDrawingBase& rD Reference< XShape > xShape; if( maCoords.size() >= 2 ) { - PropertyMap aPropMap; + ShapePropertyMap aPropMap( getBaseFilter().getModelObjectHelper() ); convertRectProperties( aPropMap ); // create the polygon -- cgit From ea51944d952612269d8a5ceb3dad9e019e81e4a5 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 12 Jan 2011 14:27:13 +0100 Subject: dba34c: unused var when not in debug --- svx/source/form/fmpgeimp.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 90f12f411447..9aeae3856ff6 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -276,11 +276,15 @@ namespace Any aOldAssignment = #endif _map->remove( makeAny( xControlModel ) ); + #if OSL_DEBUG_LEVEL > 0 (void)aOldAssignment; + #endif OSL_ENSURE( !i_ignoreNonExistence || ( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ) ), "lcl_removeFormObject: map was inconsistent!" ); + #if OSL_DEBUG_LEVEL > 0 (void)i_ignoreNonExistence; + #endif } } -- cgit From c19504b56663050e5cf1aa2e27758e8f8085bfe7 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 12 Jan 2011 15:20:09 +0100 Subject: dr78: #i116426# use ODataAccessDescriptor for database import parameters, support bookmarks for selection --- sc/sdi/scalc.sdi | 2 +- sc/source/ui/app/typemap.cxx | 1 + sc/source/ui/docshell/dbdocfun.cxx | 37 +++++---- sc/source/ui/docshell/dbdocimp.cxx | 158 ++++++++++++++----------------------- sc/source/ui/docshell/docsh4.cxx | 48 +++-------- sc/source/ui/docshell/docsh5.cxx | 5 +- sc/source/ui/inc/dbdocfun.hxx | 28 ++----- sc/source/ui/unoobj/cellsuno.cxx | 3 +- sc/source/ui/unoobj/datauno.cxx | 3 +- sc/source/ui/view/dbfunc.cxx | 3 +- sc/source/ui/view/viewfun5.cxx | 23 +++--- 11 files changed, 114 insertions(+), 197 deletions(-) diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 2455b02c9a9e..0deaeb0ccaf1 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -5390,7 +5390,7 @@ SfxUInt16Item RowHeight FID_ROW_HEIGHT //-------------------------------------------------------------------------- SfxVoidItem SbaImport SID_SBA_IMPORT -(SfxStringItem Query SID_SBA_IMPORT,SfxStringItem Target FN_PARAM_1) +(SfxUsrAnyItem Query SID_SBA_IMPORT,SfxStringItem Target FN_PARAM_1) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx index 4450c00db807..73d0ac786971 100644 --- a/sc/source/ui/app/typemap.cxx +++ b/sc/source/ui/app/typemap.cxx @@ -124,6 +124,7 @@ #include #include +#include #include "attrib.hxx" #define SvxDrawToolItem SfxAllEnumItem diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index cf149d258062..33eef8ba6391 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -35,8 +35,9 @@ #include #include #include +#include -#include +#include #include "dbdocfun.hxx" #include "sc.hrc" @@ -58,6 +59,8 @@ #include "dpshttab.hxx" #include "hints.hxx" +using namespace ::com::sun::star; + // ----------------------------------------------------------------- BOOL ScDBDocFunc::AddDBRange( const String& rName, const ScRange& rRange, BOOL /* bApi */ ) @@ -1429,15 +1432,11 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb //================================================================== // -// Datenbank-Import... +// database import -void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName, - const String& rTableName, const String& rStatement, BOOL bNative, - BYTE nType, const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection ) +void ScDBDocFunc::UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor ) { - // Target ist jetzt einfach der Bereichsname + // rTarget is the name of a database range ScDocument* pDoc = rDocShell.GetDocument(); ScDBCollection& rDBColl = *pDoc->GetDBCollection(); @@ -1465,15 +1464,21 @@ void ScDBDocFunc::UpdateImport( const String& rTarget, const String& rDBName, pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow ); pData->GetImportParam( aImportParam ); - BOOL bSql = ( rStatement.Len() != 0 ); - - aImportParam.aDBName = rDBName; - aImportParam.bSql = bSql; - aImportParam.aStatement = bSql ? rStatement : rTableName; - aImportParam.bNative = bNative; - aImportParam.nType = nType; + rtl::OUString sDBName; + rtl::OUString sDBTable; + sal_Int32 nCommandType = 0; + rDescriptor[svx::daDataSource] >>= sDBName; + rDescriptor[svx::daCommand] >>= sDBTable; + rDescriptor[svx::daCommandType] >>= nCommandType; + + aImportParam.aDBName = sDBName; + aImportParam.bSql = ( nCommandType == sdb::CommandType::COMMAND ); + aImportParam.aStatement = sDBTable; + aImportParam.bNative = FALSE; + aImportParam.nType = static_cast( ( nCommandType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); aImportParam.bImport = TRUE; - BOOL bContinue = DoImport( nTab, aImportParam, xResultSet, pSelection, TRUE ); + + BOOL bContinue = DoImport( nTab, aImportParam, &rDescriptor, TRUE ); // DB-Operationen wiederholen diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index a073e50d105c..aa256fd332f1 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ #include "dbdocutl.hxx" #include "editable.hxx" #include "hints.hxx" +#include "miscuno.hxx" using namespace com::sun::star; @@ -121,99 +123,22 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFram BOOL ScDBDocFunc::DoImportUno( const ScAddress& rPos, const uno::Sequence& aArgs ) { - BOOL bDone = FALSE; + svx::ODataAccessDescriptor aDesc( aArgs ); // includes selection and result set - ScImportParam aImParam; - aImParam.nCol1 = aImParam.nCol2 = rPos.Col(); - aImParam.nRow1 = aImParam.nRow2 = rPos.Row(); - aImParam.bImport = TRUE; + // create database range + ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); + DBG_ASSERT(pDBData, "can't create DB data"); + String sTarget = pDBData->GetName(); - uno::Reference xResSet; - uno::Sequence aSelection; - - rtl::OUString aStrVal; - const beans::PropertyValue* pPropArray = aArgs.getConstArray(); - long nPropCount = aArgs.getLength(); - long i; - for (i = 0; i < nPropCount; i++) - { - const beans::PropertyValue& rProp = pPropArray[i]; - String aPropName = rProp.Name; - - if ( aPropName.EqualsAscii( SC_DBPROP_DATASOURCENAME )) - { - if ( rProp.Value >>= aStrVal ) - aImParam.aDBName = aStrVal; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_COMMAND )) - { - if ( rProp.Value >>= aStrVal ) - aImParam.aStatement = aStrVal; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_COMMANDTYPE )) - { - sal_Int32 nType = 0; - if ( rProp.Value >>= nType ) - { - aImParam.bSql = ( nType == sdb::CommandType::COMMAND ); - aImParam.nType = sal::static_int_cast( ( nType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); - // nType is ignored if bSql is set - } - } - else if ( aPropName.EqualsAscii( SC_DBPROP_SELECTION )) - { - rProp.Value >>= aSelection; - } - else if ( aPropName.EqualsAscii( SC_DBPROP_CURSOR )) - { - rProp.Value >>= xResSet; - } - } - - SbaSelectionList aList; - long nSelLen = aSelection.getLength(); - for (i = 0; i < nSelLen; i++) - { - sal_Int32 nEntry = 0; - if ( aSelection[i] >>= nEntry ) - aList.Insert( (void*)nEntry, LIST_APPEND ); - } - - BOOL bAddrInsert = FALSE; //!??? - if ( bAddrInsert ) - { - bDone = DoImport( rPos.Tab(), aImParam, xResSet, &aList, TRUE, bAddrInsert ); - } - else - { - // create database range - //! merge this with SID_SBA_IMPORT execute in docsh4.cxx - - ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); - DBG_ASSERT(pDBData, "can't create DB data"); - String sTarget = pDBData->GetName(); - - //! change UpdateImport to use only one of rTableName, rStatement - - String aTableName, aStatement; - if ( aImParam.bSql ) - aStatement = aImParam.aStatement; - else - aTableName = aImParam.aStatement; + UpdateImport( sTarget, aDesc ); - UpdateImport( sTarget, aImParam.aDBName, aTableName, aStatement, - aImParam.bNative, aImParam.nType, xResSet, &aList ); - bDone = TRUE; - } - - return bDone; + return TRUE; } // ----------------------------------------------------------------- BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, - const uno::Reference< sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection, BOOL bRecord, BOOL bAddrInsert ) + const svx::ODataAccessDescriptor* pDescriptor, BOOL bRecord, BOOL bAddrInsert ) { ScDocument* pDoc = rDocShell.GetDocument(); @@ -251,17 +176,34 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, BOOL bDoSelection = FALSE; BOOL bRealSelection = FALSE; // TRUE if not everything is selected - ULONG nListPos = 0; - ULONG nRowsRead = 0; - ULONG nListCount = 0; + sal_Bool bBookmarkSelection = sal_False; + sal_Int32 nListPos = 0; + sal_Int32 nRowsRead = 0; + sal_Int32 nListCount = 0; - // -1 is special - if ( pSelection && pSelection->Count() && (long)pSelection->GetObject(0) != -1L ) + uno::Sequence aSelection; + if ( pDescriptor && pDescriptor->has(svx::daSelection) ) { - bDoSelection = TRUE; - nListCount = pSelection->Count(); + (*pDescriptor)[svx::daSelection] >>= aSelection; + nListCount = aSelection.getLength(); + if ( nListCount > 0 ) + { + bDoSelection = TRUE; + if ( pDescriptor->has(svx::daBookmarkSelection) ) + bBookmarkSelection = ScUnoHelpFunctions::GetBoolFromAny( (*pDescriptor)[svx::daBookmarkSelection] ); + if ( bBookmarkSelection ) + { + // From bookmarks, there's no way to detect if all records are selected. + // Rely on base to pass no selection in that case. + bRealSelection = TRUE; + } + } } + uno::Reference xResultSet; + if ( pDescriptor && pDescriptor->has(svx::daCursor) ) + xResultSet.set((*pDescriptor)[svx::daCursor], uno::UNO_QUERY); + // ImportDoc - also used for Redo ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO ); pImportDoc->InitUndo( pDoc, nTab, nTab ); @@ -346,6 +288,17 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, //! error message } + uno::Reference xLocate; + if ( bBookmarkSelection ) + { + xLocate.set( xRowSet, uno::UNO_QUERY ); + if ( !xLocate.is() ) + { + DBG_ERRORFILE("can't get XRowLocate"); + bDoSelection = bRealSelection = bBookmarkSelection = sal_False; + } + } + uno::Reference xRow( xRowSet, uno::UNO_QUERY ); if ( nColCount > 0 && xRow.is() ) { @@ -388,16 +341,25 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, { if (nListPos < nListCount) { - ULONG nNextRow = (ULONG) pSelection->GetObject(nListPos); - if ( nRowsRead+1 < nNextRow ) - bRealSelection = TRUE; - bEnd = !xRowSet->absolute(nRowsRead = nNextRow); + if ( bBookmarkSelection ) + { + bEnd = !xLocate->moveToBookmark(aSelection[nListPos]); + } + else // use record numbers + { + sal_Int32 nNextRow = 0; + aSelection[nListPos] >>= nNextRow; + if ( nRowsRead+1 < nNextRow ) + bRealSelection = TRUE; + bEnd = !xRowSet->absolute(nRowsRead = nNextRow); + } ++nListPos; } else { - bRealSelection = xRowSet->next(); - bEnd = TRUE; // more data available but not used + if ( !bBookmarkSelection && xRowSet->next() ) + bRealSelection = TRUE; // more data available but not used + bEnd = TRUE; } } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index bba756b397cb..a8b023461f26 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -60,6 +60,7 @@ using namespace ::com::sun::star; #include #include #include +#include #include #include #include @@ -200,19 +201,21 @@ void ScDocShell::Execute( SfxRequest& rReq ) } break; - - // SID_SBA_QRY_CHANGETARGET gibts nicht mehr - auch in idl raus - case SID_SBA_IMPORT: { if (pReqArgs) { - const sal_Unicode cSbaSep = 11; // Trennzeichen - const SfxPoolItem* pItem; - String sSbaData, sTarget; + svx::ODataAccessDescriptor aDesc; if ( pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET ) - sSbaData = ((const SfxStringItem*)pItem)->GetValue(); + { + uno::Any aAny = static_cast(pItem)->GetValue(); + uno::Sequence aProperties; + if ( aAny >>= aProperties ) + aDesc.initializeFrom( aProperties ); + } + + String sTarget; if ( pReqArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET ) sTarget = ((const SfxStringItem*)pItem)->GetValue(); @@ -220,33 +223,6 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( pReqArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET ) bIsNewArea = ((const SfxBoolItem*)pItem)->GetValue(); - ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet > xResultSet; - if ( pReqArgs->GetItemState( FN_PARAM_3, FALSE, &pItem ) == SFX_ITEM_SET && pItem ) - xResultSet.set(((const SfxUsrAnyItem*)pItem)->GetValue(),::com::sun::star::uno::UNO_QUERY); - - String sDBName = sSbaData.GetToken(0,cSbaSep); // Datenbankname - String sDBTable = sSbaData.GetToken(1,cSbaSep); // Tabellen- oder Query-Name - String sTabFlag = sSbaData.GetToken(2,cSbaSep); - String sDBSql = sSbaData.GetToken(3,cSbaSep); // SQL im Klartext - - BYTE nType = ScDbTable; // "0" oder "1" - if ( sTabFlag.EqualsAscii("0") ) // "0" = Query, "1" = Table (Default) - nType = ScDbQuery; - - SbaSelectionListRef pSelectionList = new SbaSelectionList; - xub_StrLen nCount = sSbaData.GetTokenCount(cSbaSep); - - for (xub_StrLen i = 4; i < nCount; i++) - { - String aSelItem = sSbaData.GetToken(i,cSbaSep); - if (aSelItem.Len()) - { - void *pPtr = (void*)aSelItem.ToInt32(); - pSelectionList->Insert( pPtr, LIST_APPEND ); - } - } - // bei Bedarf neuen Datenbankbereich anlegen BOOL bMakeArea = FALSE; if (bIsNewArea) @@ -287,9 +263,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if (bDo) { - ScDBDocFunc(*this).UpdateImport( sTarget, sDBName, - sDBTable, sDBSql, TRUE, nType, xResultSet, - pSelectionList ); + ScDBDocFunc(*this).UpdateImport( sTarget, aDesc ); rReq.Done(); // UpdateImport aktualisiert auch die internen Operationen diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 013511ab0acb..5df24ca73772 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -41,8 +41,6 @@ #include #include -#include - // INCLUDE --------------------------------------------------------------- #include "docsh.hxx" @@ -980,8 +978,7 @@ IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScRefreshTimer*, pRefreshTimer ) { ScRange aRange; pDBData->GetArea( aRange ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xResultSet; - bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag as parameter + bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, NULL, TRUE, FALSE ); //! Api-Flag as parameter // internal operations (sort, query, subtotal) only if no error if (bContinue) { diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index efdd29b44738..f66e1ec3deb9 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -40,7 +40,6 @@ struct ScSortParam; struct ScSubTotalParam; class SfxViewFrame; -class SbaSelectionList; class ScDBData; class ScDocShell; class ScAddress; @@ -51,21 +50,14 @@ namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } - namespace sdbc { - class XResultSet; - } } } } +namespace svx { + class ODataAccessDescriptor; +} + // --------------------------------------------------------------------------- // ----------------------------------------------------------------- -class SbaSelectionList: public List , public SvRefBase -{ -public: - SbaSelectionList(): - List(CONTAINER_MAXBLOCKSIZE,100,100){} -}; - -SV_DECL_IMPL_REF(SbaSelectionList) class ScDBDocFunc @@ -79,17 +71,11 @@ public: ScDBDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {} ~ScDBDocFunc() {} - void UpdateImport( const String& rTarget, const String& rDBName, - const String& rTableName, const String& rStatement, - BOOL bNative, BYTE nType, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection ); + void UpdateImport( const String& rTarget, const svx::ODataAccessDescriptor& rDescriptor ); BOOL DoImport( SCTAB nTab, const ScImportParam& rParam, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XResultSet >& xResultSet, - const SbaSelectionList* pSelection, BOOL bRecord, + const svx::ODataAccessDescriptor* pDescriptor, // used for selection and existing ResultSet + BOOL bRecord, BOOL bAddrInsert = FALSE ); BOOL DoImportUno( const ScAddress& rPos, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 53ac57ee2318..ceb76f7671a0 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5907,12 +5907,11 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence xResultSet; pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein - aFunc.DoImport( nTab, aParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag als Parameter + aFunc.DoImport( nTab, aParam, NULL, TRUE ); //! Api-Flag as parameter } } diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 6e416764eb76..7a367a71977a 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -1893,8 +1893,7 @@ void SAL_CALL ScDatabaseRangeObj::refresh() throw(uno::RuntimeException) SCCOL nDummyCol; SCROW nDummyRow; pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow ); - uno::Reference< sdbc::XResultSet > xResultSet; - bContinue = aFunc.DoImport( nTab, aImportParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag als Parameter + bContinue = aFunc.DoImport( nTab, aImportParam, NULL, TRUE ); //! Api-Flag as parameter } // interne Operationen (sort, query, subtotal) nur, wenn kein Fehler diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index f2a277b987df..c69d11ce92ce 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -504,8 +504,7 @@ BOOL ScDBFunc::ImportData( const ScImportParam& rParam, BOOL bRecord ) } ScDBDocFunc aDBDocFunc( *GetViewData()->GetDocShell() ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet; - return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, xResultSet, NULL, bRecord ); + return aDBDocFunc.DoImport( GetViewData()->GetTabNo(), rParam, NULL, bRecord ); } diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index dc4e96bbbf34..df7646710505 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -374,10 +374,15 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, { // import of database data into table - String sDataDesc; - if ( aDataHelper.GetString( nFormatId, sDataDesc ) ) + const DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector(); + if ( svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) ) { - SfxStringItem aDataDesc(SID_SBA_IMPORT, sDataDesc); + // transport the whole ODataAccessDescriptor as slot parameter + svx::ODataAccessDescriptor aDesc = svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper); + uno::Any aDescAny; + uno::Sequence aProperties = aDesc.createPropertyValueSequence(); + aDescAny <<= aProperties; + SfxUsrAnyItem aDataDesc(SID_SBA_IMPORT, aDescAny); ScDocShell* pDocSh = GetViewData()->GetDocShell(); SCTAB nTab = GetViewData()->GetTabNo(); @@ -401,20 +406,10 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, BOOL bAreaIsNew = !pDBData; SfxBoolItem aAreaNew(FN_PARAM_2, bAreaIsNew); - ::svx::ODataAccessDescriptor aDesc; - DataFlavorExVector& rVector = aDataHelper.GetDataFlavorExVector(); - ::std::auto_ptr pCursorItem; - if ( ::svx::ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) ) - { - aDesc = ::svx::ODataAccessObjectTransferable::extractObjectDescriptor(aDataHelper); - if ( aDesc.has(::svx::daCursor) ) - pCursorItem.reset(new SfxUsrAnyItem(FN_PARAM_3, aDesc[::svx::daCursor])); - } - // asynchronous, to avoid doing the whole import in drop handler SfxDispatcher& rDisp = GetViewData()->GetDispatcher(); rDisp.Execute(SID_SBA_IMPORT, SFX_CALLMODE_ASYNCHRON, - &aDataDesc, &aTarget, &aAreaNew, pCursorItem.get(), (void*)0 ); + &aDataDesc, &aTarget, &aAreaNew, (void*)0 ); bRet = TRUE; } -- cgit From 46609bbf0fbcef0c4b9cc835c31e54a93d80c404 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 12 Jan 2011 18:03:09 +0100 Subject: dr78: build errors after rebase --- oox/inc/oox/helper/modelobjecthelper.hxx | 2 +- oox/source/drawingml/shapepropertymap.cxx | 1 - oox/source/xls/commentsbuffer.cxx | 3 ++- oox/source/xls/drawingbase.cxx | 1 - oox/source/xls/drawingfragment.cxx | 13 ++----------- oox/source/xls/drawingmanager.cxx | 4 ++-- oox/source/xls/formulaparser.cxx | 2 +- oox/source/xls/sheetdatacontext.cxx | 2 +- oox/source/xls/workbookfragment.cxx | 7 ++++--- 9 files changed, 13 insertions(+), 22 deletions(-) diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx index a235b402a872..b4eb38cd7cbe 100644 --- a/oox/inc/oox/helper/modelobjecthelper.hxx +++ b/oox/inc/oox/helper/modelobjecthelper.hxx @@ -116,7 +116,7 @@ private: ObjectContainer maMarkerContainer; /// Contains all named line markers (line end polygons). ObjectContainer maDashContainer; /// Contains all named line dsahes. ObjectContainer maGradientContainer; /// Contains all named fill gradients. - ObjectContainer maBitmapContainer; /// Contains all named fill bitmap URLs. + ObjectContainer maBitmapUrlContainer; /// Contains all named fill bitmap URLs. const ::rtl::OUString maDashNameBase; /// Base name for all named line dashes. const ::rtl::OUString maGradientNameBase; /// Base name for all named fill gradients. const ::rtl::OUString maBitmapUrlNameBase; /// Base name for all named fill bitmap URLs. diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx index 9d2397cf5f7e..521ed28871ee 100755 --- a/oox/source/drawingml/shapepropertymap.cxx +++ b/oox/source/drawingml/shapepropertymap.cxx @@ -32,7 +32,6 @@ #include #include #include "oox/helper/modelobjecthelper.hxx" -#include "properties.hxx" namespace oox { namespace drawingml { diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index e900d48fa3d9..f55dac0ca6f2 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -46,6 +46,7 @@ namespace xls { using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::sheet; using namespace ::com::sun::star::table; +using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; using ::rtl::OUString; @@ -148,7 +149,7 @@ void Comment::finalizeImport() sal_Bool bVisible = sal_True; switch( getFilterType() ) { - case FILTER_OOX: + case FILTER_OOXML: if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) { // position and formatting diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx index c7a901ead30a..99c96a7f87b1 100755 --- a/oox/source/xls/drawingbase.cxx +++ b/oox/source/xls/drawingbase.cxx @@ -28,7 +28,6 @@ #include "oox/xls/drawingbase.hxx" #include -#include "oox/core/namespaces.hxx" #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" #include "oox/xls/unitconverter.hxx" diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 9888fcb2b5f9..47b7e6cb2565 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -259,7 +259,6 @@ void DrawingFragment::onEndElement() EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( getDrawPageSize() ); if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && (aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) ) { -<<<<<<< local // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle) Rectangle aShapeRectEmu32( getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ), @@ -267,20 +266,12 @@ void DrawingFragment::onEndElement() getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aShapeRectEmu32 ); - // collect all shape positions in the WorksheetHelper base class - extendShapeBoundingBox( aShapeRectEmu32 ); -======= - mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aShapeRect ); /* Collect all shape positions in the WorksheetHelper base class. But first, scale EMUs to 1/100 mm. */ - const UnitConverter& rUnitConv = getUnitConverter(); Rectangle aShapeRectHmm( - rUnitConv.scaleToMm100( aShapeRect.X, UNIT_EMU ), - rUnitConv.scaleToMm100( aShapeRect.Y, UNIT_EMU ), - rUnitConv.scaleToMm100( aShapeRect.Width, UNIT_EMU ), - rUnitConv.scaleToMm100( aShapeRect.Height, UNIT_EMU ) ); + convertEmuToHmm( aShapeRectEmu.X ), convertEmuToHmm( aShapeRectEmu.Y ), + convertEmuToHmm( aShapeRectEmu.Width ), convertEmuToHmm( aShapeRectEmu.Height ) ); extendShapeBoundingBox( aShapeRectHmm ); ->>>>>>> other } } mxShape.reset(); diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index dbc6ae19b703..61bc0dff3fbb 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -36,10 +36,10 @@ #include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" #include "oox/drawingml/shapepropertymap.hxx" +#include "oox/helper/containerhelper.hxx" +#include "oox/token/tokens.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/unitconverter.hxx" -#include "properties.hxx" -#include "tokens.hxx" namespace oox { namespace xls { diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index 5442f0c16e48..26bf66986638 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -376,7 +376,7 @@ void FormulaFinalizer::appendEmptyParameter( const FunctionInfo& rFuncInfo, size switch( rFuncInfo.mnBiff12FuncId ) { - case BIFF12_FUNC_IF: + case BIFF_FUNC_IF: if( (nParam == 1) || (nParam == 2) ) maTokens.append< double >( OPCODE_PUSH, 0.0 ); break; diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index d12e84b27b09..2d678aec72ca 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -715,7 +715,7 @@ void BiffSheetDataContext::importXfId( BiffInputStream& rStrm, bool bBiff2 ) mobBiff2HasXfs = getStyles().getCellXf( 0 ).get() != 0; // read formatting information (includes the XF identifier) sal_uInt8 nFlags1, nFlags2, nFlags3; - mrStrm >> nFlags1 >> nFlags2 >> nFlags3; + rStrm >> nFlags1 >> nFlags2 >> nFlags3; /* If the file contains XFs, extract and set the XF identifier, otherwise get the explicit formatting. */ if( mobBiff2HasXfs.get() ) diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 7318e12e2b61..69daca13812e 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -358,6 +358,7 @@ bool BiffWorkbookFragment::importFragment() { case BIFF_FRAGMENT_GLOBALS: { + BiffInputStream& rStrm = getInputStream(); // import workbook globals fragment and create sheets in document ISegmentProgressBarRef xGlobalsProgress = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS ); bRet = importGlobalsFragment( *xGlobalsProgress ); @@ -373,15 +374,15 @@ bool BiffWorkbookFragment::importFragment() first record of the sheet fragment which is usually a BOF record. */ BiffFragmentType eSheetFragment = BIFF_FRAGMENT_UNKNOWN; sal_Int64 nRecHandle = rWorksheets.getBiffRecordHandle( nWorksheet ); - if( mrStrm.startRecordByHandle( nRecHandle ) ) + if( rStrm.startRecordByHandle( nRecHandle ) ) { /* #i109800# Stream may point to any record of the sheet fragment. Check the record identifier before calling startFragment(). */ - bool bIsBofRec = isBofRecord(); + bool bIsBofRec = BiffHelper::isBofRecord( rStrm ); /* Rewind the record. If it is the BOF record, it will be read in startFragment(). In every case, stream will point before the first available non-BOF record. */ - mrStrm.rewindRecord(); + rStrm.rewindRecord(); // if the BOF record is missing, a regular worksheet will be assumed eSheetFragment = bIsBofRec ? startFragment( getBiff() ) : BIFF_FRAGMENT_WORKSHEET; } -- cgit From 2fba65d4ec2c6ecee91cd5af3411b613bd490444 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 13 Jan 2011 10:55:32 +0100 Subject: dr78: unx build errors --- oox/source/xls/drawingbase.cxx | 2 -- oox/source/xls/drawingmanager.cxx | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx index 99c96a7f87b1..fc2ab64059c8 100755 --- a/oox/source/xls/drawingbase.cxx +++ b/oox/source/xls/drawingbase.cxx @@ -200,8 +200,6 @@ void ShapeAnchor::importBiffAnchor( BinaryInputStream& rStrm ) EmuRectangle ShapeAnchor::calcAnchorRectEmu( const Size& rPageSizeHmm ) const { AddressConverter& rAddrConv = getAddressConverter(); - const UnitConverter& rUnitConv = getUnitConverter(); - EmuSize aPageSize( lclHmmToEmu( rPageSizeHmm.Width ), lclHmmToEmu( rPageSizeHmm.Height ) ); EmuRectangle aAnchorRect( -1, -1, -1, -1 ); diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 61bc0dff3fbb..3ee5c45a80b6 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -311,10 +311,10 @@ void BiffDrawingObjectContainer::convertAndInsert( BiffDrawingBase& rDrawing, co BiffDrawingObjectBase::BiffDrawingObjectBase( const WorksheetHelper& rHelper ) : WorksheetHelper( rHelper ), maAnchor( rHelper ), - mnObjId( BIFF_OBJ_INVALID_ID ), - mnObjType( BIFF_OBJTYPE_UNKNOWN ), mnDffShapeId( 0 ), mnDffFlags( 0 ), + mnObjId( BIFF_OBJ_INVALID_ID ), + mnObjType( BIFF_OBJTYPE_UNKNOWN ), mbHasAnchor( false ), mbHidden( false ), mbVisible( true ), -- cgit From c61e2a722864969fb5835df68c86c993934ad431 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 13 Jan 2011 14:31:54 +0100 Subject: dba34c: compile error --- svx/source/form/fmpgeimp.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 9aeae3856ff6..a0d2f5a3c47a 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -282,9 +282,7 @@ namespace OSL_ENSURE( !i_ignoreNonExistence || ( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ) ), "lcl_removeFormObject: map was inconsistent!" ); - #if OSL_DEBUG_LEVEL > 0 (void)i_ignoreNonExistence; - #endif } } -- cgit From fd2917575b28c5fde2af29ed7738447bb0aae99b Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 17 Jan 2011 10:59:07 +0100 Subject: dr78: minor changes in token macros --- oox/source/token/namespaces.hxx.tail | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index 651fc38511d4..1e6ba5881589 100755 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -1,8 +1,8 @@ // ============================================================================ -const sal_Int32 TOKEN_MASK = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 ); -const sal_Int32 NMSP_MASK = static_cast< sal_Int32 >( SAL_MAX_INT16 & ~TOKEN_MASK ); +const sal_Int32 TOKEN_MASK = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 ); +const sal_Int32 NMSP_MASK = static_cast< sal_Int32 >( SAL_MAX_INT16 & ~TOKEN_MASK ); /** Returns the raw token identifier without namespace of the passed token. */ inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; } @@ -10,23 +10,26 @@ inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; /** Returns the namespace without token identifier of the passed token. */ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } + // defines for tokens with specific namespaces -#define A_TOKEN( token ) (::oox::NMSP_dml | XML_##token) -#define AX_TOKEN( token ) (::oox::NMSP_ax | XML_##token) -#define C_TOKEN( token ) (::oox::NMSP_dmlChart | XML_##token) -#define CDR_TOKEN( token ) (::oox::NMSP_dmlChartDr | XML_##token) -#define DGM_TOKEN( token ) (::oox::NMSP_dmlDiagram | XML_##token) -#define O_TOKEN( token ) (::oox::NMSP_vmlOffice | XML_##token) -#define PC_TOKEN( token ) (::oox::NMSP_packageContentTypes | XML_##token) -#define PPT_TOKEN( token ) (::oox::NMSP_ppt | XML_##token) -#define PR_TOKEN( token ) (::oox::NMSP_packageRel | XML_##token) -#define R_TOKEN( token ) (::oox::NMSP_officeRel | XML_##token) -#define VML_TOKEN( token ) (::oox::NMSP_vml | XML_##token) -#define VMLX_TOKEN( token ) (::oox::NMSP_vmlExcel | XML_##token) -#define XDR_TOKEN( token ) (::oox::NMSP_dmlSpreadDr | XML_##token) -#define XLS_TOKEN( token ) (::oox::NMSP_xls | XML_##token) -#define XM_TOKEN( token ) (::oox::NMSP_xm | XML_##token) -#define XML_TOKEN( token ) (::oox::NMSP_xml | XML_##token) +#define OOX_TOKEN( token, namespace ) (::oox::XML_##token | ::oox::NMSP_##namespace) + +#define A_TOKEN( token ) OOX_TOKEN( token, dml ) +#define AX_TOKEN( token ) OOX_TOKEN( token, ax ) +#define C_TOKEN( token ) OOX_TOKEN( token, dmlChart ) +#define CDR_TOKEN( token ) OOX_TOKEN( token, dmlChartDr ) +#define DGM_TOKEN( token ) OOX_TOKEN( token, dmlDiagram ) +#define O_TOKEN( token ) OOX_TOKEN( token, vmlOffice ) +#define PC_TOKEN( token ) OOX_TOKEN( token, packageContentTypes ) +#define PPT_TOKEN( token ) OOX_TOKEN( token, ppt ) +#define PR_TOKEN( token ) OOX_TOKEN( token, packageRel ) +#define R_TOKEN( token ) OOX_TOKEN( token, officeRel ) +#define VML_TOKEN( token ) OOX_TOKEN( token, vml ) +#define VMLX_TOKEN( token ) OOX_TOKEN( token, vmlExcel ) +#define XDR_TOKEN( token ) OOX_TOKEN( token, dmlSpreadDr ) +#define XLS_TOKEN( token ) OOX_TOKEN( token, xls ) +#define XM_TOKEN( token ) OOX_TOKEN( token, xm ) +#define XML_TOKEN( token ) OOX_TOKEN( token, xml ) // ============================================================================ -- cgit From f9a70973626de755d37fe31b8ccec359dffeb1a0 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 18 Jan 2011 17:22:36 +0100 Subject: dr78: switch module oox to new gbuild system --- oox/Library_oox.mk | 421 ++++++++++++++++++++++++++ oox/Makefile | 38 +++ oox/Module_oox.mk | 37 +++ oox/Package_inc.mk | 45 +++ oox/Package_source.mk | 29 ++ oox/Package_workdir.mk | 32 ++ oox/oox.component | 67 ++++ oox/prj/build.lst | 19 +- oox/prj/d.lst | 46 --- oox/prj/makefile.mk | 40 +++ oox/source/core/makefile.mk | 66 ---- oox/source/docprop/makefile.mk | 49 --- oox/source/drawingml/chart/makefile.mk | 74 ----- oox/source/drawingml/diagram/makefile.mk | 53 ---- oox/source/drawingml/makefile.mk | 92 ------ oox/source/drawingml/table/makefile.mk | 62 ---- oox/source/dump/makefile.mk | 53 ---- oox/source/export/ooxml-export-notes.txt | 220 ++++++++++++++ oox/source/helper/makefile.mk | 60 ---- oox/source/ole/makefile.mk | 60 ---- oox/source/ppt/makefile.mk | 76 ----- oox/source/shape/makefile.mk | 49 --- oox/source/token/makefile.mk | 78 ----- oox/source/token/namespacemap.cxx | 2 +- oox/source/token/namespaces.pl | 58 ++-- oox/source/token/properties.pl | 52 ++-- oox/source/token/propertynames.cxx | 3 +- oox/source/token/tokenmap.cxx | 4 +- oox/source/token/tokens.pl | 80 +++-- oox/source/vml/makefile.mk | 56 ---- oox/source/xls/makefile.mk | 105 ------- oox/util/makefile.mk | 104 ------- oox/util/makefile.pmk | 30 -- oox/util/oox.component | 67 ---- oox/workben/ooxml-export-notes.txt | 220 -------------- writerfilter/source/ooxml/makefile.mk | 4 +- writerfilter/source/resourcemodel/makefile.mk | 2 +- 37 files changed, 1015 insertions(+), 1538 deletions(-) create mode 100755 oox/Library_oox.mk create mode 100755 oox/Makefile create mode 100755 oox/Module_oox.mk create mode 100755 oox/Package_inc.mk create mode 100755 oox/Package_source.mk create mode 100755 oox/Package_workdir.mk create mode 100644 oox/oox.component create mode 100755 oox/prj/makefile.mk delete mode 100644 oox/source/core/makefile.mk delete mode 100644 oox/source/docprop/makefile.mk delete mode 100644 oox/source/drawingml/chart/makefile.mk delete mode 100644 oox/source/drawingml/diagram/makefile.mk delete mode 100644 oox/source/drawingml/makefile.mk delete mode 100644 oox/source/drawingml/table/makefile.mk delete mode 100644 oox/source/dump/makefile.mk create mode 100644 oox/source/export/ooxml-export-notes.txt delete mode 100644 oox/source/helper/makefile.mk delete mode 100644 oox/source/ole/makefile.mk delete mode 100644 oox/source/ppt/makefile.mk delete mode 100644 oox/source/shape/makefile.mk delete mode 100644 oox/source/token/makefile.mk delete mode 100644 oox/source/vml/makefile.mk delete mode 100644 oox/source/xls/makefile.mk delete mode 100644 oox/util/makefile.mk delete mode 100644 oox/util/makefile.pmk delete mode 100644 oox/util/oox.component delete mode 100644 oox/workben/ooxml-export-notes.txt diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk new file mode 100755 index 000000000000..2989e18ee523 --- /dev/null +++ b/oox/Library_oox.mk @@ -0,0 +1,421 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,oox)) + +$(eval $(call gb_Library_add_package_headers,oox,oox_inc)) +$(eval $(call gb_Library_add_package_headers,oox,oox_source)) +$(eval $(call gb_Library_add_package_headers,oox,oox_workdir)) + +$(eval $(call gb_Library_set_componentfile,oox,oox/oox)) + +$(eval $(call gb_Library_set_include,oox,\ + -I$(SRCDIR)/oox/inc \ + -I$(OUTDIR)/inc \ + -I$(OUTDIR)/inc/offuh \ + -I$(WORKDIR)/Misc/oox \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_set_defs,oox,\ + $$(DEFS) \ + -DOOX_DLLIMPLEMENTATION \ +)) + +$(eval $(call gb_Library_add_linked_libs,oox,\ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + sax \ + stl \ + xcr \ + ssl \ + crypto \ +)) + +ifeq ($(OS),SOLARIS) +$(eval $(call gb_Library_add_linked_libs,oox,\ + nsl \ + socket \ + dl \ +)) +endif + +ifeq ($(OS),WNT) +$(eval $(call gb_Library_add_linked_libs,oox,\ + kernel32 \ + msvcrt \ + uwinapi \ +)) +endif + +# object files ---------------------------------------------------------------- + +$(eval $(call gb_Library_add_exception_objects,oox,\ + oox/source/core/binarycodec \ + oox/source/core/binaryfilterbase \ + oox/source/core/contexthandler \ + oox/source/core/contexthandler2 \ + oox/source/core/fastparser \ + oox/source/core/fasttokenhandler \ + oox/source/core/filterbase \ + oox/source/core/filterdetect \ + oox/source/core/fragmenthandler \ + oox/source/core/fragmenthandler2 \ + oox/source/core/recordparser \ + oox/source/core/relations \ + oox/source/core/relationshandler \ + oox/source/core/services \ + oox/source/core/xmlfilterbase \ + oox/source/docprop/docprophandler \ + oox/source/docprop/ooxmldocpropimport \ + oox/source/drawingml/clrscheme \ + oox/source/drawingml/clrschemecontext \ + oox/source/drawingml/color \ + oox/source/drawingml/colorchoicecontext \ + oox/source/drawingml/connectorshapecontext \ + oox/source/drawingml/customshapegeometry \ + oox/source/drawingml/customshapeproperties \ + oox/source/drawingml/drawingmltypes \ + oox/source/drawingml/embeddedwavaudiofile \ + oox/source/drawingml/fillproperties \ + oox/source/drawingml/fillpropertiesgroupcontext \ + oox/source/drawingml/graphicshapecontext \ + oox/source/drawingml/guidcontext \ + oox/source/drawingml/hyperlinkcontext \ + oox/source/drawingml/lineproperties \ + oox/source/drawingml/linepropertiescontext \ + oox/source/drawingml/objectdefaultcontext \ + oox/source/drawingml/shape \ + oox/source/drawingml/shapecontext \ + oox/source/drawingml/shapegroupcontext \ + oox/source/drawingml/shapepropertiescontext \ + oox/source/drawingml/shapepropertymap \ + oox/source/drawingml/shapestylecontext \ + oox/source/drawingml/spdefcontext \ + oox/source/drawingml/textbody \ + oox/source/drawingml/textbodycontext \ + oox/source/drawingml/textbodyproperties \ + oox/source/drawingml/textbodypropertiescontext \ + oox/source/drawingml/textcharacterproperties \ + oox/source/drawingml/textcharacterpropertiescontext \ + oox/source/drawingml/textfield \ + oox/source/drawingml/textfieldcontext \ + oox/source/drawingml/textfont \ + oox/source/drawingml/textliststyle \ + oox/source/drawingml/textliststylecontext \ + oox/source/drawingml/textparagraph \ + oox/source/drawingml/textparagraphproperties \ + oox/source/drawingml/textparagraphpropertiescontext \ + oox/source/drawingml/textrun \ + oox/source/drawingml/textspacingcontext \ + oox/source/drawingml/texttabstoplistcontext \ + oox/source/drawingml/theme \ + oox/source/drawingml/themeelementscontext \ + oox/source/drawingml/themefragmenthandler \ + oox/source/drawingml/transform2dcontext \ + oox/source/drawingml/chart/axiscontext \ + oox/source/drawingml/chart/axisconverter \ + oox/source/drawingml/chart/axismodel \ + oox/source/drawingml/chart/chartcontextbase \ + oox/source/drawingml/chart/chartconverter \ + oox/source/drawingml/chart/chartdrawingfragment \ + oox/source/drawingml/chart/chartspaceconverter \ + oox/source/drawingml/chart/chartspacefragment \ + oox/source/drawingml/chart/chartspacemodel \ + oox/source/drawingml/chart/converterbase \ + oox/source/drawingml/chart/datasourcecontext \ + oox/source/drawingml/chart/datasourceconverter \ + oox/source/drawingml/chart/datasourcemodel \ + oox/source/drawingml/chart/modelbase \ + oox/source/drawingml/chart/objectformatter \ + oox/source/drawingml/chart/plotareacontext \ + oox/source/drawingml/chart/plotareaconverter \ + oox/source/drawingml/chart/plotareamodel \ + oox/source/drawingml/chart/seriescontext \ + oox/source/drawingml/chart/seriesconverter \ + oox/source/drawingml/chart/seriesmodel \ + oox/source/drawingml/chart/titlecontext \ + oox/source/drawingml/chart/titleconverter \ + oox/source/drawingml/chart/titlemodel \ + oox/source/drawingml/chart/typegroupcontext \ + oox/source/drawingml/chart/typegroupconverter \ + oox/source/drawingml/chart/typegroupmodel \ + oox/source/drawingml/diagram/datamodelcontext \ + oox/source/drawingml/diagram/diagram \ + oox/source/drawingml/diagram/diagramdefinitioncontext \ + oox/source/drawingml/diagram/diagramfragmenthandler \ + oox/source/drawingml/diagram/diagramlayoutatoms \ + oox/source/drawingml/diagram/layoutnodecontext \ + oox/source/drawingml/table/tablebackgroundstylecontext \ + oox/source/drawingml/table/tablecell \ + oox/source/drawingml/table/tablecellcontext \ + oox/source/drawingml/table/tablecontext \ + oox/source/drawingml/table/tablepartstylecontext \ + oox/source/drawingml/table/tableproperties \ + oox/source/drawingml/table/tablerow \ + oox/source/drawingml/table/tablerowcontext \ + oox/source/drawingml/table/tablestyle \ + oox/source/drawingml/table/tablestylecellstylecontext \ + oox/source/drawingml/table/tablestylecontext \ + oox/source/drawingml/table/tablestylelist \ + oox/source/drawingml/table/tablestylelistfragmenthandler \ + oox/source/drawingml/table/tablestylepart \ + oox/source/drawingml/table/tablestyletextstylecontext \ + oox/source/dump/biffdumper \ + oox/source/dump/dffdumper \ + oox/source/dump/dumperbase \ + oox/source/dump/oledumper \ + oox/source/dump/pptxdumper \ + oox/source/dump/xlsbdumper \ + oox/source/helper/attributelist \ + oox/source/helper/binaryinputstream \ + oox/source/helper/binaryoutputstream \ + oox/source/helper/binarystreambase \ + oox/source/helper/containerhelper \ + oox/source/helper/graphichelper \ + oox/source/helper/modelobjecthelper \ + oox/source/helper/progressbar \ + oox/source/helper/propertymap \ + oox/source/helper/propertyset \ + oox/source/helper/storagebase \ + oox/source/helper/textinputstream \ + oox/source/helper/zipstorage \ + oox/source/ole/axbinaryreader \ + oox/source/ole/axcontrol \ + oox/source/ole/axcontrolfragment \ + oox/source/ole/olehelper \ + oox/source/ole/oleobjecthelper \ + oox/source/ole/olestorage \ + oox/source/ole/vbacontrol \ + oox/source/ole/vbahelper \ + oox/source/ole/vbainputstream \ + oox/source/ole/vbamodule \ + oox/source/ole/vbaproject \ + oox/source/ole/vbaprojectfilter \ + oox/source/ppt/animationspersist \ + oox/source/ppt/animationtypes \ + oox/source/ppt/animvariantcontext \ + oox/source/ppt/backgroundproperties \ + oox/source/ppt/buildlistcontext \ + oox/source/ppt/commonbehaviorcontext \ + oox/source/ppt/commontimenodecontext \ + oox/source/ppt/conditioncontext \ + oox/source/ppt/customshowlistcontext \ + oox/source/ppt/headerfootercontext \ + oox/source/ppt/layoutfragmenthandler \ + oox/source/ppt/pptfilterhelpers \ + oox/source/ppt/pptimport \ + oox/source/ppt/pptshape \ + oox/source/ppt/pptshapecontext \ + oox/source/ppt/pptshapegroupcontext \ + oox/source/ppt/pptshapepropertiescontext \ + oox/source/ppt/presentationfragmenthandler \ + oox/source/ppt/slidefragmenthandler \ + oox/source/ppt/slidemastertextstylescontext \ + oox/source/ppt/slidepersist \ + oox/source/ppt/slidetimingcontext \ + oox/source/ppt/slidetransition \ + oox/source/ppt/slidetransitioncontext \ + oox/source/ppt/soundactioncontext \ + oox/source/ppt/timeanimvaluecontext \ + oox/source/ppt/timenode \ + oox/source/ppt/timenodelistcontext \ + oox/source/ppt/timetargetelementcontext \ + oox/source/shape/ShapeContextHandler \ + oox/source/shape/ShapeFilterBase \ + oox/source/token/namespacemap \ + oox/source/token/propertynames \ + oox/source/token/tokenmap \ + oox/source/vml/vmldrawing \ + oox/source/vml/vmldrawingfragment \ + oox/source/vml/vmlformatting \ + oox/source/vml/vmlinputstream \ + oox/source/vml/vmlshape \ + oox/source/vml/vmlshapecontainer \ + oox/source/vml/vmlshapecontext \ + oox/source/vml/vmltextbox \ + oox/source/vml/vmltextboxcontext \ + oox/source/xls/addressconverter \ + oox/source/xls/autofilterbuffer \ + oox/source/xls/autofiltercontext \ + oox/source/xls/biffcodec \ + oox/source/xls/biffdetector \ + oox/source/xls/biffhelper \ + oox/source/xls/biffinputstream \ + oox/source/xls/biffoutputstream \ + oox/source/xls/chartsheetfragment \ + oox/source/xls/commentsbuffer \ + oox/source/xls/commentsfragment \ + oox/source/xls/condformatbuffer \ + oox/source/xls/condformatcontext \ + oox/source/xls/connectionsbuffer \ + oox/source/xls/connectionsfragment \ + oox/source/xls/defnamesbuffer \ + oox/source/xls/drawingbase \ + oox/source/xls/drawingfragment \ + oox/source/xls/drawingmanager \ + oox/source/xls/excelchartconverter \ + oox/source/xls/excelfilter \ + oox/source/xls/excelhandlers \ + oox/source/xls/excelvbaproject \ + oox/source/xls/externallinkbuffer \ + oox/source/xls/externallinkfragment \ + oox/source/xls/formulabase \ + oox/source/xls/formulaparser \ + oox/source/xls/numberformatsbuffer \ + oox/source/xls/ooxformulaparser \ + oox/source/xls/pagesettings \ + oox/source/xls/pivotcachebuffer \ + oox/source/xls/pivotcachefragment \ + oox/source/xls/pivottablebuffer \ + oox/source/xls/pivottablefragment \ + oox/source/xls/querytablebuffer \ + oox/source/xls/querytablefragment \ + oox/source/xls/richstring \ + oox/source/xls/richstringcontext \ + oox/source/xls/scenariobuffer \ + oox/source/xls/scenariocontext \ + oox/source/xls/sharedformulabuffer \ + oox/source/xls/sharedstringsbuffer \ + oox/source/xls/sharedstringsfragment \ + oox/source/xls/sheetdatacontext \ + oox/source/xls/stylesbuffer \ + oox/source/xls/stylesfragment \ + oox/source/xls/tablebuffer \ + oox/source/xls/tablefragment \ + oox/source/xls/themebuffer \ + oox/source/xls/unitconverter \ + oox/source/xls/viewsettings \ + oox/source/xls/workbookfragment \ + oox/source/xls/workbookhelper \ + oox/source/xls/workbooksettings \ + oox/source/xls/worksheetbuffer \ + oox/source/xls/worksheetfragment \ + oox/source/xls/worksheethelper \ + oox/source/xls/worksheetsettings \ +)) + +# generate source and header files from text files ---------------------------- + +SRCDIR_TOKEN = $(SRCDIR)/oox/source/token +WORKDIR_TOKEN = $(WORKDIR)/Misc/oox/token + +$(call gb_LinkTarget_get_headers_target,$(call gb_Library_get_linktargetname,$(call gb_Library_get_filename,oox))) : $(WORKDIR_TOKEN)/namespaces.hxx $(WORKDIR_TOKEN)/namespaces.txt $(WORKDIR_TOKEN)/tokens.hxx $(WORKDIR_TOKEN)/properties.hxx + +# XML namespace identifiers and names + +$(WORKDIR_TOKEN)/namespaces.hxx : $(SRCDIR_TOKEN)/namespaces.hxx.head $(WORKDIR_TOKEN)/namespaceids.inc $(SRCDIR_TOKEN)/namespaces.hxx.tail + $(call gb_Output_announce,$@,$(true),CAT,1) + $(call gb_Helper_abbreviate_dirs,cat $^ > $@) + +$(WORKDIR_TOKEN)/namespaceids.inc : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 1 < $< > $@ \ + ) + +$(SRCDIR_TOKEN)/namespacemap.cxx : $(WORKDIR_TOKEN)/namespacenames.inc + +$(WORKDIR_TOKEN)/namespacenames.inc : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 2 < $< > $@ \ + ) + +$(WORKDIR_TOKEN)/namespaces.txt : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 3 < $< > $@ \ + ) + +# XML token identifiers and names + +$(WORKDIR_TOKEN)/tokens.hxx : $(SRCDIR_TOKEN)/tokens.hxx.head $(WORKDIR_TOKEN)/tokenids.inc $(SRCDIR_TOKEN)/tokens.hxx.tail + $(call gb_Output_announce,$@,$(true),CAT,1) + $(call gb_Helper_abbreviate_dirs,cat $^ > $@) + +$(WORKDIR_TOKEN)/tokenids.inc : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 1 < $< > $@ \ + ) + +$(SRCDIR_TOKEN)/tokenmap.cxx : $(WORKDIR_TOKEN)/tokennames.inc + +$(WORKDIR_TOKEN)/tokennames.inc : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 2 < $< > $@ \ + ) + +$(SRCDIR_TOKEN)/tokenmap.cxx : $(WORKDIR_TOKEN)/tokenhash.inc + +$(WORKDIR_TOKEN)/tokenhash.inc : $(WORKDIR_TOKEN)/tokenhash.gperf + $(call gb_Output_announce,$@,$(true),GPF,3) + $(call gb_Helper_abbreviate_dirs, \ + gperf --compare-strncmp $< | $(gb_AWK) -- '{ if ($$0 !~ /^#line/){ gsub("\\(char\\*\\)0", "(char*)0, 0", $$0); print; } }' > $@ \ + ) + +$(WORKDIR_TOKEN)/tokenhash.gperf : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 3 < $< > $@ \ + ) + +# UNO property identifiers and names + +$(WORKDIR_TOKEN)/properties.hxx : $(SRCDIR_TOKEN)/properties.hxx.head $(WORKDIR_TOKEN)/propertyids.inc $(SRCDIR_TOKEN)/properties.hxx.tail + $(call gb_Output_announce,$@,$(true),CAT,1) + $(call gb_Helper_abbreviate_dirs,cat $^ > $@) + +$(WORKDIR_TOKEN)/propertyids.inc : $(SRCDIR_TOKEN)/properties.txt $(SRCDIR_TOKEN)/properties.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/properties.pl 1 < $< > $@ \ + ) + +$(SRCDIR_TOKEN)/propertynames.cxx : $(WORKDIR_TOKEN)/propertynames.inc + +$(WORKDIR_TOKEN)/propertynames.inc : $(SRCDIR_TOKEN)/properties.txt $(SRCDIR_TOKEN)/properties.pl + $(call gb_Output_announce,$@,$(true),PRL,1) + $(call gb_Helper_abbreviate_dirs, \ + mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/properties.pl 2 < $< > $@ \ + ) + +# clean generated files ------------------------------------------------------- + +.PHONY : $(WORKDIR)/Misc/oox/misc_clean + +$(call gb_LinkTarget_get_clean_target,$(call gb_Library_get_linktargetname,$(call gb_Library_get_filename,oox))) : $(WORKDIR)/Misc/oox/misc_clean + +$(WORKDIR)/Misc/oox/misc_clean : + $(call gb_Helper_abbreviate_dirs,rm -rf $(dir $@)) + +# vim: set noet sw=4 ts=4: diff --git a/oox/Makefile b/oox/Makefile new file mode 100755 index 000000000000..90947b2e5f48 --- /dev/null +++ b/oox/Makefile @@ -0,0 +1,38 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif + +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk + +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) + +# vim: set noet sw=4 ts=4: diff --git a/oox/Module_oox.mk b/oox/Module_oox.mk new file mode 100755 index 000000000000..f5412ea1d221 --- /dev/null +++ b/oox/Module_oox.mk @@ -0,0 +1,37 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Module_Module,oox)) + +$(eval $(call gb_Module_add_targets,oox,\ + Library_oox \ + Package_inc \ + Package_source \ + Package_workdir \ +)) + +# vim: set noet ts=4 sw=4: diff --git a/oox/Package_inc.mk b/oox/Package_inc.mk new file mode 100755 index 000000000000..6870821343d2 --- /dev/null +++ b/oox/Package_inc.mk @@ -0,0 +1,45 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,oox_inc,$(SRCDIR)/oox/inc)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/dllapi.h,oox/dllapi.h)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/filterbase.hxx,oox/core/filterbase.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/filterdetect.hxx,oox/core/filterdetect.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/relations.hxx,oox/core/relations.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/xmlfilterbase.hxx,oox/core/xmlfilterbase.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/drawingml/chart/chartconverter.hxx,oox/drawingml/chart/chartconverter.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/drawingml/table/tablestylelist.hxx,oox/drawingml/table/tablestylelist.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/binarystreambase.hxx,oox/helper/binarystreambase.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/helper.hxx,oox/helper/helper.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refmap.hxx,oox/helper/refmap.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refvector.hxx,oox/helper/refvector.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/storagebase.hxx,oox/helper/storagebase.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/zipstorage.hxx,oox/helper/zipstorage.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/vbaproject.hxx,oox/ole/vbaproject.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/vml/vmldrawing.hxx,oox/vml/vmldrawing.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/vml/vmlshape.hxx,oox/vml/vmlshape.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/xls/excelvbaproject.hxx,oox/xls/excelvbaproject.hxx)) diff --git a/oox/Package_source.mk b/oox/Package_source.mk new file mode 100755 index 000000000000..95917616602a --- /dev/null +++ b/oox/Package_source.mk @@ -0,0 +1,29 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,oox_source,$(SRCDIR)/oox/source)) +$(eval $(call gb_Package_add_file,oox_source,inc/oox/token/tokens.txt,token/tokens.txt)) diff --git a/oox/Package_workdir.mk b/oox/Package_workdir.mk new file mode 100755 index 000000000000..8bbde7140301 --- /dev/null +++ b/oox/Package_workdir.mk @@ -0,0 +1,32 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,oox_workdir,$(WORKDIR)/Misc/oox)) +$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/namespaces.hxx,token/namespaces.hxx)) +$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/namespaces.txt,token/namespaces.txt)) +$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/properties.hxx,token/properties.hxx)) +$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/tokens.hxx,token/tokens.hxx)) diff --git a/oox/oox.component b/oox/oox.component new file mode 100644 index 000000000000..f6519d5a8664 --- /dev/null +++ b/oox/oox.component @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oox/prj/build.lst b/oox/prj/build.lst index 03735c73dd11..2c965458b9fa 100644 --- a/oox/prj/build.lst +++ b/oox/prj/build.lst @@ -1,18 +1,3 @@ oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx xmlscript tools vcl BOOST:boost OPENSSL:openssl LIBXSLT:libxslt NULL -oox oox usr1 - all oox_mkout NULL -oox oox\prj get - all oox_prj NULL -oox oox\source\token nmake - all oox_token NULL -oox oox\source\helper nmake - all oox_helper oox_token NULL -oox oox\source\core nmake - all oox_core oox_token NULL -oox oox\source\ole nmake - all oox_ole oox_token NULL -oox oox\source\docprop nmake - all oox_docprop oox_token NULL -oox oox\source\drawingml nmake - all oox_drawingml oox_token NULL -oox oox\source\drawingml\diagram nmake - all oox_diagram oox_token NULL -oox oox\source\drawingml\chart nmake - all oox_chart oox_token NULL -oox oox\source\drawingml\table nmake - all oox_table oox_token NULL -oox oox\source\ppt nmake - all oox_ppt oox_token NULL -oox oox\source\vml nmake - all oox_vml oox_token NULL -oox oox\source\xls nmake - all oox_xls oox_token NULL -oox oox\source\dump nmake - all oox_dump oox_token NULL -oox oox\source\shape nmake - all oox_shape oox_token NULL -oox oox\util nmake - all oox_util oox_token oox_helper oox_core oox_ole oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_shape oox_docprop NULL +oox oox usr1 - all oox_mkout NULL +oox oox\prj nmake - all oox_prj NULL diff --git a/oox/prj/d.lst b/oox/prj/d.lst index 69ff66b95bc5..e69de29bb2d1 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -1,46 +0,0 @@ -mkdir: %_DEST%\inc%_EXT%\oox -mkdir: %_DEST%\inc%_EXT%\oox\core -mkdir: %_DEST%\inc%_EXT%\oox\drawingml -mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart -mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table -mkdir: %_DEST%\inc%_EXT%\oox\helper -mkdir: %_DEST%\inc%_EXT%\oox\ole -mkdir: %_DEST%\inc%_EXT%\oox\token -mkdir: %_DEST%\inc%_EXT%\oox\vml -mkdir: %_DEST%\inc%_EXT%\oox\xls - -..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map -..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib -..\%__SRC%\lib\xol.lib %_DEST%\lib%_EXT%\xol.lib -..\%__SRC%\lib\libxol.a %_DEST%\lib%_EXT%\libxol.a -..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll -..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so -..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib - -..\%__SRC%\inc\oox\token\tokens.hxx %_DEST%\inc%_EXT%\oox\token\tokens.hxx -..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt - -..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt -..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h -..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx -..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx -..\inc\oox\helper\refmap.hxx %_DEST%\inc%_EXT%\oox\helper\refmap.hxx -..\inc\oox\helper\refvector.hxx %_DEST%\inc%_EXT%\oox\helper\refvector.hxx -..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx -..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx -..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx -..\inc\oox\core\filterdetect.hxx %_DEST%\inc%_EXT%\oox\core\filterdetect.hxx -..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx -..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx -..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx -..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx -..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx -..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx -..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx -..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx - -dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" - -..\xml\components.xml %_DEST%\xml%_EXT%\components.xml -..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component diff --git a/oox/prj/makefile.mk b/oox/prj/makefile.mk new file mode 100755 index 000000000000..83510a6a4ce1 --- /dev/null +++ b/oox/prj/makefile.mk @@ -0,0 +1,40 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. +TARGET=prj + +.INCLUDE : settings.mk + +.IF "$(VERBOSE)"!="" +VERBOSEFLAG := +.ELSE +VERBOSEFLAG := -s +.ENDIF + +all: + cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) diff --git a/oox/source/core/makefile.mk b/oox/source/core/makefile.mk deleted file mode 100644 index 2b58b95777df..000000000000 --- a/oox/source/core/makefile.mk +++ /dev/null @@ -1,66 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=core -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -.IF "$(SYSTEM_OPENSSL)" == "YES" -CFLAGS+= $(OPENSSL_CFLAGS) -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/binarycodec.obj \ - $(SLO)$/binaryfilterbase.obj \ - $(SLO)$/contexthandler.obj \ - $(SLO)$/contexthandler2.obj \ - $(SLO)$/fastparser.obj \ - $(SLO)$/fasttokenhandler.obj \ - $(SLO)$/filterbase.obj \ - $(SLO)$/filterdetect.obj \ - $(SLO)$/fragmenthandler.obj \ - $(SLO)$/fragmenthandler2.obj \ - $(SLO)$/recordparser.obj \ - $(SLO)$/relations.obj \ - $(SLO)$/relationshandler.obj \ - $(SLO)$/services.obj \ - $(SLO)$/xmlfilterbase.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/docprop/makefile.mk b/oox/source/docprop/makefile.mk deleted file mode 100644 index 5687178da9e0..000000000000 --- a/oox/source/docprop/makefile.mk +++ /dev/null @@ -1,49 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=docprop -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/ooxmldocpropimport.obj \ - $(SLO)$/docprophandler.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/drawingml/chart/makefile.mk b/oox/source/drawingml/chart/makefile.mk deleted file mode 100644 index 84762e6a2540..000000000000 --- a/oox/source/drawingml/chart/makefile.mk +++ /dev/null @@ -1,74 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=oox -TARGET=chart -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/axiscontext.obj \ - $(SLO)$/axisconverter.obj \ - $(SLO)$/axismodel.obj \ - $(SLO)$/chartcontextbase.obj \ - $(SLO)$/chartconverter.obj \ - $(SLO)$/chartdrawingfragment.obj \ - $(SLO)$/chartspaceconverter.obj \ - $(SLO)$/chartspacefragment.obj \ - $(SLO)$/chartspacemodel.obj \ - $(SLO)$/converterbase.obj \ - $(SLO)$/datasourcecontext.obj \ - $(SLO)$/datasourceconverter.obj \ - $(SLO)$/datasourcemodel.obj \ - $(SLO)$/modelbase.obj \ - $(SLO)$/objectformatter.obj \ - $(SLO)$/plotareacontext.obj \ - $(SLO)$/plotareaconverter.obj \ - $(SLO)$/plotareamodel.obj \ - $(SLO)$/seriescontext.obj \ - $(SLO)$/seriesconverter.obj \ - $(SLO)$/seriesmodel.obj \ - $(SLO)$/titlecontext.obj \ - $(SLO)$/titleconverter.obj \ - $(SLO)$/titlemodel.obj \ - $(SLO)$/typegroupcontext.obj \ - $(SLO)$/typegroupconverter.obj \ - $(SLO)$/typegroupmodel.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/drawingml/diagram/makefile.mk b/oox/source/drawingml/diagram/makefile.mk deleted file mode 100644 index 9d526ed3d3fb..000000000000 --- a/oox/source/drawingml/diagram/makefile.mk +++ /dev/null @@ -1,53 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=oox -TARGET=diagram -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/diagram.obj \ - $(SLO)$/diagramfragmenthandler.obj \ - $(SLO)$/diagramdefinitioncontext.obj \ - $(SLO)$/diagramlayoutatoms.obj \ - $(SLO)$/datamodelcontext.obj \ - $(SLO)$/layoutnodecontext.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk deleted file mode 100644 index 0546fb4c233d..000000000000 --- a/oox/source/drawingml/makefile.mk +++ /dev/null @@ -1,92 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=drawingml -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/clrscheme.obj\ - $(SLO)$/clrschemecontext.obj\ - $(SLO)$/color.obj\ - $(SLO)$/colorchoicecontext.obj\ - $(SLO)$/connectorshapecontext.obj\ - $(SLO)$/customshapegeometry.obj\ - $(SLO)$/customshapeproperties.obj\ - $(SLO)$/drawingmltypes.obj\ - $(SLO)$/embeddedwavaudiofile.obj\ - $(SLO)$/fillproperties.obj\ - $(SLO)$/fillpropertiesgroupcontext.obj\ - $(SLO)$/graphicshapecontext.obj\ - $(SLO)$/guidcontext.obj\ - $(SLO)$/hyperlinkcontext.obj\ - $(SLO)$/lineproperties.obj\ - $(SLO)$/linepropertiescontext.obj\ - $(SLO)$/objectdefaultcontext.obj\ - $(SLO)$/shape.obj\ - $(SLO)$/shapecontext.obj\ - $(SLO)$/shapegroupcontext.obj\ - $(SLO)$/shapepropertiescontext.obj\ - $(SLO)$/shapepropertymap.obj\ - $(SLO)$/shapestylecontext.obj\ - $(SLO)$/spdefcontext.obj\ - $(SLO)$/textbody.obj\ - $(SLO)$/textbodycontext.obj\ - $(SLO)$/textbodyproperties.obj\ - $(SLO)$/textbodypropertiescontext.obj\ - $(SLO)$/textcharacterproperties.obj\ - $(SLO)$/textcharacterpropertiescontext.obj\ - $(SLO)$/textfield.obj\ - $(SLO)$/textfieldcontext.obj\ - $(SLO)$/textfont.obj\ - $(SLO)$/textliststyle.obj \ - $(SLO)$/textliststylecontext.obj\ - $(SLO)$/textparagraph.obj\ - $(SLO)$/textparagraphproperties.obj\ - $(SLO)$/textparagraphpropertiescontext.obj\ - $(SLO)$/textrun.obj\ - $(SLO)$/textspacingcontext.obj\ - $(SLO)$/texttabstoplistcontext.obj\ - $(SLO)$/theme.obj\ - $(SLO)$/themeelementscontext.obj\ - $(SLO)$/themefragmenthandler.obj\ - $(SLO)$/transform2dcontext.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/drawingml/table/makefile.mk b/oox/source/drawingml/table/makefile.mk deleted file mode 100644 index fa71971fc278..000000000000 --- a/oox/source/drawingml/table/makefile.mk +++ /dev/null @@ -1,62 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=oox -TARGET=table -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/tablecontext.obj \ - $(SLO)$/tableproperties.obj \ - $(SLO)$/tablerow.obj \ - $(SLO)$/tablerowcontext.obj \ - $(SLO)$/tablecell.obj \ - $(SLO)$/tablecellcontext.obj \ - $(SLO)$/tablestylelist.obj \ - $(SLO)$/tablestylelistfragmenthandler.obj \ - $(SLO)$/tablestylecontext.obj \ - $(SLO)$/tablestyle.obj \ - $(SLO)$/tablebackgroundstylecontext.obj \ - $(SLO)$/tablepartstylecontext.obj \ - $(SLO)$/tablestyletextstylecontext.obj \ - $(SLO)$/tablestylecellstylecontext.obj \ - $(SLO)$/tablestylepart.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/dump/makefile.mk b/oox/source/dump/makefile.mk deleted file mode 100644 index 1e5f615675cc..000000000000 --- a/oox/source/dump/makefile.mk +++ /dev/null @@ -1,53 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=dump -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/biffdumper.obj \ - $(SLO)$/dffdumper.obj \ - $(SLO)$/dumperbase.obj \ - $(SLO)$/oledumper.obj \ - $(SLO)$/pptxdumper.obj \ - $(SLO)$/xlsbdumper.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/export/ooxml-export-notes.txt b/oox/source/export/ooxml-export-notes.txt new file mode 100644 index 000000000000..8da4582b72b1 --- /dev/null +++ b/oox/source/export/ooxml-export-notes.txt @@ -0,0 +1,220 @@ +How to install this +------------------- + +> cd instsetoo_native/util +> LOCALINSTALLDIR=/where/you/want dmake openoffice_en-US PKGFORMAT=installed + +OOXML generally +--------------- + +- http://www.ecma-international.org/publications/standards/Ecma-376.htm +- http://www.asahi-net.or.jp/~eb2m-mrt/ooxml/dependencies.html + +Related modules +--------------- + +- oox + - .xlsx and .pptx import + +- writerfilter + - import of .docx, uses also oox for the graphics etc. + - can also parse .doc; but used for ooxml only for now + +- filter + - the configuration stuff (so that the filters appear in the filepicker) + +Old binary filters (export) +--------------------------- + +- doc export + - sw/source/filter/ww8/wrtww8* + - wrtww8.cxx:2191 [SwWW8Writer::StoreDoc()] is the entry point + + - eg. + #0 SwWW8Writer::WriteText (this=0x2aaab3dfb7c0) at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1846 + #1 0x00002aaaae75a545 in SwWW8Writer::WriteMainText (this=0x2aaab3d6a870) + at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1925 + #2 0x00002aaaae75e357 in SwWW8Writer::StoreDoc1 (this=0x2aaab3d6a870) + at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2076 + #3 0x00002aaaae7605ec in SwWW8Writer::StoreDoc (this=0x2aaab3d6a870) + at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2383 + #4 0x00002aaaae760fd5 in SwWW8Writer::WriteStorage (this=0x2aaab3d6a870) + at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2547 + #5 0x00002aaaae70b793 in StgWriter::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStg=@0x2aaab3d621c0, + pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:653 + #6 0x00002aaaae70b84d in Writer::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStrm=@0x2aaaad979d20, + pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:358 + #7 0x00002aaaae70b993 in Writer::Write (this=0x2aaab3d6a870, rPam=@0x2b3802a2b640, rMed=@0x2aaaad999f30, + pFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:385 + #8 0x00002aaaae6375d7 in SwWriter::Write (this=0x7fffb1b28410, rxWriter=@0x7fffb1b285d0, + pRealFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/basflt/shellio.cxx:963 + #9 0x00002aaaae87cc1e in SwDocShell::ConvertTo (this=0xcc27f0, rMedium=@0x2aaaad999f30) + at /local/ooxml/ooxml/sw/source/ui/app/docsh.cxx:924 + #10 0x00002b37faae6b58 in SfxObjectShell::DoLoad () + from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so + +- xls export + - sc/source/filter/excel/xe* + + - eg. + #0 XclExpRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0) + at /local/ooxml/ooxml/sc/source/filter/excel/xerecord.cxx:88 + #1 0x00002aaaae562c4a in ExcRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0) + at /local/ooxml/ooxml/sc/source/filter/excel/excrecds.cxx:168 + #2 0x00002aaaae54b0fa in XclExpRecordList::Save (this=0x11c5d18, rStrm=@0x7fff5e6335d0) + at ../inc/xerecord.hxx:281 + #3 0x00002aaaae547541 in ExcTable::Write (this=0x11c5cf8, rStr=@0x7fff5e6335d0) + at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:455 + #4 0x00002aaaae5475fb in ExcDocument::Write (this=0x11c5ce0, rSvStrm=@0x2aaab3dcd070) + at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:525 + #5 0x00002aaaae568add in ExportBiff5::Write (this=0x7fff5e6339c0) + at /local/ooxml/ooxml/sc/source/filter/excel/expop2.cxx:119 + #6 0x00002aaaae54f4af in ScExportExcel5 (rMedium=@0x2aaab3d87410, pDocument=0xce6a00, bBiff8=1 '\001', eNach=1) + at /local/ooxml/ooxml/sc/source/filter/excel/excel.cxx:252 + #7 0x00002aaaadf1b70a in ScDocShell::ConvertTo (this=0xce6990, rMed=@0x2aaab3d87410) + at /local/ooxml/ooxml/sc/source/ui/docshell/docsh.cxx:2080 + #8 0x00002b354dfd8b58 in SfxObjectShell::DoLoad () + from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so + + - Current approach is to add a XclExpRecordBase::SaveXml() method, which + would be used to write the XML content (while Save() would continue + writing the BIFF format). + - Q: How do we get to the Save()/SaveXml() methods (e.g. the SST export code) + #0 XclExpSstImpl::Save (this=0x1b170b0, rStrm=@0x7fffd4d5c4a0) + at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:224 + #1 0x00007f68b7e46ff7 in XclExpSst::Save (this=0x1abc300, + rStrm=@0x7fffd4d5c4a0) + at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:351 + #2 0x00007f68b7de5090 in XclExpRecordList::Save ( + this=0x1b2d168, rStrm=@0x7fffd4d5c4a0) at ../inc/xerecord.hxx:282 + // as above, starting at frame 2 + + - Thus, to get to the SaveXml() method, we need to add a slew of WriteXml() + methods that will (eventually) invoke the SaveXml() methods. + + - ZipStorage for XML handling and StorageRef (XStorage interface) + - To construct ZipStorage, need XMultiServiceFactory (!), and + XInputStream. + - Have an SvStream; need to wrap SvStream with XInputStream + - OInputStreamWrapper in + - Where do I get XMultiServiceFactory? + - Lots of places -- just grep + - perhaps XmlFilterBase _does_ make sense here. + - Do it anyway. + - Looking into having XclExpXmlStream inherit from ZipFilterBase + - problem: exception during construction, because ZipStorage hates me: + #0 OStorageFactory::createInstanceWithArguments (this=0x10612a0, + aArguments=@0x7fffe2ef76d0) + at /home/jon/Development/OpenOffice.org/ooxml/package/source/xstor/xfactory.cxx:275 + #1 0x00007f12d93f0d5c in comphelper::OStorageHelper::GetStorageOfFormatFromStream (aFormat=@0x7fffe2ef7780, xStream=@0x1a502d8, nStorageMode=15, + xFactory=@0x1a502c0) + at /home/jon/Development/OpenOffice.org/ooxml/comphelper/source/misc/storagehelper.cxx:342 + #2 0x00007f12c33d1a6d in ZipStorage (this=0x1a92550, rxFactory=@0x1a502c0, + rxStream=@0x1a502d8) + at /home/jon/Development/OpenOffice.org/ooxml/oox/source/helper/zipstorage.cxx:87 + #3 0x00007f12c33f089e in oox::core::XmlFilterBase::implCreateStorage ( + this=0x7fffe2ef7930, rxInStream=@0x1a502d0, rxStream=@0x1a502d8) + at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/xmlfilterbase.cxx:298 + #4 0x00007f12c33dd204 in oox::core::FilterBase::filter (this=0x7fffe2ef7930, + rDescriptor=@0x7fffe2ef78d0) + at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/filterbase.cxx:284 + #5 0x00007f12c68097a2 in XclExpXmlStream (this=0x7fffe2ef7930, + rSMgr=@0x7fffe2ef79a0, rStrm=@0x18d6f90) + at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xestream.cxx:659 + #6 0x00007f12c674c8c1 in ExcDocument::WriteXml (this=0x15911f0, + rStrm=@0x18d6f90) + at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/excdoc.cxx:575 + ... + - Actual problem: xfactory.cxx:274, the CheckPackageSignature_Impl() call. + - fails because the empty file has content (!), thus fails the "package + signature check" (which tries to ensure the file format is correct). + - Underlying file is an SvFileStream, created in + SfxMedium::GetOutStream(). + - So why's CheckPackageSignature_Impl() fail? Because + lcl_ExportExcel2007Xml() had the code: + + SotStorageRef xRootStrg = new SotStorage( pMedStrm, FALSE ); + + That is, it was creating an OLE Structured Storage document over the + SvStream, and then (later) used the *same* SvStream and passed it to + ZipStorage. This caused ZipStorage to complain because OLESS data was + already present in the file, with a different file signature than what + ZipPackage was expecting (go figure). + +- ppt export + - sd/source/filter/eppt/* + - svx/source/msfilter + - for eg. Escher export + - Escher: http://chicago.sourceforge.net/devel/docs/escher/index.html + + - eg. + #0 PPTWriter (this=0x15807d0, rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0, pVBA=0x0, + nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:268 + #1 0x00002aaab3895719 in ExportPPT (rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0, + pVBA=0x0, nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:2503 + #2 0x00002aaaadef85b7 in SdPage::onParagraphRemoving () + from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so + #3 0x00002aaaade202e3 in sd::DrawDocShell::ConvertTo () + from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so + #4 0x00002aec23119b58 in SfxObjectShell::DoLoad () + from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so + +- odp export + #0 ZipPackage (this=0x1805e80, xNewFactory=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:279 + #1 0x00002aaaadd3dc94 in ZipPackage_createInstance (xMgr=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:1546 + #2 0x00002b0fca7ab6b3 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #3 0x00002b0fca7a7fda in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #4 0x00002b0fca7a811e in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #5 0x00002b0fca7aa7cc in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #6 0x00002b0fca7aacbe in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #7 0x00002b0fca7aa035 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 + #8 0x00002aaaaadae1b3 in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so + #9 0x00002aaaaadaa84c in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so + #10 0x00002aaab5c7a7e5 in OStorage_Impl::OpenOwnPackage (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:549 + #11 0x00002aaab5c7ab3e in OStorage_Impl::ReadContents (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:649 + #12 0x00002aaab5c7d32f in OStorage_Impl::FindElement (this=0x185cac0, rName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:1387 + #13 0x00002aaab5c7dc45 in OStorage::hasByName (this=0x1808880, aName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:4045 + #14 0x00002aaab1fde8c5 in XMLVersionListPersistence::load () from /opt/openoffice.org3.0/program/../basis-link/program/libxolx.so + #15 0x00002b0fcb058bb2 in SfxMedium::GetVersionList (this=0x1750050, _bNoReload=false) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:3247 + #16 0x00002b0fcb0571b5 in SfxMedium::GetStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1328 + #17 0x00002b0fcb05d0d7 in SfxMedium::GetOutputStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1068 + #18 0x00002b0fcb091227 in SfxObjectShell::SaveTo_Impl (this=0xf44d60, rMedium=@0x1750050, pSet=0x0) at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:1557 + #19 0x00002b0fcb09443c in SfxObjectShell::PreDoSaveAs_Impl (this=0xf44d60, rFileName=@0x7fffe2850700, aFilterName=@0x7fffe28507f0, pParams=0xf10c10) + at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2984 + #20 0x00002b0fcb094ea5 in SfxObjectShell::CommonSaveAs_Impl (this=0xf44d60, aURL=@0x7fffe2850870, aFilterName=@0x7fffe28507f0, aParams=0x1740310) + at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2855 + #21 0x00002b0fcb0a1da2 in SfxObjectShell::APISaveAs_Impl (this=0xf44d60, aFileName=@0x7fffe2850b70, aParams=0x1740310) + at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:432 + #22 0x00002b0fcb0e74c8 in SfxBaseModel::impl_store (this=0xf96a00, sURL=@0x7fffe28516b0, seqArguments=@0x7fffe2851ae0, bSaveTo=0 '\0') + at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:2591 + #23 0x00002b0fcb0f124b in SfxBaseModel::storeAsURL (this=0xf96a00, rURL=@0x7fffe28516b0, rArgs=@0x7fffe2851ae0) + at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:1568 + #24 0x00002b0fcb101d3d in SfxStoringHelper::GUIStoreModel (this=0x7fffe28519f0, xModel=@0xf18798, aSlotName=@0x7fffe2852200, aArgsSequence=@0x7fffe2851ae0, + bPreselectPassword=0 '\0') at /home/rodo/git/ooxml/sfx2/source/doc/guisaveas.cxx:1529 + #25 0x00002b0fcb0a4051 in SfxObjectShell::ExecFile_Impl (this=0xf44d60, rReq=@0x1484f20) at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:744 + #26 0x00002b0fcb0a5c73 in SfxStubSfxObjectShellExecFile_Impl (pShell=0xf44d60, rReq=@0x1484f20) at ../../unxlngx6.pro/inc/sfxslots.hxx:161 + #27 0x00002b0fcb17f398 in SfxShell::CallExec (this=0xf44d60, pFunc=0x2b0fcb0a5c56 , rReq=@0x1484f20) + at ../../inc/sfx2/shell.hxx:226 + #28 0x00002b0fcb17cec3 in SfxDispatcher::Call_Impl (this=0x110fde0, rShell=@0xf44d60, rSlot=@0x2b0fcb576368, rReq=@0x1484f20, bRecord=1 '\001') + at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:338 + #29 0x00002b0fcb17d3f2 in SfxDispatcher::PostMsgHandler (this=0x110fde0, pReq=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1643 + #30 0x00002b0fcb17d51d in SfxDispatcher::LinkStubPostMsgHandler (pThis=0x110fde0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1610 + #31 0x00002b0fcafb3e70 in Link::Call (this=0x11488f8, pCaller=0x1484f20) at /home/rodo/git/ooxml/solver/300/unxlngx6.pro/inc/tools/link.hxx:158 + #32 0x00002b0fcb1a9952 in GenLink::Call (this=0x11488f8, pCaller=0x1484f20) at ../../inc/sfx2/genlink.hxx:63 + #33 0x00002b0fcb1a9773 in SfxHintPoster::Event (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:98 + #34 0x00002b0fcb1a9984 in SfxHintPoster::DoEvent_Impl (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:88 + #35 0x00002b0fcb1a974f in SfxHintPoster::LinkStubDoEvent_Impl (pThis=0x11488e0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:92 + #36 0x00002b0fccef69f8 in ImplWindowFrameProc () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so + #37 0x00002b0fd3f91f8f in SalDisplay::DispatchInternalEvent () from /opt/openoffice.org/basis3.0/program/libvclplug_genlx.so + #38 0x00002b0fd0fa4a84 in GtkXLib::userEventFn () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so + #39 0x00002b0fd3cb0204 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 + #40 0x00002b0fd3cb34fd in ?? () from /usr/lib64/libglib-2.0.so.0 + #41 0x00002b0fd3cb39ce in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 + #42 0x00002b0fd0fa4fd9 in GtkXLib::Yield () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so + #43 0x00002b0fccd1859e in Application::Yield () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so + #44 0x00002b0fccd18677 in Application::Execute () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so + #45 0x00002b0fc86fd803 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so + #46 0x00002b0fccd1da24 in ImplSVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so + #47 0x00002b0fccd1db15 in SVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so + #48 0x00002b0fc872fe6c in soffice_main () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so + #49 0x000000000040114b in main () diff --git a/oox/source/helper/makefile.mk b/oox/source/helper/makefile.mk deleted file mode 100644 index f31736faac8d..000000000000 --- a/oox/source/helper/makefile.mk +++ /dev/null @@ -1,60 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=helper -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/attributelist.obj \ - $(SLO)$/binaryinputstream.obj \ - $(SLO)$/binaryoutputstream.obj \ - $(SLO)$/binarystreambase.obj \ - $(SLO)$/containerhelper.obj \ - $(SLO)$/graphichelper.obj \ - $(SLO)$/modelobjecthelper.obj \ - $(SLO)$/progressbar.obj \ - $(SLO)$/propertymap.obj \ - $(SLO)$/propertyset.obj \ - $(SLO)$/storagebase.obj \ - $(SLO)$/textinputstream.obj \ - $(SLO)$/zipstorage.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/ole/makefile.mk b/oox/source/ole/makefile.mk deleted file mode 100644 index a5232247cfa5..000000000000 --- a/oox/source/ole/makefile.mk +++ /dev/null @@ -1,60 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=ole -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/axbinaryreader.obj \ - $(SLO)$/axcontrol.obj \ - $(SLO)$/axcontrolfragment.obj \ - $(SLO)$/olehelper.obj \ - $(SLO)$/oleobjecthelper.obj \ - $(SLO)$/olestorage.obj \ - $(SLO)$/vbacontrol.obj \ - $(SLO)$/vbahelper.obj \ - $(SLO)$/vbainputstream.obj \ - $(SLO)$/vbamodule.obj \ - $(SLO)$/vbaproject.obj \ - $(SLO)$/vbaprojectfilter.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/oox/source/ppt/makefile.mk b/oox/source/ppt/makefile.mk deleted file mode 100644 index 8d902ed51337..000000000000 --- a/oox/source/ppt/makefile.mk +++ /dev/null @@ -1,76 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=ppt -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/animationspersist.obj \ - $(SLO)$/animationtypes.obj \ - $(SLO)$/animvariantcontext.obj \ - $(SLO)$/backgroundproperties.obj\ - $(SLO)$/buildlistcontext.obj \ - $(SLO)$/commonbehaviorcontext.obj \ - $(SLO)$/commontimenodecontext.obj \ - $(SLO)$/conditioncontext.obj \ - $(SLO)$/customshowlistcontext.obj \ - $(SLO)$/headerfootercontext.obj \ - $(SLO)$/layoutfragmenthandler.obj\ - $(SLO)$/pptfilterhelpers.obj\ - $(SLO)$/pptimport.obj\ - $(SLO)$/pptshape.obj \ - $(SLO)$/pptshapecontext.obj \ - $(SLO)$/pptshapegroupcontext.obj \ - $(SLO)$/pptshapepropertiescontext.obj \ - $(SLO)$/presentationfragmenthandler.obj\ - $(SLO)$/slidefragmenthandler.obj\ - $(SLO)$/slidemastertextstylescontext.obj \ - $(SLO)$/slidepersist.obj\ - $(SLO)$/slidetimingcontext.obj\ - $(SLO)$/slidetransition.obj\ - $(SLO)$/slidetransitioncontext.obj\ - $(SLO)$/soundactioncontext.obj \ - $(SLO)$/timeanimvaluecontext.obj \ - $(SLO)$/timenode.obj\ - $(SLO)$/timenodelistcontext.obj \ - $(SLO)$/timetargetelementcontext.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/shape/makefile.mk b/oox/source/shape/makefile.mk deleted file mode 100644 index c6534b3a8a6f..000000000000 --- a/oox/source/shape/makefile.mk +++ /dev/null @@ -1,49 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=shape -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/ShapeContextHandler.obj \ - $(SLO)$/ShapeFilterBase.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk deleted file mode 100644 index ff42967f0bb1..000000000000 --- a/oox/source/token/makefile.mk +++ /dev/null @@ -1,78 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=token - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/namespacemap.obj \ - $(SLO)$/propertynames.obj \ - $(SLO)$/tokenmap.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -GENHEADERPATH = $(INCCOM)$/oox$/token - -$(MISC)$/tokenhash.gperf $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx : - @@noop $(assign do_phony:=.PHONY) - -$(SLO)$/tokenmap.obj : $(INCCOM)$/tokenhash.inc $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(MISC)$/do_tokens - -$(INCCOM)$/tokenhash.inc : $(MISC)$/tokenhash.gperf $(MISC)$/do_tokens - $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokenhash.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokenhash.inc - -$(MISC)$/do_tokens $(do_phony) : tokens.txt tokens.pl tokens.hxx.head tokens.hxx.tail $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf - @@-$(RM) $@ - $(MKDIRHIER) $(GENHEADERPATH) - $(PERL) tokens.pl tokens.txt $(MISC)$/tokenids.inc $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf && $(TYPE) tokens.hxx.head $(MISC)$/tokenids.inc tokens.hxx.tail > $(GENHEADERPATH)$/tokens.hxx && $(TOUCH) $@ - -$(SLO)$/namespacemap.obj : $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(MISC)$/do_namespaces - -$(MISC)$/do_namespaces $(do_phony) : namespaces.txt namespaces.pl namespaces.hxx.head namespaces.hxx.tail $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx - @@-$(RM) $@ - $(MKDIRHIER) $(GENHEADERPATH) - $(PERL) namespaces.pl namespaces.txt $(MISC)$/namespaceids.inc $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt && $(TYPE) namespaces.hxx.head $(MISC)$/namespaceids.inc namespaces.hxx.tail > $(GENHEADERPATH)$/namespaces.hxx && $(TOUCH) $@ - -$(SLO)$/propertynames.obj : $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx $(MISC)$/do_properties - -$(MISC)$/do_properties $(do_phony) : properties.txt properties.pl properties.hxx.head properties.hxx.tail $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx - @@-$(RM) $@ - $(MKDIRHIER) $(GENHEADERPATH) - $(PERL) properties.pl properties.txt $(MISC)$/propertyids.inc $(INCCOM)$/propertynames.inc && $(TYPE) properties.hxx.head $(MISC)$/propertyids.inc properties.hxx.tail > $(GENHEADERPATH)$/properties.hxx && $(TOUCH) $@ diff --git a/oox/source/token/namespacemap.cxx b/oox/source/token/namespacemap.cxx index 0f4373d2dc59..d021f2a3a353 100755 --- a/oox/source/token/namespacemap.cxx +++ b/oox/source/token/namespacemap.cxx @@ -36,7 +36,7 @@ NamespaceMap::NamespaceMap() static const struct NamespaceUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceUrls[] = { // include auto-generated C array with namespace URLs as C strings -#include "namespacenames.inc" +#include { -1, "" } }; diff --git a/oox/source/token/namespaces.pl b/oox/source/token/namespaces.pl index 3c741fa7b2af..7c602f70128d 100644 --- a/oox/source/token/namespaces.pl +++ b/oox/source/token/namespaces.pl @@ -25,17 +25,19 @@ # #************************************************************************* -$ARGV0 = shift @ARGV; -$ARGV1 = shift @ARGV; -$ARGV2 = shift @ARGV; -$ARGV3 = shift @ARGV; +# operation mode (1 = identifiers, 2 = names, 3 = plain) +$op = shift @ARGV; +die "Error: invalid operation" unless( $op >= 1 && $op <= 3); -# parse input file +# number of bits to shift the namespace identifier +$shift = 16; + +if( $op == 1 ) { + print( "const size_t NMSP_SHIFT = $shift;\n" ); +} -open( INFILE, $ARGV0 ) or die "cannot open input file: $!"; -my %namespaces; -while( ) -{ +$i = 1; +while( <> ) { # trim newline chomp( $_ ); # trim leading/trailing whitespace @@ -44,36 +46,14 @@ while( ) # trim comments $_ =~ s/^#.*//; # skip empty lines - if( $_ ) - { + if( $_ ) { # check for valid characters - $_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data"; - $namespaces{$1} = $2; + $_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid entry: '$_'"; + # generate output + $id = $i << $shift; + if( $op == 1 ) { print( "const sal_Int32 NMSP_$1 = $i << NMSP_SHIFT;\n" ); } + elsif( $op == 2 ) { print( "{ $id, \"$2\" },\n" ); } + elsif( $op == 3 ) { print( "$id $1 $2\n" ); } + ++$i; } } -close( INFILE ); - -# generate output files - -open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; -open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; -open( TXTFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!"; - -# number of bits to shift the namespace identifier -$shift = 16; - -print ( IDFILE "const size_t NMSP_SHIFT = $shift;\n" ); - -$i = 1; -foreach( keys( %namespaces ) ) -{ - print( IDFILE "const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n" ); - $id = $i << $shift; - print( NAMEFILE "{ $id, \"$namespaces{$_}\" },\n" ); - print( TXTFILE "$id $_ $namespaces{$_}\n" ); - ++$i; -} - -close( IDFILE ); -close( nameFILE ); -close( TXTFILE ); diff --git a/oox/source/token/properties.pl b/oox/source/token/properties.pl index f341924bbb90..448cec632343 100644 --- a/oox/source/token/properties.pl +++ b/oox/source/token/properties.pl @@ -25,43 +25,33 @@ # #************************************************************************* -$ARGV0 = shift @ARGV; -$ARGV1 = shift @ARGV; -$ARGV2 = shift @ARGV; +# operation mode (1 = identifiers, 2 = names) +$op = shift @ARGV; +die "Error: invalid operation" unless( $op >= 1 && $op <= 2); -# parse input file - -open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; -my %props; -while( ) -{ +$i = 0; +while( <> ) { # trim newline chomp( $_ ); # trim leading/trailing whitespace $_ =~ s/^\s*//g; $_ =~ s/\s*$//g; - # check for valid characters - $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "Error: invalid character in property '$_'"; - $id = "PROP_$_"; - $props{$_} = $id; + # skip empty lines + if( $_ ) { + # check for valid characters + $_ =~ /^[A-Z][a-zA-Z0-9]+$/ or die "Error: invalid entry: '$_'"; + # generate output + if( $op == 1 ) { + print( "const sal_Int32 PROP_$_ = $i;\n" ); + } elsif( $op == 2 ) { + print( "/* $i */ \"$_\",\n" ); + } + ++$i; + } } -close( INFILE ); - -# generate output files - -open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; -open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; -$i = 0; -foreach( sort( keys( %props ) ) ) -{ - print( IDFILE "const sal_Int32 $props{$_} = $i;\n" ); - print( NAMEFILE "/* $i */ \"$_\",\n" ); - ++$i; +if( $op == 1 ) { + print( "const sal_Int32 PROP_COUNT = $i;\nconst sal_Int32 PROP_INVALID = -1;\n" ); +} elsif( $op == 2 ) { + print( " \"\"" ); } - -print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" ); -print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" ); - -close( IDFILE ); -close( NAMEFILE ); diff --git a/oox/source/token/propertynames.cxx b/oox/source/token/propertynames.cxx index 401d168fe696..b8f06496c7ff 100644 --- a/oox/source/token/propertynames.cxx +++ b/oox/source/token/propertynames.cxx @@ -36,8 +36,7 @@ PropertyNameVector::PropertyNameVector() static const sal_Char* sppcPropertyNames[] = { // include auto-generated C array with property names as C strings -#include "propertynames.inc" - "" +#include }; size_t nArraySize = (sizeof( sppcPropertyNames ) / sizeof( *sppcPropertyNames )) - 1; diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index a5189269c3c8..8f097b10c7fb 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -44,7 +44,7 @@ using ::rtl::OUString; namespace { // include auto-generated Perfect_Hash -#include "tokenhash.inc" +#include } // namespace // ============================================================================ @@ -55,7 +55,7 @@ TokenMap::TokenMap() : static const sal_Char* sppcTokenNames[] = { // include auto-generated C array with token names as C strings -#include "tokennames.inc" +#include "" }; diff --git a/oox/source/token/tokens.pl b/oox/source/token/tokens.pl index a951cee80db2..4307a7d9047a 100644 --- a/oox/source/token/tokens.pl +++ b/oox/source/token/tokens.pl @@ -25,56 +25,50 @@ # #************************************************************************* -$ARGV0 = shift @ARGV; -$ARGV1 = shift @ARGV; -$ARGV2 = shift @ARGV; -$ARGV3 = shift @ARGV; +# operation mode (1 = identifiers, 2 = names, 3 = gperf) +$op = shift @ARGV; +die "Error: invalid operation" unless( $op >= 1 && $op <= 3); -open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; -my %tokens; -while ( ) +if( $op == 3 ) { + print( "%language=C++\n" ); + print( "%global-table\n" ); + print( "%null-strings\n" ); + print( "%struct-type\n" ); + print( "struct xmltoken {\n" ); + print( " const sal_Char *name;\n" ); + print( " sal_Int32 nToken;\n" ); + print( "};\n" ); + print( "%%\n" ); +} + +$i = 0; +while( <> ) { # trim newline chomp( $_ ); # trim leading/trailing whitespace $_ =~ s/^\s*//g; $_ =~ s/\s*$//g; - # check for valid characters - $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'"; - $id = "XML_$_"; - $id =~ s/-/_/g; - $tokens{$_} = $id; + # skip empty lines + if( $_ ) { + # check for valid characters + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid entry: '$_'"; + # generate output + $id = "XML_$_"; + $id =~ s/-/_/g; + if( $op == 1 ) { + print( "const sal_Int32 $id = $i;\n" ); + } elsif( $op == 2 ) { + print( "\"$_\",\n" ); + } elsif( $op == 3 ) { + print( "$_,$id\n" ); + } + ++$i; + } } -close ( INFILE ); - -# generate output files - -open ( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; -open ( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; -open ( GPERFFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!"; -print( GPERFFILE "%language=C++\n" ); -print( GPERFFILE "%global-table\n" ); -print( GPERFFILE "%null-strings\n" ); -print( GPERFFILE "%struct-type\n" ); -print( GPERFFILE "struct xmltoken {\n" ); -print( GPERFFILE " const sal_Char *name;\n" ); -print( GPERFFILE " sal_Int32 nToken;\n" ); -print( GPERFFILE "};\n" ); -print( GPERFFILE "%%\n" ); - -$i = 0; -foreach( sort( keys( %tokens ) ) ) -{ - print( IDFILE "const sal_Int32 $tokens{$_} = $i;\n" ); - print( NAMEFILE "\"$_\",\n" ); - print( GPERFFILE "$_,$tokens{$_}\n" ); - ++$i; +if( $op == 1 ) { + print( "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); +} elsif( $op == 3 ) { + print( "%%\n" ); } - -print( IDFILE "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); -print( GPERFFILE "%%\n" ); - -close( IDFILE ); -close( NAMEFILE ); -close( GPERFFILE ); diff --git a/oox/source/vml/makefile.mk b/oox/source/vml/makefile.mk deleted file mode 100644 index 094d37cd8c1c..000000000000 --- a/oox/source/vml/makefile.mk +++ /dev/null @@ -1,56 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=vml -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/vmldrawing.obj \ - $(SLO)$/vmldrawingfragment.obj \ - $(SLO)$/vmlformatting.obj \ - $(SLO)$/vmlinputstream.obj \ - $(SLO)$/vmlshape.obj \ - $(SLO)$/vmlshapecontainer.obj \ - $(SLO)$/vmlshapecontext.obj \ - $(SLO)$/vmltextbox.obj \ - $(SLO)$/vmltextboxcontext.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk deleted file mode 100644 index e337afe786a8..000000000000 --- a/oox/source/xls/makefile.mk +++ /dev/null @@ -1,105 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=oox -TARGET=xls -AUTOSEG=true - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE: $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/addressconverter.obj \ - $(SLO)$/autofilterbuffer.obj \ - $(SLO)$/autofiltercontext.obj \ - $(SLO)$/biffcodec.obj \ - $(SLO)$/biffdetector.obj \ - $(SLO)$/biffhelper.obj \ - $(SLO)$/biffinputstream.obj \ - $(SLO)$/biffoutputstream.obj \ - $(SLO)$/chartsheetfragment.obj \ - $(SLO)$/commentsbuffer.obj \ - $(SLO)$/commentsfragment.obj \ - $(SLO)$/condformatbuffer.obj \ - $(SLO)$/condformatcontext.obj \ - $(SLO)$/connectionsbuffer.obj \ - $(SLO)$/connectionsfragment.obj \ - $(SLO)$/defnamesbuffer.obj \ - $(SLO)$/drawingbase.obj \ - $(SLO)$/drawingfragment.obj \ - $(SLO)$/drawingmanager.obj \ - $(SLO)$/excelchartconverter.obj \ - $(SLO)$/excelfilter.obj \ - $(SLO)$/excelhandlers.obj \ - $(SLO)$/excelvbaproject.obj \ - $(SLO)$/externallinkbuffer.obj \ - $(SLO)$/externallinkfragment.obj \ - $(SLO)$/formulabase.obj \ - $(SLO)$/formulaparser.obj \ - $(SLO)$/numberformatsbuffer.obj \ - $(SLO)$/ooxformulaparser.obj \ - $(SLO)$/pagesettings.obj \ - $(SLO)$/pivotcachebuffer.obj \ - $(SLO)$/pivotcachefragment.obj \ - $(SLO)$/pivottablebuffer.obj \ - $(SLO)$/pivottablefragment.obj \ - $(SLO)$/querytablebuffer.obj \ - $(SLO)$/querytablefragment.obj \ - $(SLO)$/richstring.obj \ - $(SLO)$/richstringcontext.obj \ - $(SLO)$/scenariobuffer.obj \ - $(SLO)$/scenariocontext.obj \ - $(SLO)$/sharedformulabuffer.obj \ - $(SLO)$/sharedstringsbuffer.obj \ - $(SLO)$/sharedstringsfragment.obj \ - $(SLO)$/sheetdatacontext.obj \ - $(SLO)$/stylesbuffer.obj \ - $(SLO)$/stylesfragment.obj \ - $(SLO)$/tablebuffer.obj \ - $(SLO)$/tablefragment.obj \ - $(SLO)$/themebuffer.obj \ - $(SLO)$/unitconverter.obj \ - $(SLO)$/viewsettings.obj \ - $(SLO)$/workbookfragment.obj \ - $(SLO)$/workbookhelper.obj \ - $(SLO)$/workbooksettings.obj \ - $(SLO)$/worksheetbuffer.obj \ - $(SLO)$/worksheetfragment.obj \ - $(SLO)$/worksheethelper.obj \ - $(SLO)$/worksheetsettings.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk deleted file mode 100644 index 329ced792164..000000000000 --- a/oox/util/makefile.mk +++ /dev/null @@ -1,104 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=oox -TARGET=oox -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.IF "$(L10N_framework)"=="" -# --- Allgemein ---------------------------------------------------- - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1FILES= \ - $(SLB)$/token.lib\ - $(SLB)$/helper.lib\ - $(SLB)$/core.lib\ - $(SLB)$/ole.lib\ - $(SLB)$/ppt.lib\ - $(SLB)$/xls.lib\ - $(SLB)$/vml.lib\ - $(SLB)$/drawingml.lib\ - $(SLB)$/diagram.lib\ - $(SLB)$/chart.lib\ - $(SLB)$/table.lib\ - $(SLB)$/shape.lib\ - $(SLB)$/dump.lib\ - $(SLB)$/docprop.lib - -# --- Shared-Library ----------------------------------------------- - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1IMPLIB= i$(TARGET) -SHL1USE_EXPORTS=name - -SHL1STDLIBS= \ - $(CPPULIB) \ - $(CPPUHELPERLIB)\ - $(COMPHELPERLIB)\ - $(RTLLIB) \ - $(SALLIB) \ - $(BASEGFXLIB) \ - $(SAXLIB) \ - $(XMLSCRIPTLIB) - -# link openssl, copied this bit from ucb/source/ucp/webdav/makefile.mk -.IF "$(GUI)"=="WNT" -SHL1STDLIBS+= $(OPENSSLLIB) -.ELSE # WNT -.IF "$(OS)"=="SOLARIS" -SHL1STDLIBS+= -lnsl -lsocket -ldl -.ENDIF # SOLARIS -.IF "$(SYSTEM_OPENSSL)"=="YES" -SHL1STDLIBS+= $(OPENSSLLIB) -.ELSE -SHL1STDLIBS+= $(OPENSSLLIBST) -.ENDIF -.ENDIF # WNT - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1LIBS= $(LIB1TARGET) -DEF1NAME =$(SHL1TARGET) -DEFLIB1NAME =$(TARGET) - -# --- Targets ---------------------------------------------------------- -.ENDIF # L10N_framework - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/oox.component - -$(MISC)/oox.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - oox.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oox.component diff --git a/oox/util/makefile.pmk b/oox/util/makefile.pmk deleted file mode 100644 index adb0222c2ba2..000000000000 --- a/oox/util/makefile.pmk +++ /dev/null @@ -1,30 +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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -# Reduction of exported symbols: -CDEFS += -DOOX_DLLIMPLEMENTATION -VISIBILITY_HIDDEN=TRUE diff --git a/oox/util/oox.component b/oox/util/oox.component deleted file mode 100644 index f6519d5a8664..000000000000 --- a/oox/util/oox.component +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/oox/workben/ooxml-export-notes.txt b/oox/workben/ooxml-export-notes.txt deleted file mode 100644 index 8da4582b72b1..000000000000 --- a/oox/workben/ooxml-export-notes.txt +++ /dev/null @@ -1,220 +0,0 @@ -How to install this -------------------- - -> cd instsetoo_native/util -> LOCALINSTALLDIR=/where/you/want dmake openoffice_en-US PKGFORMAT=installed - -OOXML generally ---------------- - -- http://www.ecma-international.org/publications/standards/Ecma-376.htm -- http://www.asahi-net.or.jp/~eb2m-mrt/ooxml/dependencies.html - -Related modules ---------------- - -- oox - - .xlsx and .pptx import - -- writerfilter - - import of .docx, uses also oox for the graphics etc. - - can also parse .doc; but used for ooxml only for now - -- filter - - the configuration stuff (so that the filters appear in the filepicker) - -Old binary filters (export) ---------------------------- - -- doc export - - sw/source/filter/ww8/wrtww8* - - wrtww8.cxx:2191 [SwWW8Writer::StoreDoc()] is the entry point - - - eg. - #0 SwWW8Writer::WriteText (this=0x2aaab3dfb7c0) at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1846 - #1 0x00002aaaae75a545 in SwWW8Writer::WriteMainText (this=0x2aaab3d6a870) - at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1925 - #2 0x00002aaaae75e357 in SwWW8Writer::StoreDoc1 (this=0x2aaab3d6a870) - at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2076 - #3 0x00002aaaae7605ec in SwWW8Writer::StoreDoc (this=0x2aaab3d6a870) - at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2383 - #4 0x00002aaaae760fd5 in SwWW8Writer::WriteStorage (this=0x2aaab3d6a870) - at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2547 - #5 0x00002aaaae70b793 in StgWriter::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStg=@0x2aaab3d621c0, - pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:653 - #6 0x00002aaaae70b84d in Writer::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStrm=@0x2aaaad979d20, - pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:358 - #7 0x00002aaaae70b993 in Writer::Write (this=0x2aaab3d6a870, rPam=@0x2b3802a2b640, rMed=@0x2aaaad999f30, - pFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:385 - #8 0x00002aaaae6375d7 in SwWriter::Write (this=0x7fffb1b28410, rxWriter=@0x7fffb1b285d0, - pRealFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/basflt/shellio.cxx:963 - #9 0x00002aaaae87cc1e in SwDocShell::ConvertTo (this=0xcc27f0, rMedium=@0x2aaaad999f30) - at /local/ooxml/ooxml/sw/source/ui/app/docsh.cxx:924 - #10 0x00002b37faae6b58 in SfxObjectShell::DoLoad () - from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so - -- xls export - - sc/source/filter/excel/xe* - - - eg. - #0 XclExpRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0) - at /local/ooxml/ooxml/sc/source/filter/excel/xerecord.cxx:88 - #1 0x00002aaaae562c4a in ExcRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0) - at /local/ooxml/ooxml/sc/source/filter/excel/excrecds.cxx:168 - #2 0x00002aaaae54b0fa in XclExpRecordList::Save (this=0x11c5d18, rStrm=@0x7fff5e6335d0) - at ../inc/xerecord.hxx:281 - #3 0x00002aaaae547541 in ExcTable::Write (this=0x11c5cf8, rStr=@0x7fff5e6335d0) - at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:455 - #4 0x00002aaaae5475fb in ExcDocument::Write (this=0x11c5ce0, rSvStrm=@0x2aaab3dcd070) - at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:525 - #5 0x00002aaaae568add in ExportBiff5::Write (this=0x7fff5e6339c0) - at /local/ooxml/ooxml/sc/source/filter/excel/expop2.cxx:119 - #6 0x00002aaaae54f4af in ScExportExcel5 (rMedium=@0x2aaab3d87410, pDocument=0xce6a00, bBiff8=1 '\001', eNach=1) - at /local/ooxml/ooxml/sc/source/filter/excel/excel.cxx:252 - #7 0x00002aaaadf1b70a in ScDocShell::ConvertTo (this=0xce6990, rMed=@0x2aaab3d87410) - at /local/ooxml/ooxml/sc/source/ui/docshell/docsh.cxx:2080 - #8 0x00002b354dfd8b58 in SfxObjectShell::DoLoad () - from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so - - - Current approach is to add a XclExpRecordBase::SaveXml() method, which - would be used to write the XML content (while Save() would continue - writing the BIFF format). - - Q: How do we get to the Save()/SaveXml() methods (e.g. the SST export code) - #0 XclExpSstImpl::Save (this=0x1b170b0, rStrm=@0x7fffd4d5c4a0) - at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:224 - #1 0x00007f68b7e46ff7 in XclExpSst::Save (this=0x1abc300, - rStrm=@0x7fffd4d5c4a0) - at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:351 - #2 0x00007f68b7de5090 in XclExpRecordList::Save ( - this=0x1b2d168, rStrm=@0x7fffd4d5c4a0) at ../inc/xerecord.hxx:282 - // as above, starting at frame 2 - - - Thus, to get to the SaveXml() method, we need to add a slew of WriteXml() - methods that will (eventually) invoke the SaveXml() methods. - - - ZipStorage for XML handling and StorageRef (XStorage interface) - - To construct ZipStorage, need XMultiServiceFactory (!), and - XInputStream. - - Have an SvStream; need to wrap SvStream with XInputStream - - OInputStreamWrapper in - - Where do I get XMultiServiceFactory? - - Lots of places -- just grep - - perhaps XmlFilterBase _does_ make sense here. - - Do it anyway. - - Looking into having XclExpXmlStream inherit from ZipFilterBase - - problem: exception during construction, because ZipStorage hates me: - #0 OStorageFactory::createInstanceWithArguments (this=0x10612a0, - aArguments=@0x7fffe2ef76d0) - at /home/jon/Development/OpenOffice.org/ooxml/package/source/xstor/xfactory.cxx:275 - #1 0x00007f12d93f0d5c in comphelper::OStorageHelper::GetStorageOfFormatFromStream (aFormat=@0x7fffe2ef7780, xStream=@0x1a502d8, nStorageMode=15, - xFactory=@0x1a502c0) - at /home/jon/Development/OpenOffice.org/ooxml/comphelper/source/misc/storagehelper.cxx:342 - #2 0x00007f12c33d1a6d in ZipStorage (this=0x1a92550, rxFactory=@0x1a502c0, - rxStream=@0x1a502d8) - at /home/jon/Development/OpenOffice.org/ooxml/oox/source/helper/zipstorage.cxx:87 - #3 0x00007f12c33f089e in oox::core::XmlFilterBase::implCreateStorage ( - this=0x7fffe2ef7930, rxInStream=@0x1a502d0, rxStream=@0x1a502d8) - at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/xmlfilterbase.cxx:298 - #4 0x00007f12c33dd204 in oox::core::FilterBase::filter (this=0x7fffe2ef7930, - rDescriptor=@0x7fffe2ef78d0) - at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/filterbase.cxx:284 - #5 0x00007f12c68097a2 in XclExpXmlStream (this=0x7fffe2ef7930, - rSMgr=@0x7fffe2ef79a0, rStrm=@0x18d6f90) - at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xestream.cxx:659 - #6 0x00007f12c674c8c1 in ExcDocument::WriteXml (this=0x15911f0, - rStrm=@0x18d6f90) - at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/excdoc.cxx:575 - ... - - Actual problem: xfactory.cxx:274, the CheckPackageSignature_Impl() call. - - fails because the empty file has content (!), thus fails the "package - signature check" (which tries to ensure the file format is correct). - - Underlying file is an SvFileStream, created in - SfxMedium::GetOutStream(). - - So why's CheckPackageSignature_Impl() fail? Because - lcl_ExportExcel2007Xml() had the code: - - SotStorageRef xRootStrg = new SotStorage( pMedStrm, FALSE ); - - That is, it was creating an OLE Structured Storage document over the - SvStream, and then (later) used the *same* SvStream and passed it to - ZipStorage. This caused ZipStorage to complain because OLESS data was - already present in the file, with a different file signature than what - ZipPackage was expecting (go figure). - -- ppt export - - sd/source/filter/eppt/* - - svx/source/msfilter - - for eg. Escher export - - Escher: http://chicago.sourceforge.net/devel/docs/escher/index.html - - - eg. - #0 PPTWriter (this=0x15807d0, rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0, pVBA=0x0, - nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:268 - #1 0x00002aaab3895719 in ExportPPT (rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0, - pVBA=0x0, nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:2503 - #2 0x00002aaaadef85b7 in SdPage::onParagraphRemoving () - from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so - #3 0x00002aaaade202e3 in sd::DrawDocShell::ConvertTo () - from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so - #4 0x00002aec23119b58 in SfxObjectShell::DoLoad () - from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so - -- odp export - #0 ZipPackage (this=0x1805e80, xNewFactory=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:279 - #1 0x00002aaaadd3dc94 in ZipPackage_createInstance (xMgr=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:1546 - #2 0x00002b0fca7ab6b3 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #3 0x00002b0fca7a7fda in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #4 0x00002b0fca7a811e in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #5 0x00002b0fca7aa7cc in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #6 0x00002b0fca7aacbe in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #7 0x00002b0fca7aa035 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3 - #8 0x00002aaaaadae1b3 in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so - #9 0x00002aaaaadaa84c in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so - #10 0x00002aaab5c7a7e5 in OStorage_Impl::OpenOwnPackage (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:549 - #11 0x00002aaab5c7ab3e in OStorage_Impl::ReadContents (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:649 - #12 0x00002aaab5c7d32f in OStorage_Impl::FindElement (this=0x185cac0, rName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:1387 - #13 0x00002aaab5c7dc45 in OStorage::hasByName (this=0x1808880, aName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:4045 - #14 0x00002aaab1fde8c5 in XMLVersionListPersistence::load () from /opt/openoffice.org3.0/program/../basis-link/program/libxolx.so - #15 0x00002b0fcb058bb2 in SfxMedium::GetVersionList (this=0x1750050, _bNoReload=false) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:3247 - #16 0x00002b0fcb0571b5 in SfxMedium::GetStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1328 - #17 0x00002b0fcb05d0d7 in SfxMedium::GetOutputStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1068 - #18 0x00002b0fcb091227 in SfxObjectShell::SaveTo_Impl (this=0xf44d60, rMedium=@0x1750050, pSet=0x0) at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:1557 - #19 0x00002b0fcb09443c in SfxObjectShell::PreDoSaveAs_Impl (this=0xf44d60, rFileName=@0x7fffe2850700, aFilterName=@0x7fffe28507f0, pParams=0xf10c10) - at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2984 - #20 0x00002b0fcb094ea5 in SfxObjectShell::CommonSaveAs_Impl (this=0xf44d60, aURL=@0x7fffe2850870, aFilterName=@0x7fffe28507f0, aParams=0x1740310) - at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2855 - #21 0x00002b0fcb0a1da2 in SfxObjectShell::APISaveAs_Impl (this=0xf44d60, aFileName=@0x7fffe2850b70, aParams=0x1740310) - at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:432 - #22 0x00002b0fcb0e74c8 in SfxBaseModel::impl_store (this=0xf96a00, sURL=@0x7fffe28516b0, seqArguments=@0x7fffe2851ae0, bSaveTo=0 '\0') - at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:2591 - #23 0x00002b0fcb0f124b in SfxBaseModel::storeAsURL (this=0xf96a00, rURL=@0x7fffe28516b0, rArgs=@0x7fffe2851ae0) - at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:1568 - #24 0x00002b0fcb101d3d in SfxStoringHelper::GUIStoreModel (this=0x7fffe28519f0, xModel=@0xf18798, aSlotName=@0x7fffe2852200, aArgsSequence=@0x7fffe2851ae0, - bPreselectPassword=0 '\0') at /home/rodo/git/ooxml/sfx2/source/doc/guisaveas.cxx:1529 - #25 0x00002b0fcb0a4051 in SfxObjectShell::ExecFile_Impl (this=0xf44d60, rReq=@0x1484f20) at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:744 - #26 0x00002b0fcb0a5c73 in SfxStubSfxObjectShellExecFile_Impl (pShell=0xf44d60, rReq=@0x1484f20) at ../../unxlngx6.pro/inc/sfxslots.hxx:161 - #27 0x00002b0fcb17f398 in SfxShell::CallExec (this=0xf44d60, pFunc=0x2b0fcb0a5c56 , rReq=@0x1484f20) - at ../../inc/sfx2/shell.hxx:226 - #28 0x00002b0fcb17cec3 in SfxDispatcher::Call_Impl (this=0x110fde0, rShell=@0xf44d60, rSlot=@0x2b0fcb576368, rReq=@0x1484f20, bRecord=1 '\001') - at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:338 - #29 0x00002b0fcb17d3f2 in SfxDispatcher::PostMsgHandler (this=0x110fde0, pReq=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1643 - #30 0x00002b0fcb17d51d in SfxDispatcher::LinkStubPostMsgHandler (pThis=0x110fde0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1610 - #31 0x00002b0fcafb3e70 in Link::Call (this=0x11488f8, pCaller=0x1484f20) at /home/rodo/git/ooxml/solver/300/unxlngx6.pro/inc/tools/link.hxx:158 - #32 0x00002b0fcb1a9952 in GenLink::Call (this=0x11488f8, pCaller=0x1484f20) at ../../inc/sfx2/genlink.hxx:63 - #33 0x00002b0fcb1a9773 in SfxHintPoster::Event (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:98 - #34 0x00002b0fcb1a9984 in SfxHintPoster::DoEvent_Impl (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:88 - #35 0x00002b0fcb1a974f in SfxHintPoster::LinkStubDoEvent_Impl (pThis=0x11488e0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:92 - #36 0x00002b0fccef69f8 in ImplWindowFrameProc () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so - #37 0x00002b0fd3f91f8f in SalDisplay::DispatchInternalEvent () from /opt/openoffice.org/basis3.0/program/libvclplug_genlx.so - #38 0x00002b0fd0fa4a84 in GtkXLib::userEventFn () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so - #39 0x00002b0fd3cb0204 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 - #40 0x00002b0fd3cb34fd in ?? () from /usr/lib64/libglib-2.0.so.0 - #41 0x00002b0fd3cb39ce in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 - #42 0x00002b0fd0fa4fd9 in GtkXLib::Yield () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so - #43 0x00002b0fccd1859e in Application::Yield () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so - #44 0x00002b0fccd18677 in Application::Execute () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so - #45 0x00002b0fc86fd803 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so - #46 0x00002b0fccd1da24 in ImplSVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so - #47 0x00002b0fccd1db15 in SVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so - #48 0x00002b0fc872fe6c in soffice_main () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so - #49 0x000000000040114b in main () diff --git a/writerfilter/source/ooxml/makefile.mk b/writerfilter/source/ooxml/makefile.mk index c6a40b4cc5d1..df0e26d1f467 100644 --- a/writerfilter/source/ooxml/makefile.mk +++ b/writerfilter/source/ooxml/makefile.mk @@ -174,8 +174,8 @@ GENERATEDFILES= \ $(TOKENXMLTMP) \ $(TOKENXML) -$(TOKENXMLTMP): $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token.txt - @$(TYPE) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token.txt | $(SED) "s#\(.*\)#\1#" > $@ +$(TOKENXMLTMP): $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token$/tokens.txt + @$(TYPE) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token$/tokens.txt | $(SED) "s#\(.*\)#\1#" > $@ $(TOKENXML): tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter @$(TYPE) tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter > $@ diff --git a/writerfilter/source/resourcemodel/makefile.mk b/writerfilter/source/resourcemodel/makefile.mk index bb5bc05ac1bd..384cf8cfe38e 100644 --- a/writerfilter/source/resourcemodel/makefile.mk +++ b/writerfilter/source/resourcemodel/makefile.mk @@ -130,7 +130,7 @@ SPRMIDSHXX=$(DOCTOKHXXOUTDIR)$/sprmids.hxx OOXMLRESOURCEIDSHXX=$(OOXMLHXXOUTDIR)$/resourceids.hxx NSXSL=$(MISC)$/namespacesmap.xsl -NAMESPACESTXT=$(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/namespaces.txt +NAMESPACESTXT=$(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token$/namespaces.txt GENERATEDHEADERS=$(DOCTOKRESOURCEIDSHXX) $(OOXMLRESOURCEIDSHXX) $(SPRMIDSHXX) GENERATEDFILES= \ -- cgit From 71576ee55be925fa9064b8470445802023b6f3a6 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 18 Jan 2011 17:22:36 +0100 Subject: dr78: switch module oox to new gbuild system --- Module_ooo.mk | 1 + Repository.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/Module_ooo.mk b/Module_ooo.mk index bc8d42079993..5e4784d94483 100644 --- a/Module_ooo.mk +++ b/Module_ooo.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Module_Module,ooo)) $(eval $(call gb_Module_add_moduledirs,ooo,\ framework \ + oox \ sfx2 \ svl \ svtools \ diff --git a/Repository.mk b/Repository.mk index be80170315d2..498b45e1a57d 100644 --- a/Repository.mk +++ b/Repository.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \ lng \ msfilter \ msword \ + oox \ qstart_gtk \ sax \ sb \ -- cgit From ae88ed70d0742110277b5f64ce616fa4e5256926 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 19 Jan 2011 10:56:53 +0100 Subject: dr78: minor changes in gperf usage --- oox/Library_oox.mk | 2 +- oox/source/token/tokenmap.cxx | 18 ++++++++++-------- oox/source/token/tokens.pl | 13 +++++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 2989e18ee523..5a8184006419 100755 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -380,7 +380,7 @@ $(SRCDIR_TOKEN)/tokenmap.cxx : $(WORKDIR_TOKEN)/tokenhash.inc $(WORKDIR_TOKEN)/tokenhash.inc : $(WORKDIR_TOKEN)/tokenhash.gperf $(call gb_Output_announce,$@,$(true),GPF,3) $(call gb_Helper_abbreviate_dirs, \ - gperf --compare-strncmp $< | $(gb_AWK) -- '{ if ($$0 !~ /^#line/){ gsub("\\(char\\*\\)0", "(char*)0, 0", $$0); print; } }' > $@ \ + gperf $< | $(gb_AWK) -- '{ if ($$0 !~ /^#line/){ gsub("\\(char\\*\\)0", "0", $$0); print; } }' > $@ \ ) $(WORKDIR_TOKEN)/tokenhash.gperf : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 8f097b10c7fb..0be0a1c4c470 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -43,8 +43,10 @@ using ::rtl::OUString; // ============================================================================ namespace { -// include auto-generated Perfect_Hash + +// include auto-generated Perfect_Hash class #include + } // namespace // ============================================================================ @@ -68,14 +70,14 @@ TokenMap::TokenMap() : } #if OSL_DEBUG_LEVEL > 0 - // check that the perfect_hash is in sync with the token name list + // check that the Perfect_Hash is in sync with the token name list bool bOk = true; for( sal_Int32 nToken = 0; bOk && (nToken < XML_TOKEN_COUNT); ++nToken ) { // check that the getIdentifier <-> getToken roundtrip works OString aUtf8Name = OUStringToOString( maTokenNames[ nToken ].maUniName, RTL_TEXTENCODING_UTF8 ); - struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() ); - bOk = pToken && (pToken->nToken == nToken); + const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); + bOk = pTokenInfo && (pTokenInfo->mnToken == nToken); OSL_ENSURE( bOk, ::rtl::OStringBuffer( "TokenMap::TokenMap - token list broken, #" ). append( nToken ).append( ", '" ).append( aUtf8Name ).append( '\'' ).getStr() ); } @@ -96,8 +98,8 @@ OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const { OString aUtf8Name = OUStringToOString( rUnicodeName, RTL_TEXTENCODING_UTF8 ); - struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() ); - return pToken ? pToken->nToken : XML_TOKEN_INVALID; + const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); + return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; } Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const @@ -109,9 +111,9 @@ Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) const { - struct xmltoken* pToken = Perfect_Hash::in_word_set( + const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( reinterpret_cast< const char* >( rUtf8Name.getConstArray() ), rUtf8Name.getLength() ); - return pToken ? pToken->nToken : XML_TOKEN_INVALID; + return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; } // ============================================================================ diff --git a/oox/source/token/tokens.pl b/oox/source/token/tokens.pl index 4307a7d9047a..ba7f39f2be39 100644 --- a/oox/source/token/tokens.pl +++ b/oox/source/token/tokens.pl @@ -31,12 +31,17 @@ die "Error: invalid operation" unless( $op >= 1 && $op <= 3); if( $op == 3 ) { print( "%language=C++\n" ); - print( "%global-table\n" ); + print( "%define slot-name mpcName\n" ); + print( "%define initializer-suffix ,0\n" ); + print( "%define lookup-function-name getTokenInfo\n" ); + print( "%compare-strncmp\n" ); + print( "%readonly-tables\n" ); + print( "%enum\n" ); print( "%null-strings\n" ); print( "%struct-type\n" ); - print( "struct xmltoken {\n" ); - print( " const sal_Char *name;\n" ); - print( " sal_Int32 nToken;\n" ); + print( "struct XMLTokenInfo {\n" ); + print( " const sal_Char* mpcName;\n" ); + print( " sal_Int32 mnToken;\n" ); print( "};\n" ); print( "%%\n" ); } -- cgit From 7a6d6046982d98b1deab2f0ec8209fc7bd862b45 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 20 Jan 2011 14:11:33 +0100 Subject: dba34c: fix missed --- dbaccess/source/core/api/RowSetCache.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 789fbadb794b..2d4355edcaef 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -741,6 +741,8 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if(!aIter->isValid()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,i); + if(!m_bRowCountFinal) + ++m_nRowCount; } else { // there are no more rows found so we can fetch some before start -- cgit From f32d2f33c2bdfbfb252fb8ff4722921a2ec2a603 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 21 Jan 2011 13:37:54 +0100 Subject: dr78: #i43040# correction for BesselI, patch from Regina --- scaddins/source/analysis/bessel.cxx | 63 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx index f853b49eb443..6d842ff53d56 100644 --- a/scaddins/source/analysis/bessel.cxx +++ b/scaddins/source/analysis/bessel.cxx @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -181,31 +181,36 @@ double BesselJ( double x, sal_Int32 N ) throw (IllegalArgumentException, NoConve I_n(x) = SUM TERM(n,k) with TERM(n,k) := -------------- k=0 k! (n+k)! - Approximation for the BESSEL function, first kind, modified, for great x: - - I_n(x) ~ e^x / sqrt( 2 PI x ) for x>=0. + No asymptotic approximation used, see issue 43040. */ // ---------------------------------------------------------------------------- double BesselI( double x, sal_Int32 n ) throw( IllegalArgumentException, NoConvergenceException ) { + const double fEpsilon = 1.0E-15; + const sal_Int32 nMaxIteration = 2000; + const double fXHalf = x / 2.0; if( n < 0 ) throw IllegalArgumentException(); double fResult = 0.0; - if( fabs( x ) <= THRESHOLD ) - { - /* Start the iteration without TERM(n,0), which is set here. - TERM(n,0) = (x/2)^n / n! - */ - double fTerm = pow( x / 2.0, (double)n ) / Fak( n ); - sal_Int32 nK = 1; // Start the iteration with k=1. - fResult = fTerm; // Start result with TERM(n,0). - - const double fSqrX = x * x / 4.0; + /* Start the iteration without TERM(n,0), which is set here. + TERM(n,0) = (x/2)^n / n! + */ + sal_Int32 nK = 0; + double fTerm = 1.0; + // avoid overflow in Fak(n) + for( nK = 1; nK <= n; ++nK ) + { + fTerm = fTerm / static_cast< double >( nK ) * fXHalf; + } + fResult = fTerm; // Start result with TERM(n,0). + if( fTerm != 0.0 ) + { + nK = 1; do { /* Calculation of TERM(n,k) from TERM(n,k-1): @@ -225,33 +230,13 @@ double BesselI( double x, sal_Int32 n ) throw( IllegalArgumentException, NoConve x^2/4 = -------- TERM(n,k-1) k(n+k) - */ - fTerm *= fSqrX; // defined above as x^2/4 - fTerm /= (nK * (nK + n)); - fResult += fTerm; + */ + fTerm = fTerm * fXHalf / static_cast(nK) * fXHalf / static_cast(nK+n); + fResult += fTerm; + nK++; } - while( (fabs( fTerm ) > MAXEPSILON) && (++nK < MAXITER) ); - } - else - { - /* Approximation for the BESSEL function, first kind, modified: - - I_n(x) ~ e^x / sqrt( 2 PI x ) for x>=0. - - The BESSEL function I_n with n IN {0,2,4,...} is axially symmetric at - x=0, means I_n(x) = I_n(-x). Therefore the approximation for x<0 is: - - I_n(x) = I_n(|x|) for x<0 and n IN {0,2,4,...}. - - The BESSEL function I_n with n IN {1,3,5,...} is point-symmetric at - x=0, means I_n(x) = -I_n(-x). Therefore the approximation for x<0 is: + while( (fabs( fTerm ) > fabs(fResult) * fEpsilon) && (nK < nMaxIteration) ); - I_n(x) = -I_n(|x|) for x<0 and n IN {1,3,5,...}. - */ - double fXAbs = fabs( x ); - fResult = exp( fXAbs ) / sqrt( f_2_PI * fXAbs ); - if( (n & 1) && (x < 0.0) ) - fResult = -fResult; } return fResult; } -- cgit From 5ee30027064080597d1543c2982b8b25e8764698 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 21 Jan 2011 13:45:05 +0100 Subject: dr78: #i43040# removed german umlauts and utf8 bom accidentially added by too smart editor --- scaddins/source/analysis/bessel.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx index 6d842ff53d56..528a6f8f73ad 100644 --- a/scaddins/source/analysis/bessel.cxx +++ b/scaddins/source/analysis/bessel.cxx @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -56,10 +56,10 @@ const sal_Int32 MAXITER = 100; // Maximum number of iterations. The algorithm follows http://www.reference-global.com/isbn/978-3-11-020354-7 Numerical Mathematics 1 / Numerische Mathematik 1, - An algorithm-based introduction / Eine algorithmisch orientierte Einführung + An algorithm-based introduction / Eine algorithmisch orientierte Einfuehrung Deuflhard, Peter; Hohmann, Andreas Berlin, New York (Walter de Gruyter) 2008 - 4. überarb. u. erw. Aufl. 2008 + 4. ueberarb. u. erw. Aufl. 2008 eBook ISBN: 978-3-11-020355-4 Chapter 6.3.2 , algorithm 6.24 The source is in German. @@ -331,10 +331,10 @@ double BesselK( double fNum, sal_Int32 nOrder ) throw( IllegalArgumentException, The algorithm for order 0 and for order 1 follows http://www.reference-global.com/isbn/978-3-11-020354-7 Numerical Mathematics 1 / Numerische Mathematik 1, - An algorithm-based introduction / Eine algorithmisch orientierte Einführung + An algorithm-based introduction / Eine algorithmisch orientierte Einfuehrung Deuflhard, Peter; Hohmann, Andreas Berlin, New York (Walter de Gruyter) 2008 - 4. überarb. u. erw. Aufl. 2008 + 4. ueberarb. u. erw. Aufl. 2008 eBook ISBN: 978-3-11-020355-4 Chapter 6.3.2 , algorithm 6.24 The source is in German. -- cgit From 09f7fc99c442d71852396d97ee1079f0d03901a0 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 27 Jan 2011 13:20:10 +0100 Subject: dr78: revert migration of oox to gbuild (will be done in a dedicated CWS) --- oox/Library_oox.mk | 421 ------------------------------- oox/Makefile | 38 --- oox/Module_oox.mk | 37 --- oox/Package_inc.mk | 45 ---- oox/Package_source.mk | 29 --- oox/Package_workdir.mk | 32 --- oox/oox.component | 67 ----- oox/prj/build.lst | 19 +- oox/prj/d.lst | 46 ++++ oox/prj/makefile.mk | 40 --- oox/source/core/makefile.mk | 66 +++++ oox/source/docprop/makefile.mk | 49 ++++ oox/source/drawingml/chart/makefile.mk | 74 ++++++ oox/source/drawingml/diagram/makefile.mk | 53 ++++ oox/source/drawingml/makefile.mk | 92 +++++++ oox/source/drawingml/table/makefile.mk | 62 +++++ oox/source/dump/makefile.mk | 53 ++++ oox/source/helper/makefile.mk | 60 +++++ oox/source/ole/makefile.mk | 60 +++++ oox/source/ppt/makefile.mk | 76 ++++++ oox/source/shape/makefile.mk | 49 ++++ oox/source/token/makefile.mk | 78 ++++++ oox/source/token/namespacemap.cxx | 2 +- oox/source/token/namespaces.hxx.tail | 36 +-- oox/source/token/namespaces.pl | 58 +++-- oox/source/token/properties.pl | 52 ++-- oox/source/token/propertynames.cxx | 3 +- oox/source/token/tokenmap.cxx | 22 +- oox/source/token/tokens.pl | 85 ++++--- oox/source/vml/makefile.mk | 56 ++++ oox/source/xls/makefile.mk | 105 ++++++++ oox/util/makefile.mk | 104 ++++++++ oox/util/makefile.pmk | 30 +++ oox/util/oox.component | 67 +++++ 34 files changed, 1341 insertions(+), 825 deletions(-) delete mode 100755 oox/Library_oox.mk delete mode 100755 oox/Makefile delete mode 100755 oox/Module_oox.mk delete mode 100755 oox/Package_inc.mk delete mode 100755 oox/Package_source.mk delete mode 100755 oox/Package_workdir.mk delete mode 100644 oox/oox.component delete mode 100755 oox/prj/makefile.mk create mode 100755 oox/source/core/makefile.mk create mode 100755 oox/source/docprop/makefile.mk create mode 100755 oox/source/drawingml/chart/makefile.mk create mode 100755 oox/source/drawingml/diagram/makefile.mk create mode 100755 oox/source/drawingml/makefile.mk create mode 100755 oox/source/drawingml/table/makefile.mk create mode 100755 oox/source/dump/makefile.mk create mode 100755 oox/source/helper/makefile.mk create mode 100755 oox/source/ole/makefile.mk create mode 100755 oox/source/ppt/makefile.mk create mode 100755 oox/source/shape/makefile.mk create mode 100755 oox/source/token/makefile.mk create mode 100755 oox/source/vml/makefile.mk create mode 100755 oox/source/xls/makefile.mk create mode 100755 oox/util/makefile.mk create mode 100755 oox/util/makefile.pmk create mode 100644 oox/util/oox.component diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk deleted file mode 100755 index 5a8184006419..000000000000 --- a/oox/Library_oox.mk +++ /dev/null @@ -1,421 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Library_Library,oox)) - -$(eval $(call gb_Library_add_package_headers,oox,oox_inc)) -$(eval $(call gb_Library_add_package_headers,oox,oox_source)) -$(eval $(call gb_Library_add_package_headers,oox,oox_workdir)) - -$(eval $(call gb_Library_set_componentfile,oox,oox/oox)) - -$(eval $(call gb_Library_set_include,oox,\ - -I$(SRCDIR)/oox/inc \ - -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ - -I$(WORKDIR)/Misc/oox \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Library_set_defs,oox,\ - $$(DEFS) \ - -DOOX_DLLIMPLEMENTATION \ -)) - -$(eval $(call gb_Library_add_linked_libs,oox,\ - basegfx \ - comphelper \ - cppu \ - cppuhelper \ - sal \ - sax \ - stl \ - xcr \ - ssl \ - crypto \ -)) - -ifeq ($(OS),SOLARIS) -$(eval $(call gb_Library_add_linked_libs,oox,\ - nsl \ - socket \ - dl \ -)) -endif - -ifeq ($(OS),WNT) -$(eval $(call gb_Library_add_linked_libs,oox,\ - kernel32 \ - msvcrt \ - uwinapi \ -)) -endif - -# object files ---------------------------------------------------------------- - -$(eval $(call gb_Library_add_exception_objects,oox,\ - oox/source/core/binarycodec \ - oox/source/core/binaryfilterbase \ - oox/source/core/contexthandler \ - oox/source/core/contexthandler2 \ - oox/source/core/fastparser \ - oox/source/core/fasttokenhandler \ - oox/source/core/filterbase \ - oox/source/core/filterdetect \ - oox/source/core/fragmenthandler \ - oox/source/core/fragmenthandler2 \ - oox/source/core/recordparser \ - oox/source/core/relations \ - oox/source/core/relationshandler \ - oox/source/core/services \ - oox/source/core/xmlfilterbase \ - oox/source/docprop/docprophandler \ - oox/source/docprop/ooxmldocpropimport \ - oox/source/drawingml/clrscheme \ - oox/source/drawingml/clrschemecontext \ - oox/source/drawingml/color \ - oox/source/drawingml/colorchoicecontext \ - oox/source/drawingml/connectorshapecontext \ - oox/source/drawingml/customshapegeometry \ - oox/source/drawingml/customshapeproperties \ - oox/source/drawingml/drawingmltypes \ - oox/source/drawingml/embeddedwavaudiofile \ - oox/source/drawingml/fillproperties \ - oox/source/drawingml/fillpropertiesgroupcontext \ - oox/source/drawingml/graphicshapecontext \ - oox/source/drawingml/guidcontext \ - oox/source/drawingml/hyperlinkcontext \ - oox/source/drawingml/lineproperties \ - oox/source/drawingml/linepropertiescontext \ - oox/source/drawingml/objectdefaultcontext \ - oox/source/drawingml/shape \ - oox/source/drawingml/shapecontext \ - oox/source/drawingml/shapegroupcontext \ - oox/source/drawingml/shapepropertiescontext \ - oox/source/drawingml/shapepropertymap \ - oox/source/drawingml/shapestylecontext \ - oox/source/drawingml/spdefcontext \ - oox/source/drawingml/textbody \ - oox/source/drawingml/textbodycontext \ - oox/source/drawingml/textbodyproperties \ - oox/source/drawingml/textbodypropertiescontext \ - oox/source/drawingml/textcharacterproperties \ - oox/source/drawingml/textcharacterpropertiescontext \ - oox/source/drawingml/textfield \ - oox/source/drawingml/textfieldcontext \ - oox/source/drawingml/textfont \ - oox/source/drawingml/textliststyle \ - oox/source/drawingml/textliststylecontext \ - oox/source/drawingml/textparagraph \ - oox/source/drawingml/textparagraphproperties \ - oox/source/drawingml/textparagraphpropertiescontext \ - oox/source/drawingml/textrun \ - oox/source/drawingml/textspacingcontext \ - oox/source/drawingml/texttabstoplistcontext \ - oox/source/drawingml/theme \ - oox/source/drawingml/themeelementscontext \ - oox/source/drawingml/themefragmenthandler \ - oox/source/drawingml/transform2dcontext \ - oox/source/drawingml/chart/axiscontext \ - oox/source/drawingml/chart/axisconverter \ - oox/source/drawingml/chart/axismodel \ - oox/source/drawingml/chart/chartcontextbase \ - oox/source/drawingml/chart/chartconverter \ - oox/source/drawingml/chart/chartdrawingfragment \ - oox/source/drawingml/chart/chartspaceconverter \ - oox/source/drawingml/chart/chartspacefragment \ - oox/source/drawingml/chart/chartspacemodel \ - oox/source/drawingml/chart/converterbase \ - oox/source/drawingml/chart/datasourcecontext \ - oox/source/drawingml/chart/datasourceconverter \ - oox/source/drawingml/chart/datasourcemodel \ - oox/source/drawingml/chart/modelbase \ - oox/source/drawingml/chart/objectformatter \ - oox/source/drawingml/chart/plotareacontext \ - oox/source/drawingml/chart/plotareaconverter \ - oox/source/drawingml/chart/plotareamodel \ - oox/source/drawingml/chart/seriescontext \ - oox/source/drawingml/chart/seriesconverter \ - oox/source/drawingml/chart/seriesmodel \ - oox/source/drawingml/chart/titlecontext \ - oox/source/drawingml/chart/titleconverter \ - oox/source/drawingml/chart/titlemodel \ - oox/source/drawingml/chart/typegroupcontext \ - oox/source/drawingml/chart/typegroupconverter \ - oox/source/drawingml/chart/typegroupmodel \ - oox/source/drawingml/diagram/datamodelcontext \ - oox/source/drawingml/diagram/diagram \ - oox/source/drawingml/diagram/diagramdefinitioncontext \ - oox/source/drawingml/diagram/diagramfragmenthandler \ - oox/source/drawingml/diagram/diagramlayoutatoms \ - oox/source/drawingml/diagram/layoutnodecontext \ - oox/source/drawingml/table/tablebackgroundstylecontext \ - oox/source/drawingml/table/tablecell \ - oox/source/drawingml/table/tablecellcontext \ - oox/source/drawingml/table/tablecontext \ - oox/source/drawingml/table/tablepartstylecontext \ - oox/source/drawingml/table/tableproperties \ - oox/source/drawingml/table/tablerow \ - oox/source/drawingml/table/tablerowcontext \ - oox/source/drawingml/table/tablestyle \ - oox/source/drawingml/table/tablestylecellstylecontext \ - oox/source/drawingml/table/tablestylecontext \ - oox/source/drawingml/table/tablestylelist \ - oox/source/drawingml/table/tablestylelistfragmenthandler \ - oox/source/drawingml/table/tablestylepart \ - oox/source/drawingml/table/tablestyletextstylecontext \ - oox/source/dump/biffdumper \ - oox/source/dump/dffdumper \ - oox/source/dump/dumperbase \ - oox/source/dump/oledumper \ - oox/source/dump/pptxdumper \ - oox/source/dump/xlsbdumper \ - oox/source/helper/attributelist \ - oox/source/helper/binaryinputstream \ - oox/source/helper/binaryoutputstream \ - oox/source/helper/binarystreambase \ - oox/source/helper/containerhelper \ - oox/source/helper/graphichelper \ - oox/source/helper/modelobjecthelper \ - oox/source/helper/progressbar \ - oox/source/helper/propertymap \ - oox/source/helper/propertyset \ - oox/source/helper/storagebase \ - oox/source/helper/textinputstream \ - oox/source/helper/zipstorage \ - oox/source/ole/axbinaryreader \ - oox/source/ole/axcontrol \ - oox/source/ole/axcontrolfragment \ - oox/source/ole/olehelper \ - oox/source/ole/oleobjecthelper \ - oox/source/ole/olestorage \ - oox/source/ole/vbacontrol \ - oox/source/ole/vbahelper \ - oox/source/ole/vbainputstream \ - oox/source/ole/vbamodule \ - oox/source/ole/vbaproject \ - oox/source/ole/vbaprojectfilter \ - oox/source/ppt/animationspersist \ - oox/source/ppt/animationtypes \ - oox/source/ppt/animvariantcontext \ - oox/source/ppt/backgroundproperties \ - oox/source/ppt/buildlistcontext \ - oox/source/ppt/commonbehaviorcontext \ - oox/source/ppt/commontimenodecontext \ - oox/source/ppt/conditioncontext \ - oox/source/ppt/customshowlistcontext \ - oox/source/ppt/headerfootercontext \ - oox/source/ppt/layoutfragmenthandler \ - oox/source/ppt/pptfilterhelpers \ - oox/source/ppt/pptimport \ - oox/source/ppt/pptshape \ - oox/source/ppt/pptshapecontext \ - oox/source/ppt/pptshapegroupcontext \ - oox/source/ppt/pptshapepropertiescontext \ - oox/source/ppt/presentationfragmenthandler \ - oox/source/ppt/slidefragmenthandler \ - oox/source/ppt/slidemastertextstylescontext \ - oox/source/ppt/slidepersist \ - oox/source/ppt/slidetimingcontext \ - oox/source/ppt/slidetransition \ - oox/source/ppt/slidetransitioncontext \ - oox/source/ppt/soundactioncontext \ - oox/source/ppt/timeanimvaluecontext \ - oox/source/ppt/timenode \ - oox/source/ppt/timenodelistcontext \ - oox/source/ppt/timetargetelementcontext \ - oox/source/shape/ShapeContextHandler \ - oox/source/shape/ShapeFilterBase \ - oox/source/token/namespacemap \ - oox/source/token/propertynames \ - oox/source/token/tokenmap \ - oox/source/vml/vmldrawing \ - oox/source/vml/vmldrawingfragment \ - oox/source/vml/vmlformatting \ - oox/source/vml/vmlinputstream \ - oox/source/vml/vmlshape \ - oox/source/vml/vmlshapecontainer \ - oox/source/vml/vmlshapecontext \ - oox/source/vml/vmltextbox \ - oox/source/vml/vmltextboxcontext \ - oox/source/xls/addressconverter \ - oox/source/xls/autofilterbuffer \ - oox/source/xls/autofiltercontext \ - oox/source/xls/biffcodec \ - oox/source/xls/biffdetector \ - oox/source/xls/biffhelper \ - oox/source/xls/biffinputstream \ - oox/source/xls/biffoutputstream \ - oox/source/xls/chartsheetfragment \ - oox/source/xls/commentsbuffer \ - oox/source/xls/commentsfragment \ - oox/source/xls/condformatbuffer \ - oox/source/xls/condformatcontext \ - oox/source/xls/connectionsbuffer \ - oox/source/xls/connectionsfragment \ - oox/source/xls/defnamesbuffer \ - oox/source/xls/drawingbase \ - oox/source/xls/drawingfragment \ - oox/source/xls/drawingmanager \ - oox/source/xls/excelchartconverter \ - oox/source/xls/excelfilter \ - oox/source/xls/excelhandlers \ - oox/source/xls/excelvbaproject \ - oox/source/xls/externallinkbuffer \ - oox/source/xls/externallinkfragment \ - oox/source/xls/formulabase \ - oox/source/xls/formulaparser \ - oox/source/xls/numberformatsbuffer \ - oox/source/xls/ooxformulaparser \ - oox/source/xls/pagesettings \ - oox/source/xls/pivotcachebuffer \ - oox/source/xls/pivotcachefragment \ - oox/source/xls/pivottablebuffer \ - oox/source/xls/pivottablefragment \ - oox/source/xls/querytablebuffer \ - oox/source/xls/querytablefragment \ - oox/source/xls/richstring \ - oox/source/xls/richstringcontext \ - oox/source/xls/scenariobuffer \ - oox/source/xls/scenariocontext \ - oox/source/xls/sharedformulabuffer \ - oox/source/xls/sharedstringsbuffer \ - oox/source/xls/sharedstringsfragment \ - oox/source/xls/sheetdatacontext \ - oox/source/xls/stylesbuffer \ - oox/source/xls/stylesfragment \ - oox/source/xls/tablebuffer \ - oox/source/xls/tablefragment \ - oox/source/xls/themebuffer \ - oox/source/xls/unitconverter \ - oox/source/xls/viewsettings \ - oox/source/xls/workbookfragment \ - oox/source/xls/workbookhelper \ - oox/source/xls/workbooksettings \ - oox/source/xls/worksheetbuffer \ - oox/source/xls/worksheetfragment \ - oox/source/xls/worksheethelper \ - oox/source/xls/worksheetsettings \ -)) - -# generate source and header files from text files ---------------------------- - -SRCDIR_TOKEN = $(SRCDIR)/oox/source/token -WORKDIR_TOKEN = $(WORKDIR)/Misc/oox/token - -$(call gb_LinkTarget_get_headers_target,$(call gb_Library_get_linktargetname,$(call gb_Library_get_filename,oox))) : $(WORKDIR_TOKEN)/namespaces.hxx $(WORKDIR_TOKEN)/namespaces.txt $(WORKDIR_TOKEN)/tokens.hxx $(WORKDIR_TOKEN)/properties.hxx - -# XML namespace identifiers and names - -$(WORKDIR_TOKEN)/namespaces.hxx : $(SRCDIR_TOKEN)/namespaces.hxx.head $(WORKDIR_TOKEN)/namespaceids.inc $(SRCDIR_TOKEN)/namespaces.hxx.tail - $(call gb_Output_announce,$@,$(true),CAT,1) - $(call gb_Helper_abbreviate_dirs,cat $^ > $@) - -$(WORKDIR_TOKEN)/namespaceids.inc : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 1 < $< > $@ \ - ) - -$(SRCDIR_TOKEN)/namespacemap.cxx : $(WORKDIR_TOKEN)/namespacenames.inc - -$(WORKDIR_TOKEN)/namespacenames.inc : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 2 < $< > $@ \ - ) - -$(WORKDIR_TOKEN)/namespaces.txt : $(SRCDIR_TOKEN)/namespaces.txt $(SRCDIR_TOKEN)/namespaces.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/namespaces.pl 3 < $< > $@ \ - ) - -# XML token identifiers and names - -$(WORKDIR_TOKEN)/tokens.hxx : $(SRCDIR_TOKEN)/tokens.hxx.head $(WORKDIR_TOKEN)/tokenids.inc $(SRCDIR_TOKEN)/tokens.hxx.tail - $(call gb_Output_announce,$@,$(true),CAT,1) - $(call gb_Helper_abbreviate_dirs,cat $^ > $@) - -$(WORKDIR_TOKEN)/tokenids.inc : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 1 < $< > $@ \ - ) - -$(SRCDIR_TOKEN)/tokenmap.cxx : $(WORKDIR_TOKEN)/tokennames.inc - -$(WORKDIR_TOKEN)/tokennames.inc : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 2 < $< > $@ \ - ) - -$(SRCDIR_TOKEN)/tokenmap.cxx : $(WORKDIR_TOKEN)/tokenhash.inc - -$(WORKDIR_TOKEN)/tokenhash.inc : $(WORKDIR_TOKEN)/tokenhash.gperf - $(call gb_Output_announce,$@,$(true),GPF,3) - $(call gb_Helper_abbreviate_dirs, \ - gperf $< | $(gb_AWK) -- '{ if ($$0 !~ /^#line/){ gsub("\\(char\\*\\)0", "0", $$0); print; } }' > $@ \ - ) - -$(WORKDIR_TOKEN)/tokenhash.gperf : $(SRCDIR_TOKEN)/tokens.txt $(SRCDIR_TOKEN)/tokens.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/tokens.pl 3 < $< > $@ \ - ) - -# UNO property identifiers and names - -$(WORKDIR_TOKEN)/properties.hxx : $(SRCDIR_TOKEN)/properties.hxx.head $(WORKDIR_TOKEN)/propertyids.inc $(SRCDIR_TOKEN)/properties.hxx.tail - $(call gb_Output_announce,$@,$(true),CAT,1) - $(call gb_Helper_abbreviate_dirs,cat $^ > $@) - -$(WORKDIR_TOKEN)/propertyids.inc : $(SRCDIR_TOKEN)/properties.txt $(SRCDIR_TOKEN)/properties.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/properties.pl 1 < $< > $@ \ - ) - -$(SRCDIR_TOKEN)/propertynames.cxx : $(WORKDIR_TOKEN)/propertynames.inc - -$(WORKDIR_TOKEN)/propertynames.inc : $(SRCDIR_TOKEN)/properties.txt $(SRCDIR_TOKEN)/properties.pl - $(call gb_Output_announce,$@,$(true),PRL,1) - $(call gb_Helper_abbreviate_dirs, \ - mkdir -p $(dir $@) && $(PERL) $(SRCDIR_TOKEN)/properties.pl 2 < $< > $@ \ - ) - -# clean generated files ------------------------------------------------------- - -.PHONY : $(WORKDIR)/Misc/oox/misc_clean - -$(call gb_LinkTarget_get_clean_target,$(call gb_Library_get_linktargetname,$(call gb_Library_get_filename,oox))) : $(WORKDIR)/Misc/oox/misc_clean - -$(WORKDIR)/Misc/oox/misc_clean : - $(call gb_Helper_abbreviate_dirs,rm -rf $(dir $@)) - -# vim: set noet sw=4 ts=4: diff --git a/oox/Makefile b/oox/Makefile deleted file mode 100755 index 90947b2e5f48..000000000000 --- a/oox/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -ifeq ($(strip $(SOLARENV)),) -$(error No environment set!) -endif - -gb_PARTIALBUILD := T -GBUILDDIR := $(SOLARENV)/gbuild -include $(GBUILDDIR)/gbuild.mk - -$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) - -# vim: set noet sw=4 ts=4: diff --git a/oox/Module_oox.mk b/oox/Module_oox.mk deleted file mode 100755 index f5412ea1d221..000000000000 --- a/oox/Module_oox.mk +++ /dev/null @@ -1,37 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Module_Module,oox)) - -$(eval $(call gb_Module_add_targets,oox,\ - Library_oox \ - Package_inc \ - Package_source \ - Package_workdir \ -)) - -# vim: set noet ts=4 sw=4: diff --git a/oox/Package_inc.mk b/oox/Package_inc.mk deleted file mode 100755 index 6870821343d2..000000000000 --- a/oox/Package_inc.mk +++ /dev/null @@ -1,45 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Package_Package,oox_inc,$(SRCDIR)/oox/inc)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/dllapi.h,oox/dllapi.h)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/filterbase.hxx,oox/core/filterbase.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/filterdetect.hxx,oox/core/filterdetect.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/relations.hxx,oox/core/relations.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/core/xmlfilterbase.hxx,oox/core/xmlfilterbase.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/drawingml/chart/chartconverter.hxx,oox/drawingml/chart/chartconverter.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/drawingml/table/tablestylelist.hxx,oox/drawingml/table/tablestylelist.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/binarystreambase.hxx,oox/helper/binarystreambase.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/helper.hxx,oox/helper/helper.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refmap.hxx,oox/helper/refmap.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refvector.hxx,oox/helper/refvector.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/storagebase.hxx,oox/helper/storagebase.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/zipstorage.hxx,oox/helper/zipstorage.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/vbaproject.hxx,oox/ole/vbaproject.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/vml/vmldrawing.hxx,oox/vml/vmldrawing.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/vml/vmlshape.hxx,oox/vml/vmlshape.hxx)) -$(eval $(call gb_Package_add_file,oox_inc,inc/oox/xls/excelvbaproject.hxx,oox/xls/excelvbaproject.hxx)) diff --git a/oox/Package_source.mk b/oox/Package_source.mk deleted file mode 100755 index 95917616602a..000000000000 --- a/oox/Package_source.mk +++ /dev/null @@ -1,29 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Package_Package,oox_source,$(SRCDIR)/oox/source)) -$(eval $(call gb_Package_add_file,oox_source,inc/oox/token/tokens.txt,token/tokens.txt)) diff --git a/oox/Package_workdir.mk b/oox/Package_workdir.mk deleted file mode 100755 index 8bbde7140301..000000000000 --- a/oox/Package_workdir.mk +++ /dev/null @@ -1,32 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Package_Package,oox_workdir,$(WORKDIR)/Misc/oox)) -$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/namespaces.hxx,token/namespaces.hxx)) -$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/namespaces.txt,token/namespaces.txt)) -$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/properties.hxx,token/properties.hxx)) -$(eval $(call gb_Package_add_file,oox_workdir,inc/oox/token/tokens.hxx,token/tokens.hxx)) diff --git a/oox/oox.component b/oox/oox.component deleted file mode 100644 index f6519d5a8664..000000000000 --- a/oox/oox.component +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/oox/prj/build.lst b/oox/prj/build.lst index 2c965458b9fa..03735c73dd11 100644 --- a/oox/prj/build.lst +++ b/oox/prj/build.lst @@ -1,3 +1,18 @@ oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx xmlscript tools vcl BOOST:boost OPENSSL:openssl LIBXSLT:libxslt NULL -oox oox usr1 - all oox_mkout NULL -oox oox\prj nmake - all oox_prj NULL +oox oox usr1 - all oox_mkout NULL +oox oox\prj get - all oox_prj NULL +oox oox\source\token nmake - all oox_token NULL +oox oox\source\helper nmake - all oox_helper oox_token NULL +oox oox\source\core nmake - all oox_core oox_token NULL +oox oox\source\ole nmake - all oox_ole oox_token NULL +oox oox\source\docprop nmake - all oox_docprop oox_token NULL +oox oox\source\drawingml nmake - all oox_drawingml oox_token NULL +oox oox\source\drawingml\diagram nmake - all oox_diagram oox_token NULL +oox oox\source\drawingml\chart nmake - all oox_chart oox_token NULL +oox oox\source\drawingml\table nmake - all oox_table oox_token NULL +oox oox\source\ppt nmake - all oox_ppt oox_token NULL +oox oox\source\vml nmake - all oox_vml oox_token NULL +oox oox\source\xls nmake - all oox_xls oox_token NULL +oox oox\source\dump nmake - all oox_dump oox_token NULL +oox oox\source\shape nmake - all oox_shape oox_token NULL +oox oox\util nmake - all oox_util oox_token oox_helper oox_core oox_ole oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_shape oox_docprop NULL diff --git a/oox/prj/d.lst b/oox/prj/d.lst index e69de29bb2d1..69ff66b95bc5 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -0,0 +1,46 @@ +mkdir: %_DEST%\inc%_EXT%\oox +mkdir: %_DEST%\inc%_EXT%\oox\core +mkdir: %_DEST%\inc%_EXT%\oox\drawingml +mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart +mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table +mkdir: %_DEST%\inc%_EXT%\oox\helper +mkdir: %_DEST%\inc%_EXT%\oox\ole +mkdir: %_DEST%\inc%_EXT%\oox\token +mkdir: %_DEST%\inc%_EXT%\oox\vml +mkdir: %_DEST%\inc%_EXT%\oox\xls + +..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map +..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib +..\%__SRC%\lib\xol.lib %_DEST%\lib%_EXT%\xol.lib +..\%__SRC%\lib\libxol.a %_DEST%\lib%_EXT%\libxol.a +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so +..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib + +..\%__SRC%\inc\oox\token\tokens.hxx %_DEST%\inc%_EXT%\oox\token\tokens.hxx +..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt + +..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt +..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h +..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx +..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx +..\inc\oox\helper\refmap.hxx %_DEST%\inc%_EXT%\oox\helper\refmap.hxx +..\inc\oox\helper\refvector.hxx %_DEST%\inc%_EXT%\oox\helper\refvector.hxx +..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx +..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx +..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx +..\inc\oox\core\filterdetect.hxx %_DEST%\inc%_EXT%\oox\core\filterdetect.hxx +..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx +..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx +..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx +..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx +..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx +..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx +..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx +..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx + +dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" + +..\xml\components.xml %_DEST%\xml%_EXT%\components.xml +..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component diff --git a/oox/prj/makefile.mk b/oox/prj/makefile.mk deleted file mode 100755 index 83510a6a4ce1..000000000000 --- a/oox/prj/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -TARGET=prj - -.INCLUDE : settings.mk - -.IF "$(VERBOSE)"!="" -VERBOSEFLAG := -.ELSE -VERBOSEFLAG := -s -.ENDIF - -all: - cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) diff --git a/oox/source/core/makefile.mk b/oox/source/core/makefile.mk new file mode 100755 index 000000000000..2b58b95777df --- /dev/null +++ b/oox/source/core/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=core +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +.IF "$(SYSTEM_OPENSSL)" == "YES" +CFLAGS+= $(OPENSSL_CFLAGS) +.ENDIF + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/binarycodec.obj \ + $(SLO)$/binaryfilterbase.obj \ + $(SLO)$/contexthandler.obj \ + $(SLO)$/contexthandler2.obj \ + $(SLO)$/fastparser.obj \ + $(SLO)$/fasttokenhandler.obj \ + $(SLO)$/filterbase.obj \ + $(SLO)$/filterdetect.obj \ + $(SLO)$/fragmenthandler.obj \ + $(SLO)$/fragmenthandler2.obj \ + $(SLO)$/recordparser.obj \ + $(SLO)$/relations.obj \ + $(SLO)$/relationshandler.obj \ + $(SLO)$/services.obj \ + $(SLO)$/xmlfilterbase.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/docprop/makefile.mk b/oox/source/docprop/makefile.mk new file mode 100755 index 000000000000..5687178da9e0 --- /dev/null +++ b/oox/source/docprop/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=docprop +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/ooxmldocpropimport.obj \ + $(SLO)$/docprophandler.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/drawingml/chart/makefile.mk b/oox/source/drawingml/chart/makefile.mk new file mode 100755 index 000000000000..84762e6a2540 --- /dev/null +++ b/oox/source/drawingml/chart/makefile.mk @@ -0,0 +1,74 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=oox +TARGET=chart +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/axiscontext.obj \ + $(SLO)$/axisconverter.obj \ + $(SLO)$/axismodel.obj \ + $(SLO)$/chartcontextbase.obj \ + $(SLO)$/chartconverter.obj \ + $(SLO)$/chartdrawingfragment.obj \ + $(SLO)$/chartspaceconverter.obj \ + $(SLO)$/chartspacefragment.obj \ + $(SLO)$/chartspacemodel.obj \ + $(SLO)$/converterbase.obj \ + $(SLO)$/datasourcecontext.obj \ + $(SLO)$/datasourceconverter.obj \ + $(SLO)$/datasourcemodel.obj \ + $(SLO)$/modelbase.obj \ + $(SLO)$/objectformatter.obj \ + $(SLO)$/plotareacontext.obj \ + $(SLO)$/plotareaconverter.obj \ + $(SLO)$/plotareamodel.obj \ + $(SLO)$/seriescontext.obj \ + $(SLO)$/seriesconverter.obj \ + $(SLO)$/seriesmodel.obj \ + $(SLO)$/titlecontext.obj \ + $(SLO)$/titleconverter.obj \ + $(SLO)$/titlemodel.obj \ + $(SLO)$/typegroupcontext.obj \ + $(SLO)$/typegroupconverter.obj \ + $(SLO)$/typegroupmodel.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/drawingml/diagram/makefile.mk b/oox/source/drawingml/diagram/makefile.mk new file mode 100755 index 000000000000..9d526ed3d3fb --- /dev/null +++ b/oox/source/drawingml/diagram/makefile.mk @@ -0,0 +1,53 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=oox +TARGET=diagram +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/diagram.obj \ + $(SLO)$/diagramfragmenthandler.obj \ + $(SLO)$/diagramdefinitioncontext.obj \ + $(SLO)$/diagramlayoutatoms.obj \ + $(SLO)$/datamodelcontext.obj \ + $(SLO)$/layoutnodecontext.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk new file mode 100755 index 000000000000..0546fb4c233d --- /dev/null +++ b/oox/source/drawingml/makefile.mk @@ -0,0 +1,92 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=drawingml +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/clrscheme.obj\ + $(SLO)$/clrschemecontext.obj\ + $(SLO)$/color.obj\ + $(SLO)$/colorchoicecontext.obj\ + $(SLO)$/connectorshapecontext.obj\ + $(SLO)$/customshapegeometry.obj\ + $(SLO)$/customshapeproperties.obj\ + $(SLO)$/drawingmltypes.obj\ + $(SLO)$/embeddedwavaudiofile.obj\ + $(SLO)$/fillproperties.obj\ + $(SLO)$/fillpropertiesgroupcontext.obj\ + $(SLO)$/graphicshapecontext.obj\ + $(SLO)$/guidcontext.obj\ + $(SLO)$/hyperlinkcontext.obj\ + $(SLO)$/lineproperties.obj\ + $(SLO)$/linepropertiescontext.obj\ + $(SLO)$/objectdefaultcontext.obj\ + $(SLO)$/shape.obj\ + $(SLO)$/shapecontext.obj\ + $(SLO)$/shapegroupcontext.obj\ + $(SLO)$/shapepropertiescontext.obj\ + $(SLO)$/shapepropertymap.obj\ + $(SLO)$/shapestylecontext.obj\ + $(SLO)$/spdefcontext.obj\ + $(SLO)$/textbody.obj\ + $(SLO)$/textbodycontext.obj\ + $(SLO)$/textbodyproperties.obj\ + $(SLO)$/textbodypropertiescontext.obj\ + $(SLO)$/textcharacterproperties.obj\ + $(SLO)$/textcharacterpropertiescontext.obj\ + $(SLO)$/textfield.obj\ + $(SLO)$/textfieldcontext.obj\ + $(SLO)$/textfont.obj\ + $(SLO)$/textliststyle.obj \ + $(SLO)$/textliststylecontext.obj\ + $(SLO)$/textparagraph.obj\ + $(SLO)$/textparagraphproperties.obj\ + $(SLO)$/textparagraphpropertiescontext.obj\ + $(SLO)$/textrun.obj\ + $(SLO)$/textspacingcontext.obj\ + $(SLO)$/texttabstoplistcontext.obj\ + $(SLO)$/theme.obj\ + $(SLO)$/themeelementscontext.obj\ + $(SLO)$/themefragmenthandler.obj\ + $(SLO)$/transform2dcontext.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/drawingml/table/makefile.mk b/oox/source/drawingml/table/makefile.mk new file mode 100755 index 000000000000..fa71971fc278 --- /dev/null +++ b/oox/source/drawingml/table/makefile.mk @@ -0,0 +1,62 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=oox +TARGET=table +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/tablecontext.obj \ + $(SLO)$/tableproperties.obj \ + $(SLO)$/tablerow.obj \ + $(SLO)$/tablerowcontext.obj \ + $(SLO)$/tablecell.obj \ + $(SLO)$/tablecellcontext.obj \ + $(SLO)$/tablestylelist.obj \ + $(SLO)$/tablestylelistfragmenthandler.obj \ + $(SLO)$/tablestylecontext.obj \ + $(SLO)$/tablestyle.obj \ + $(SLO)$/tablebackgroundstylecontext.obj \ + $(SLO)$/tablepartstylecontext.obj \ + $(SLO)$/tablestyletextstylecontext.obj \ + $(SLO)$/tablestylecellstylecontext.obj \ + $(SLO)$/tablestylepart.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/dump/makefile.mk b/oox/source/dump/makefile.mk new file mode 100755 index 000000000000..1e5f615675cc --- /dev/null +++ b/oox/source/dump/makefile.mk @@ -0,0 +1,53 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=dump +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/biffdumper.obj \ + $(SLO)$/dffdumper.obj \ + $(SLO)$/dumperbase.obj \ + $(SLO)$/oledumper.obj \ + $(SLO)$/pptxdumper.obj \ + $(SLO)$/xlsbdumper.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/helper/makefile.mk b/oox/source/helper/makefile.mk new file mode 100755 index 000000000000..f31736faac8d --- /dev/null +++ b/oox/source/helper/makefile.mk @@ -0,0 +1,60 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=helper +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/attributelist.obj \ + $(SLO)$/binaryinputstream.obj \ + $(SLO)$/binaryoutputstream.obj \ + $(SLO)$/binarystreambase.obj \ + $(SLO)$/containerhelper.obj \ + $(SLO)$/graphichelper.obj \ + $(SLO)$/modelobjecthelper.obj \ + $(SLO)$/progressbar.obj \ + $(SLO)$/propertymap.obj \ + $(SLO)$/propertyset.obj \ + $(SLO)$/storagebase.obj \ + $(SLO)$/textinputstream.obj \ + $(SLO)$/zipstorage.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/ole/makefile.mk b/oox/source/ole/makefile.mk new file mode 100755 index 000000000000..a5232247cfa5 --- /dev/null +++ b/oox/source/ole/makefile.mk @@ -0,0 +1,60 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=ole +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/axbinaryreader.obj \ + $(SLO)$/axcontrol.obj \ + $(SLO)$/axcontrolfragment.obj \ + $(SLO)$/olehelper.obj \ + $(SLO)$/oleobjecthelper.obj \ + $(SLO)$/olestorage.obj \ + $(SLO)$/vbacontrol.obj \ + $(SLO)$/vbahelper.obj \ + $(SLO)$/vbainputstream.obj \ + $(SLO)$/vbamodule.obj \ + $(SLO)$/vbaproject.obj \ + $(SLO)$/vbaprojectfilter.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/oox/source/ppt/makefile.mk b/oox/source/ppt/makefile.mk new file mode 100755 index 000000000000..8d902ed51337 --- /dev/null +++ b/oox/source/ppt/makefile.mk @@ -0,0 +1,76 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=ppt +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/animationspersist.obj \ + $(SLO)$/animationtypes.obj \ + $(SLO)$/animvariantcontext.obj \ + $(SLO)$/backgroundproperties.obj\ + $(SLO)$/buildlistcontext.obj \ + $(SLO)$/commonbehaviorcontext.obj \ + $(SLO)$/commontimenodecontext.obj \ + $(SLO)$/conditioncontext.obj \ + $(SLO)$/customshowlistcontext.obj \ + $(SLO)$/headerfootercontext.obj \ + $(SLO)$/layoutfragmenthandler.obj\ + $(SLO)$/pptfilterhelpers.obj\ + $(SLO)$/pptimport.obj\ + $(SLO)$/pptshape.obj \ + $(SLO)$/pptshapecontext.obj \ + $(SLO)$/pptshapegroupcontext.obj \ + $(SLO)$/pptshapepropertiescontext.obj \ + $(SLO)$/presentationfragmenthandler.obj\ + $(SLO)$/slidefragmenthandler.obj\ + $(SLO)$/slidemastertextstylescontext.obj \ + $(SLO)$/slidepersist.obj\ + $(SLO)$/slidetimingcontext.obj\ + $(SLO)$/slidetransition.obj\ + $(SLO)$/slidetransitioncontext.obj\ + $(SLO)$/soundactioncontext.obj \ + $(SLO)$/timeanimvaluecontext.obj \ + $(SLO)$/timenode.obj\ + $(SLO)$/timenodelistcontext.obj \ + $(SLO)$/timetargetelementcontext.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/shape/makefile.mk b/oox/source/shape/makefile.mk new file mode 100755 index 000000000000..c6534b3a8a6f --- /dev/null +++ b/oox/source/shape/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=shape +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/ShapeContextHandler.obj \ + $(SLO)$/ShapeFilterBase.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk new file mode 100755 index 000000000000..ff42967f0bb1 --- /dev/null +++ b/oox/source/token/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=token + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/namespacemap.obj \ + $(SLO)$/propertynames.obj \ + $(SLO)$/tokenmap.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +GENHEADERPATH = $(INCCOM)$/oox$/token + +$(MISC)$/tokenhash.gperf $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx : + @@noop $(assign do_phony:=.PHONY) + +$(SLO)$/tokenmap.obj : $(INCCOM)$/tokenhash.inc $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(MISC)$/do_tokens + +$(INCCOM)$/tokenhash.inc : $(MISC)$/tokenhash.gperf $(MISC)$/do_tokens + $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokenhash.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokenhash.inc + +$(MISC)$/do_tokens $(do_phony) : tokens.txt tokens.pl tokens.hxx.head tokens.hxx.tail $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf + @@-$(RM) $@ + $(MKDIRHIER) $(GENHEADERPATH) + $(PERL) tokens.pl tokens.txt $(MISC)$/tokenids.inc $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf && $(TYPE) tokens.hxx.head $(MISC)$/tokenids.inc tokens.hxx.tail > $(GENHEADERPATH)$/tokens.hxx && $(TOUCH) $@ + +$(SLO)$/namespacemap.obj : $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(MISC)$/do_namespaces + +$(MISC)$/do_namespaces $(do_phony) : namespaces.txt namespaces.pl namespaces.hxx.head namespaces.hxx.tail $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx + @@-$(RM) $@ + $(MKDIRHIER) $(GENHEADERPATH) + $(PERL) namespaces.pl namespaces.txt $(MISC)$/namespaceids.inc $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt && $(TYPE) namespaces.hxx.head $(MISC)$/namespaceids.inc namespaces.hxx.tail > $(GENHEADERPATH)$/namespaces.hxx && $(TOUCH) $@ + +$(SLO)$/propertynames.obj : $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx $(MISC)$/do_properties + +$(MISC)$/do_properties $(do_phony) : properties.txt properties.pl properties.hxx.head properties.hxx.tail $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx + @@-$(RM) $@ + $(MKDIRHIER) $(GENHEADERPATH) + $(PERL) properties.pl properties.txt $(MISC)$/propertyids.inc $(INCCOM)$/propertynames.inc && $(TYPE) properties.hxx.head $(MISC)$/propertyids.inc properties.hxx.tail > $(GENHEADERPATH)$/properties.hxx && $(TOUCH) $@ diff --git a/oox/source/token/namespacemap.cxx b/oox/source/token/namespacemap.cxx index d021f2a3a353..0f4373d2dc59 100755 --- a/oox/source/token/namespacemap.cxx +++ b/oox/source/token/namespacemap.cxx @@ -36,7 +36,7 @@ NamespaceMap::NamespaceMap() static const struct NamespaceUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceUrls[] = { // include auto-generated C array with namespace URLs as C strings -#include +#include "namespacenames.inc" { -1, "" } }; diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index 1e6ba5881589..60ce5b18305d 100755 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -12,24 +12,24 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } // defines for tokens with specific namespaces -#define OOX_TOKEN( token, namespace ) (::oox::XML_##token | ::oox::NMSP_##namespace) - -#define A_TOKEN( token ) OOX_TOKEN( token, dml ) -#define AX_TOKEN( token ) OOX_TOKEN( token, ax ) -#define C_TOKEN( token ) OOX_TOKEN( token, dmlChart ) -#define CDR_TOKEN( token ) OOX_TOKEN( token, dmlChartDr ) -#define DGM_TOKEN( token ) OOX_TOKEN( token, dmlDiagram ) -#define O_TOKEN( token ) OOX_TOKEN( token, vmlOffice ) -#define PC_TOKEN( token ) OOX_TOKEN( token, packageContentTypes ) -#define PPT_TOKEN( token ) OOX_TOKEN( token, ppt ) -#define PR_TOKEN( token ) OOX_TOKEN( token, packageRel ) -#define R_TOKEN( token ) OOX_TOKEN( token, officeRel ) -#define VML_TOKEN( token ) OOX_TOKEN( token, vml ) -#define VMLX_TOKEN( token ) OOX_TOKEN( token, vmlExcel ) -#define XDR_TOKEN( token ) OOX_TOKEN( token, dmlSpreadDr ) -#define XLS_TOKEN( token ) OOX_TOKEN( token, xls ) -#define XM_TOKEN( token ) OOX_TOKEN( token, xm ) -#define XML_TOKEN( token ) OOX_TOKEN( token, xml ) +#define OOX_TOKEN( namespace, token ) (::oox::NMSP_##namespace | ::oox::XML_##token) + +#define A_TOKEN( token ) OOX_TOKEN( dml, token ) +#define AX_TOKEN( token ) OOX_TOKEN( ax, token ) +#define C_TOKEN( token ) OOX_TOKEN( dmlChart, token ) +#define CDR_TOKEN( token ) OOX_TOKEN( dmlChartDr, token ) +#define DGM_TOKEN( token ) OOX_TOKEN( dmlDiagram, token ) +#define O_TOKEN( token ) OOX_TOKEN( vmlOffice, token ) +#define PC_TOKEN( token ) OOX_TOKEN( packageContentTypes, token ) +#define PPT_TOKEN( token ) OOX_TOKEN( ppt, token ) +#define PR_TOKEN( token ) OOX_TOKEN( packageRel, token ) +#define R_TOKEN( token ) OOX_TOKEN( officeRel, token ) +#define VML_TOKEN( token ) OOX_TOKEN( vml, token ) +#define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token ) +#define XDR_TOKEN( token ) OOX_TOKEN( dmlSpreadDr, token ) +#define XLS_TOKEN( token ) OOX_TOKEN( xls, token ) +#define XM_TOKEN( token ) OOX_TOKEN( xm, token ) +#define XML_TOKEN( token ) OOX_TOKEN( xml, token ) // ============================================================================ diff --git a/oox/source/token/namespaces.pl b/oox/source/token/namespaces.pl index 7c602f70128d..3c741fa7b2af 100644 --- a/oox/source/token/namespaces.pl +++ b/oox/source/token/namespaces.pl @@ -25,19 +25,17 @@ # #************************************************************************* -# operation mode (1 = identifiers, 2 = names, 3 = plain) -$op = shift @ARGV; -die "Error: invalid operation" unless( $op >= 1 && $op <= 3); +$ARGV0 = shift @ARGV; +$ARGV1 = shift @ARGV; +$ARGV2 = shift @ARGV; +$ARGV3 = shift @ARGV; -# number of bits to shift the namespace identifier -$shift = 16; - -if( $op == 1 ) { - print( "const size_t NMSP_SHIFT = $shift;\n" ); -} +# parse input file -$i = 1; -while( <> ) { +open( INFILE, $ARGV0 ) or die "cannot open input file: $!"; +my %namespaces; +while( ) +{ # trim newline chomp( $_ ); # trim leading/trailing whitespace @@ -46,14 +44,36 @@ while( <> ) { # trim comments $_ =~ s/^#.*//; # skip empty lines - if( $_ ) { + if( $_ ) + { # check for valid characters - $_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid entry: '$_'"; - # generate output - $id = $i << $shift; - if( $op == 1 ) { print( "const sal_Int32 NMSP_$1 = $i << NMSP_SHIFT;\n" ); } - elsif( $op == 2 ) { print( "{ $id, \"$2\" },\n" ); } - elsif( $op == 3 ) { print( "$id $1 $2\n" ); } - ++$i; + $_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data"; + $namespaces{$1} = $2; } } +close( INFILE ); + +# generate output files + +open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; +open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; +open( TXTFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!"; + +# number of bits to shift the namespace identifier +$shift = 16; + +print ( IDFILE "const size_t NMSP_SHIFT = $shift;\n" ); + +$i = 1; +foreach( keys( %namespaces ) ) +{ + print( IDFILE "const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n" ); + $id = $i << $shift; + print( NAMEFILE "{ $id, \"$namespaces{$_}\" },\n" ); + print( TXTFILE "$id $_ $namespaces{$_}\n" ); + ++$i; +} + +close( IDFILE ); +close( nameFILE ); +close( TXTFILE ); diff --git a/oox/source/token/properties.pl b/oox/source/token/properties.pl index 448cec632343..f341924bbb90 100644 --- a/oox/source/token/properties.pl +++ b/oox/source/token/properties.pl @@ -25,33 +25,43 @@ # #************************************************************************* -# operation mode (1 = identifiers, 2 = names) -$op = shift @ARGV; -die "Error: invalid operation" unless( $op >= 1 && $op <= 2); +$ARGV0 = shift @ARGV; +$ARGV1 = shift @ARGV; +$ARGV2 = shift @ARGV; -$i = 0; -while( <> ) { +# parse input file + +open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; +my %props; +while( ) +{ # trim newline chomp( $_ ); # trim leading/trailing whitespace $_ =~ s/^\s*//g; $_ =~ s/\s*$//g; - # skip empty lines - if( $_ ) { - # check for valid characters - $_ =~ /^[A-Z][a-zA-Z0-9]+$/ or die "Error: invalid entry: '$_'"; - # generate output - if( $op == 1 ) { - print( "const sal_Int32 PROP_$_ = $i;\n" ); - } elsif( $op == 2 ) { - print( "/* $i */ \"$_\",\n" ); - } - ++$i; - } + # check for valid characters + $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "Error: invalid character in property '$_'"; + $id = "PROP_$_"; + $props{$_} = $id; } +close( INFILE ); + +# generate output files + +open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; +open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; -if( $op == 1 ) { - print( "const sal_Int32 PROP_COUNT = $i;\nconst sal_Int32 PROP_INVALID = -1;\n" ); -} elsif( $op == 2 ) { - print( " \"\"" ); +$i = 0; +foreach( sort( keys( %props ) ) ) +{ + print( IDFILE "const sal_Int32 $props{$_} = $i;\n" ); + print( NAMEFILE "/* $i */ \"$_\",\n" ); + ++$i; } + +print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" ); +print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" ); + +close( IDFILE ); +close( NAMEFILE ); diff --git a/oox/source/token/propertynames.cxx b/oox/source/token/propertynames.cxx index b8f06496c7ff..401d168fe696 100644 --- a/oox/source/token/propertynames.cxx +++ b/oox/source/token/propertynames.cxx @@ -36,7 +36,8 @@ PropertyNameVector::PropertyNameVector() static const sal_Char* sppcPropertyNames[] = { // include auto-generated C array with property names as C strings -#include +#include "propertynames.inc" + "" }; size_t nArraySize = (sizeof( sppcPropertyNames ) / sizeof( *sppcPropertyNames )) - 1; diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 0be0a1c4c470..a5189269c3c8 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -43,10 +43,8 @@ using ::rtl::OUString; // ============================================================================ namespace { - -// include auto-generated Perfect_Hash class -#include - +// include auto-generated Perfect_Hash +#include "tokenhash.inc" } // namespace // ============================================================================ @@ -57,7 +55,7 @@ TokenMap::TokenMap() : static const sal_Char* sppcTokenNames[] = { // include auto-generated C array with token names as C strings -#include +#include "tokennames.inc" "" }; @@ -70,14 +68,14 @@ TokenMap::TokenMap() : } #if OSL_DEBUG_LEVEL > 0 - // check that the Perfect_Hash is in sync with the token name list + // check that the perfect_hash is in sync with the token name list bool bOk = true; for( sal_Int32 nToken = 0; bOk && (nToken < XML_TOKEN_COUNT); ++nToken ) { // check that the getIdentifier <-> getToken roundtrip works OString aUtf8Name = OUStringToOString( maTokenNames[ nToken ].maUniName, RTL_TEXTENCODING_UTF8 ); - const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); - bOk = pTokenInfo && (pTokenInfo->mnToken == nToken); + struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() ); + bOk = pToken && (pToken->nToken == nToken); OSL_ENSURE( bOk, ::rtl::OStringBuffer( "TokenMap::TokenMap - token list broken, #" ). append( nToken ).append( ", '" ).append( aUtf8Name ).append( '\'' ).getStr() ); } @@ -98,8 +96,8 @@ OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const { OString aUtf8Name = OUStringToOString( rUnicodeName, RTL_TEXTENCODING_UTF8 ); - const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); - return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; + struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() ); + return pToken ? pToken->nToken : XML_TOKEN_INVALID; } Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const @@ -111,9 +109,9 @@ Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) const { - const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( + struct xmltoken* pToken = Perfect_Hash::in_word_set( reinterpret_cast< const char* >( rUtf8Name.getConstArray() ), rUtf8Name.getLength() ); - return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; + return pToken ? pToken->nToken : XML_TOKEN_INVALID; } // ============================================================================ diff --git a/oox/source/token/tokens.pl b/oox/source/token/tokens.pl index ba7f39f2be39..a951cee80db2 100644 --- a/oox/source/token/tokens.pl +++ b/oox/source/token/tokens.pl @@ -25,55 +25,56 @@ # #************************************************************************* -# operation mode (1 = identifiers, 2 = names, 3 = gperf) -$op = shift @ARGV; -die "Error: invalid operation" unless( $op >= 1 && $op <= 3); +$ARGV0 = shift @ARGV; +$ARGV1 = shift @ARGV; +$ARGV2 = shift @ARGV; +$ARGV3 = shift @ARGV; -if( $op == 3 ) { - print( "%language=C++\n" ); - print( "%define slot-name mpcName\n" ); - print( "%define initializer-suffix ,0\n" ); - print( "%define lookup-function-name getTokenInfo\n" ); - print( "%compare-strncmp\n" ); - print( "%readonly-tables\n" ); - print( "%enum\n" ); - print( "%null-strings\n" ); - print( "%struct-type\n" ); - print( "struct XMLTokenInfo {\n" ); - print( " const sal_Char* mpcName;\n" ); - print( " sal_Int32 mnToken;\n" ); - print( "};\n" ); - print( "%%\n" ); -} - -$i = 0; -while( <> ) +open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!"; +my %tokens; +while ( ) { # trim newline chomp( $_ ); # trim leading/trailing whitespace $_ =~ s/^\s*//g; $_ =~ s/\s*$//g; - # skip empty lines - if( $_ ) { - # check for valid characters - $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid entry: '$_'"; - # generate output - $id = "XML_$_"; - $id =~ s/-/_/g; - if( $op == 1 ) { - print( "const sal_Int32 $id = $i;\n" ); - } elsif( $op == 2 ) { - print( "\"$_\",\n" ); - } elsif( $op == 3 ) { - print( "$_,$id\n" ); - } - ++$i; - } + # check for valid characters + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'"; + $id = "XML_$_"; + $id =~ s/-/_/g; + $tokens{$_} = $id; } +close ( INFILE ); + +# generate output files + +open ( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!"; +open ( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!"; +open ( GPERFFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!"; -if( $op == 1 ) { - print( "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); -} elsif( $op == 3 ) { - print( "%%\n" ); +print( GPERFFILE "%language=C++\n" ); +print( GPERFFILE "%global-table\n" ); +print( GPERFFILE "%null-strings\n" ); +print( GPERFFILE "%struct-type\n" ); +print( GPERFFILE "struct xmltoken {\n" ); +print( GPERFFILE " const sal_Char *name;\n" ); +print( GPERFFILE " sal_Int32 nToken;\n" ); +print( GPERFFILE "};\n" ); +print( GPERFFILE "%%\n" ); + +$i = 0; +foreach( sort( keys( %tokens ) ) ) +{ + print( IDFILE "const sal_Int32 $tokens{$_} = $i;\n" ); + print( NAMEFILE "\"$_\",\n" ); + print( GPERFFILE "$_,$tokens{$_}\n" ); + ++$i; } + +print( IDFILE "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); +print( GPERFFILE "%%\n" ); + +close( IDFILE ); +close( NAMEFILE ); +close( GPERFFILE ); diff --git a/oox/source/vml/makefile.mk b/oox/source/vml/makefile.mk new file mode 100755 index 000000000000..094d37cd8c1c --- /dev/null +++ b/oox/source/vml/makefile.mk @@ -0,0 +1,56 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=vml +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/vmldrawing.obj \ + $(SLO)$/vmldrawingfragment.obj \ + $(SLO)$/vmlformatting.obj \ + $(SLO)$/vmlinputstream.obj \ + $(SLO)$/vmlshape.obj \ + $(SLO)$/vmlshapecontainer.obj \ + $(SLO)$/vmlshapecontext.obj \ + $(SLO)$/vmltextbox.obj \ + $(SLO)$/vmltextboxcontext.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk new file mode 100755 index 000000000000..e337afe786a8 --- /dev/null +++ b/oox/source/xls/makefile.mk @@ -0,0 +1,105 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=oox +TARGET=xls +AUTOSEG=true + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE: $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/addressconverter.obj \ + $(SLO)$/autofilterbuffer.obj \ + $(SLO)$/autofiltercontext.obj \ + $(SLO)$/biffcodec.obj \ + $(SLO)$/biffdetector.obj \ + $(SLO)$/biffhelper.obj \ + $(SLO)$/biffinputstream.obj \ + $(SLO)$/biffoutputstream.obj \ + $(SLO)$/chartsheetfragment.obj \ + $(SLO)$/commentsbuffer.obj \ + $(SLO)$/commentsfragment.obj \ + $(SLO)$/condformatbuffer.obj \ + $(SLO)$/condformatcontext.obj \ + $(SLO)$/connectionsbuffer.obj \ + $(SLO)$/connectionsfragment.obj \ + $(SLO)$/defnamesbuffer.obj \ + $(SLO)$/drawingbase.obj \ + $(SLO)$/drawingfragment.obj \ + $(SLO)$/drawingmanager.obj \ + $(SLO)$/excelchartconverter.obj \ + $(SLO)$/excelfilter.obj \ + $(SLO)$/excelhandlers.obj \ + $(SLO)$/excelvbaproject.obj \ + $(SLO)$/externallinkbuffer.obj \ + $(SLO)$/externallinkfragment.obj \ + $(SLO)$/formulabase.obj \ + $(SLO)$/formulaparser.obj \ + $(SLO)$/numberformatsbuffer.obj \ + $(SLO)$/ooxformulaparser.obj \ + $(SLO)$/pagesettings.obj \ + $(SLO)$/pivotcachebuffer.obj \ + $(SLO)$/pivotcachefragment.obj \ + $(SLO)$/pivottablebuffer.obj \ + $(SLO)$/pivottablefragment.obj \ + $(SLO)$/querytablebuffer.obj \ + $(SLO)$/querytablefragment.obj \ + $(SLO)$/richstring.obj \ + $(SLO)$/richstringcontext.obj \ + $(SLO)$/scenariobuffer.obj \ + $(SLO)$/scenariocontext.obj \ + $(SLO)$/sharedformulabuffer.obj \ + $(SLO)$/sharedstringsbuffer.obj \ + $(SLO)$/sharedstringsfragment.obj \ + $(SLO)$/sheetdatacontext.obj \ + $(SLO)$/stylesbuffer.obj \ + $(SLO)$/stylesfragment.obj \ + $(SLO)$/tablebuffer.obj \ + $(SLO)$/tablefragment.obj \ + $(SLO)$/themebuffer.obj \ + $(SLO)$/unitconverter.obj \ + $(SLO)$/viewsettings.obj \ + $(SLO)$/workbookfragment.obj \ + $(SLO)$/workbookhelper.obj \ + $(SLO)$/workbooksettings.obj \ + $(SLO)$/worksheetbuffer.obj \ + $(SLO)$/worksheetfragment.obj \ + $(SLO)$/worksheethelper.obj \ + $(SLO)$/worksheetsettings.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk new file mode 100755 index 000000000000..329ced792164 --- /dev/null +++ b/oox/util/makefile.mk @@ -0,0 +1,104 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=oox +TARGET=oox +USE_DEFFILE=TRUE +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.IF "$(L10N_framework)"=="" +# --- Allgemein ---------------------------------------------------- + +LIB1TARGET= $(SLB)$/$(TARGET).lib +LIB1FILES= \ + $(SLB)$/token.lib\ + $(SLB)$/helper.lib\ + $(SLB)$/core.lib\ + $(SLB)$/ole.lib\ + $(SLB)$/ppt.lib\ + $(SLB)$/xls.lib\ + $(SLB)$/vml.lib\ + $(SLB)$/drawingml.lib\ + $(SLB)$/diagram.lib\ + $(SLB)$/chart.lib\ + $(SLB)$/table.lib\ + $(SLB)$/shape.lib\ + $(SLB)$/dump.lib\ + $(SLB)$/docprop.lib + +# --- Shared-Library ----------------------------------------------- + +SHL1TARGET= $(TARGET)$(DLLPOSTFIX) +SHL1IMPLIB= i$(TARGET) +SHL1USE_EXPORTS=name + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB)\ + $(COMPHELPERLIB)\ + $(RTLLIB) \ + $(SALLIB) \ + $(BASEGFXLIB) \ + $(SAXLIB) \ + $(XMLSCRIPTLIB) + +# link openssl, copied this bit from ucb/source/ucp/webdav/makefile.mk +.IF "$(GUI)"=="WNT" +SHL1STDLIBS+= $(OPENSSLLIB) +.ELSE # WNT +.IF "$(OS)"=="SOLARIS" +SHL1STDLIBS+= -lnsl -lsocket -ldl +.ENDIF # SOLARIS +.IF "$(SYSTEM_OPENSSL)"=="YES" +SHL1STDLIBS+= $(OPENSSLLIB) +.ELSE +SHL1STDLIBS+= $(OPENSSLLIBST) +.ENDIF +.ENDIF # WNT + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +SHL1LIBS= $(LIB1TARGET) +DEF1NAME =$(SHL1TARGET) +DEFLIB1NAME =$(TARGET) + +# --- Targets ---------------------------------------------------------- +.ENDIF # L10N_framework + +.INCLUDE : target.mk + +ALLTAR : $(MISC)/oox.component + +$(MISC)/oox.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + oox.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt oox.component diff --git a/oox/util/makefile.pmk b/oox/util/makefile.pmk new file mode 100755 index 000000000000..adb0222c2ba2 --- /dev/null +++ b/oox/util/makefile.pmk @@ -0,0 +1,30 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# Reduction of exported symbols: +CDEFS += -DOOX_DLLIMPLEMENTATION +VISIBILITY_HIDDEN=TRUE diff --git a/oox/util/oox.component b/oox/util/oox.component new file mode 100644 index 000000000000..f6519d5a8664 --- /dev/null +++ b/oox/util/oox.component @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit From 0b3e17e310c7c540c2a8803512062cac8f678653 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 27 Jan 2011 13:20:10 +0100 Subject: dr78: revert migration of oox to gbuild (will be done in a dedicated CWS) --- Module_ooo.mk | 1 - Repository.mk | 1 - 2 files changed, 2 deletions(-) diff --git a/Module_ooo.mk b/Module_ooo.mk index 5e4784d94483..bc8d42079993 100644 --- a/Module_ooo.mk +++ b/Module_ooo.mk @@ -29,7 +29,6 @@ $(eval $(call gb_Module_Module,ooo)) $(eval $(call gb_Module_add_moduledirs,ooo,\ framework \ - oox \ sfx2 \ svl \ svtools \ diff --git a/Repository.mk b/Repository.mk index 498b45e1a57d..be80170315d2 100644 --- a/Repository.mk +++ b/Repository.mk @@ -53,7 +53,6 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \ lng \ msfilter \ msword \ - oox \ qstart_gtk \ sax \ sb \ -- cgit From f69f2d0e52b36f8187efbdd7b92e8703daa2c28b Mon Sep 17 00:00:00 2001 From: "Thomas Benisch [tbe]" Date: Tue, 1 Feb 2011 13:12:13 +0100 Subject: chart53: #i116750# RTTI for SfxViewEventHint not working --- sfx2/source/config/evntconf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 59c56cc291a7..960c64cf1175 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -59,7 +59,7 @@ // ----------------------------------------------------------------------- TYPEINIT1(SfxEventHint, SfxHint); TYPEINIT1(SfxEventNamesItem, SfxPoolItem); -TYPEINIT1(SfxViewEventHint, SfxHint); +TYPEINIT1(SfxViewEventHint, SfxEventHint); using namespace com::sun::star; -- cgit From cbcb63fd212d7044a7b4020e84c0adae258f5399 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 2 Feb 2011 18:41:04 +0100 Subject: dr78: fix com.sun.star.io.XTextInputStream.readString implementation() when parameter bRemoveDelimiter is set to False --- io/source/TextInputStream/TextInputStream.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index bb91337fc40a..5829fe43cce3 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -171,10 +171,10 @@ OUString OTextInputStream::readLine( ) return implReadString( aDummySeq, sal_True, sal_True ); } -OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool ) +OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool bRemoveDelimiter ) throw(IOException, RuntimeException) { - return implReadString( Delimiters, sal_True, sal_False ); + return implReadString( Delimiters, bRemoveDelimiter, sal_False ); } sal_Bool OTextInputStream::isEOF() -- cgit From 3bcceaa72b950f3d3874f9efee7913fc1c95a74d Mon Sep 17 00:00:00 2001 From: "Thomas Benisch [tbe]" Date: Thu, 3 Feb 2011 10:50:04 +0100 Subject: chart53: #164394# --- .../deployment/registry/component/dp_component.cxx | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 650a7585d929..0035b67d8ef7 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1779,17 +1779,23 @@ void BackendImpl::ComponentsPackageImpl::processPackage_( if (doRegisterPackage) { ComponentBackendDb::Data data; data.javaTypeLibrary = false; - std::vector< css::uno::Reference< css::uno::XInterface > > factories; - css::uno::Reference< css::uno::XComponentContext > context( - that->getObject(url), css::uno::UNO_QUERY); - if (!context.is()) { - context.set( - that->insertObject( - url, - raise_uno_process( - that->getComponentContext(), abortChannel)), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > context; + if (startup) { + context = that->getComponentContext(); + } else { + context.set(that->getObject(url), css::uno::UNO_QUERY); + if (!context.is()) { + context.set( + that->insertObject( + url, + raise_uno_process( + that->getComponentContext(), abortChannel)), + css::uno::UNO_QUERY_THROW); + } } + + std::vector< css::uno::Reference< css::uno::XInterface > > factories; + css::uno::Reference< css::registry::XSimpleRegistry > registry( css::uno::Reference< css::lang::XMultiComponentFactory >( that->getComponentContext()->getServiceManager(), -- cgit From d5feca7dcd9b2de4332c6b53657f6f5acbeb7b9a Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Thu, 3 Feb 2011 16:22:52 +0100 Subject: tkr38: #i112307# Support for x509 v3 Subject Alternative Name extension added --- xmlsecurity/prj/build.lst | 3 +- xmlsecurity/qa/certext/SanCertExt.cxx | 227 ++++++++++++++++++ xmlsecurity/qa/certext/User_35_Root_11.crt | 64 ++++++ xmlsecurity/qa/certext/export.map | 34 +++ xmlsecurity/qa/certext/makefile.mk | 177 ++++++++++++++ xmlsecurity/source/xmlsec/mscrypt/makefile.mk | 3 +- .../xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 188 +++++++++++++++ .../xmlsec/mscrypt/sanextension_mscryptimpl.hxx | 84 +++++++ .../mscrypt/securityenvironment_mscryptimpl.hxx | 3 + .../xmlsec/mscrypt/x509certificate_mscryptimpl.cxx | 9 +- xmlsecurity/source/xmlsec/nss/makefile.mk | 3 +- .../source/xmlsec/nss/sanextension_nssimpl.cxx | 254 +++++++++++++++++++++ .../source/xmlsec/nss/sanextension_nssimpl.hxx | 76 ++++++ .../source/xmlsec/nss/x509certificate_nssimpl.cxx | 29 ++- xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt | 1 + .../test_docs/CAs/Root_11/demoCA/newcerts/1022.pem | 64 ++++++ xmlsecurity/test_docs/CAs/Root_11/demoCA/serial | 2 +- xmlsecurity/test_docs/CAs/Root_11/openssl.cfg | 17 +- .../test_docs/certs/end_certs/User_35_Root_11.crt | 64 ++++++ 19 files changed, 1287 insertions(+), 15 deletions(-) create mode 100644 xmlsecurity/qa/certext/SanCertExt.cxx create mode 100644 xmlsecurity/qa/certext/User_35_Root_11.crt create mode 100644 xmlsecurity/qa/certext/export.map create mode 100644 xmlsecurity/qa/certext/makefile.mk create mode 100644 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx create mode 100644 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx create mode 100644 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx create mode 100644 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx create mode 100644 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem create mode 100644 xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst index 3d70b9cb1181..4618e309f650 100644 --- a/xmlsecurity/prj/build.lst +++ b/xmlsecurity/prj/build.lst @@ -1,4 +1,4 @@ -xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL +xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NEON:neon NULL xs xmlsecurity usr1 - all xs_mkout NULL xs xmlsecurity\inc nmake - all xs_inc NULL xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL @@ -9,3 +9,4 @@ xs xmlsecurity\source\helper nmake - al xs xmlsecurity\source\dialogs nmake - all xs_dialogs xs_inc NULL xs xmlsecurity\source\component nmake - all xs_component xs_inc NULL xs xmlsecurity\util nmake - all xs_util xs_fw xs_xmlsec xs_nss xs_mscrypt xs_helper xs_dialogs xs_component NULL +xs xmlsecurity\qa\certext nmake - all xs_certext xs_util NULL diff --git a/xmlsecurity/qa/certext/SanCertExt.cxx b/xmlsecurity/qa/certext/SanCertExt.cxx new file mode 100644 index 000000000000..6110f0f7645e --- /dev/null +++ b/xmlsecurity/qa/certext/SanCertExt.cxx @@ -0,0 +1,227 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_xmlsecurity.hxx" +#include "sal/config.h" + +#include "../../source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx" +#include +#include +#include +#include +#include +#include +#include + +#include "cppuhelper/bootstrap.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "sal/types.h" +#include "comphelper/sequence.hxx" +#include + +#include + +using namespace com::sun::star; +using ::com::sun::star::lang::XMultiServiceFactory; + +#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17" + +namespace { + +class Test: public CppUnit::TestFixture { + +private: + + static uno::Sequence< security::CertAltNameEntry > altNames; + + void init(){ + if (altNames.getLength() == 0){ + cppu::defaultBootstrap_InitialComponentContext(); + ne_ssl_certificate* cert = ne_ssl_cert_read("User_35_Root_11.crt"); + char* certExportB64 = ne_ssl_cert_export(cert); + + uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv( new SecurityEnvironment_MSCryptImpl( uno::Reference< XMultiServiceFactory >() ) ); + + uno::Reference< security::XCertificate > xCert = xSecurityEnv->createCertificateFromAscii( + rtl::OStringToOUString( certExportB64, RTL_TEXTENCODING_ASCII_US ) ); + + uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = xCert->getExtensions(); + for (sal_Int32 i = 0 ; i < extensions.getLength(); i++) + { + uno::Reference< security::XCertificateExtension >element = extensions[i]; + + rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength()); + if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME)) + { + uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY ); + altNames = sanExtension->getAlternativeNames(); + break; + } + } + } + + } + +public: + void test_Others() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_OTHER_NAME) + { + ::com::sun::star::beans::NamedValue otherNameProp; + if (altNames[n].Value >>= otherNameProp) + { + //Name + CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), otherNameProp.Name); + + //Value + uno::Sequence< sal_Int8 > ipAddress; + otherNameProp.Value >>= ipAddress; + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) ); + } + } + } + } + + void test_RFC822() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_RFC822_NAME) + { + rtl::OUString value; + altNames[n].Value >>= value; + //Value + CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("my@other.address"), value); + } + } + } + + void test_DNS() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_DNS_NAME) + { + rtl::OUString value; + altNames[n].Value >>= value; + //Value + CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("alt.openoffice.org"), value); + } + } + } + + void test_Direcory() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_DIRECTORY_NAME) + { + uno::Sequence< sal_Int8 > value; + altNames[n].Value >>= value; + //Value + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( value.getLength() > 0 ) ); + } + } + } + + void test_URI() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_URL) + { + rtl::OUString value; + altNames[n].Value >>= value; + //Value + CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("http://my.url.here/"), value); + } + } + } + + void test_IP() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_IP_ADDRESS) + { + uno::Sequence< sal_Int8 > ipAddress; + altNames[n].Value >>= ipAddress; + //Value + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) ); + } + } + + } + + void test_RID() { + init(); + for(int n = 1; n < altNames.getLength(); n++) + { + if (altNames[n].Type == security::ExtAltNameType_REGISTERED_ID) + { + rtl::OUString value; + altNames[n].Value >>= value; + //Value + CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), value); + } + } + + } + + void test_EDI() { + // Not implemented + } + + void test_X400() { + // Not implemented + } + + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test_Others); + CPPUNIT_TEST(test_RFC822); + CPPUNIT_TEST(test_DNS); + CPPUNIT_TEST(test_Direcory); + CPPUNIT_TEST(test_URI); + CPPUNIT_TEST(test_IP); + CPPUNIT_TEST(test_RID); + CPPUNIT_TEST(test_EDI); + CPPUNIT_TEST(test_X400); + CPPUNIT_TEST_SUITE_END(); +}; + +uno::Sequence< security::CertAltNameEntry > Test::altNames; + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmlsecurity/qa/certext/User_35_Root_11.crt b/xmlsecurity/qa/certext/User_35_Root_11.crt new file mode 100644 index 000000000000..6902605756af --- /dev/null +++ b/xmlsecurity/qa/certext/User_35_Root_11.crt @@ -0,0 +1,64 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4130 (0x1022) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11 + Validity + Not Before: Nov 8 10:51:39 2010 GMT + Not After : Nov 8 10:51:39 2011 GMT + Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f: + 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28: + 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc: + 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b: + 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19: + c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42: + 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70: + c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67: + 55:9b:90:91:f4:ce:56:04:d5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment + X509v3 Subject Key Identifier: + 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73 + X509v3 Authority Key Identifier: + keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55 + + X509v3 Subject Alternative Name: + DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/ + Signature Algorithm: sha1WithRSAEncryption + 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05: + a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee: + 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a: + 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa: + 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70: + 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6: + f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f: + a0:fd +-----BEGIN CERTIFICATE----- +MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx +EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD +VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx +MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i +dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l +bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt +XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43 +BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL +BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud +IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v +cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu +YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW +MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT +C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t +eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF +oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL +qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+ +lkd9/kphSJARC70PoP0= +-----END CERTIFICATE----- diff --git a/xmlsecurity/qa/certext/export.map b/xmlsecurity/qa/certext/export.map new file mode 100644 index 000000000000..3308588ef6f8 --- /dev/null +++ b/xmlsecurity/qa/certext/export.map @@ -0,0 +1,34 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +UDK_3_0_0 { + global: + cppunitTestPlugIn; + + local: + *; +}; diff --git a/xmlsecurity/qa/certext/makefile.mk b/xmlsecurity/qa/certext/makefile.mk new file mode 100644 index 000000000000..36ebb954914c --- /dev/null +++ b/xmlsecurity/qa/certext/makefile.mk @@ -0,0 +1,177 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = ../.. +PRJNAME = xmlsecurity +TARGET = qa_certext + +ENABLE_EXCEPTIONS = TRUE + +.IF "$(OS)" == "WNT" +my_file = file:/// +.ELSE +my_file = file:// +.END + + +.INCLUDE: settings.mk +.INCLUDE : $(PRJ)$/util$/target.pmk + +.IF "$(SYSTEM_LIBXML)" == "YES" +CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) +.ENDIF + +.IF "$(CRYPTO_ENGINE)" == "nss" + +.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES" +.IF "$(SYSTEM_MOZILLA)" != "YES" +@all: + @echo "No mozilla -> no nss -> no libxmlsec -> no xmlsecurity/nss" +.ENDIF +.ENDIF + +.IF "$(SYSTEM_MOZILLA)" != "YES" +MOZ_INC = $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla +NSS_INC = $(MOZ_INC)$/nss +NSPR_INC = $(MOZ_INC)$/nspr +.ELSE +# MOZ_INC already defined from environment +NSS_INC = $(MOZ_NSS_CFLAGS) +NSPR_INC = $(MOZ_INC)$/nspr +.ENDIF + +.IF "$(GUI)"=="UNX" +.IF "$(COMNAME)"=="sunpro5" +CFLAGS += -features=tmplife +#This flag is needed to build mozilla 1.7 code +.ENDIF # "$(COMNAME)"=="sunpro5" +.ENDIF + +.IF "$(GUI)" == "WNT" +.IF "$(DBG_LEVEL)" == "0" +INCPRE += \ +-I$(MOZ_INC)$/profile \ +-I$(MOZ_INC)$/string \ +-I$(MOZ_INC)$/embed_base +CFLAGS += -GR- -W3 -Gy -MD -UDEBUG +.ELSE +INCPRE += \ +-I$(MOZ_INC)$/profile \ +-I$(MOZ_INC)$/string \ +-I$(MOZ_INC)$/embed_base +CFLAGS += -Zi -GR- -W3 -Gy -MDd -UNDEBUG +.ENDIF +.ENDIF +.IF "$(GUI)" == "UNX" +INCPOST += \ +$(MOZ_INC)$/profile \ +-I$(MOZ_INC)$/string \ +-I$(MOZ_INC)$/embed_base +.ENDIF + +CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT + +SOLARINC += \ + -I$(MOZ_INC) \ +-I$(NSPR_INC) \ +-I$(PRJ)$/source$/xmlsec + +.IF "$(SYSTEM_MOZILLA)" == "YES" +SOLARINC += -DSYSTEM_MOZILLA $(NSS_INC) +.ELSE +SOLARINC += -I$(NSS_INC) +.ENDIF +.ENDIF + + + + +CFLAGSCXX += $(CPPUNIT_CFLAGS) + +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLOFILES) +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUNITLIB) \ + $(SALLIB) \ + $(NEON3RDLIB) \ + $(CPPULIB) \ + $(XMLOFFLIB) \ + $(CPPUHELPERLIB) \ + $(SVLLIB) \ + $(TOOLSLIB) \ + $(COMPHELPERLIB) + + + +.IF "$(OS)"=="SOLARIS" +SHL1STDLIBS +=-ldl +.ENDIF + +.IF "$(SYSTEM_MOZILLA)" == "YES" +.IF "$(NSPR_LIB)" != "" +SHL1STDLIBS += $(NSPR_LIB) +.ENDIF +.IF "$(NSS_LIB)" != "" +SHL1STDLIBS += $(NSS_LIB) +.ENDIF +.ENDIF + +.IF "$(CRYPTO_ENGINE)" == "mscrypto" +SHL1STDLIBS+= $(MSCRYPTOLIBS) +.ELSE +CDEFS += -DNSS_ENGINE +SHL1STDLIBS+= $(NSSCRYPTOLIBS) +.ENDIF + +.IF "$(ENABLE_NSS_MODULE)"=="YES" || "$(SYSTEM_MOZILLA)" == "YES" + +SHL1LIBS= \ + $(SLB)$/xs_comm.lib + +.IF "$(CRYPTO_ENGINE)" == "mscrypto" +SHL1LIBS += \ + $(SLB)$/xs_mscrypt.lib +.ELSE +SHL1LIBS += \ + $(SLB)$/xs_nss.lib +.ENDIF + +.ENDIF + +SHL1TARGET = qa_CertExt +SHL1VERSIONMAP = $(PRJ)/qa/certext/export.map +DEF1NAME = $(SHL1TARGET) + +SLOFILES = $(SLO)/SanCertExt.obj + +.INCLUDE: target.mk + +ALLTAR : test + +test .PHONY : $(SHL1TARGETN) + $(CPPUNITTESTER) $(SHL1TARGETN) \ + -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/types.rdb diff --git a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk index 20153edf18e6..2287266de3fa 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk +++ b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk @@ -63,7 +63,8 @@ SLOFILES = \ $(SLO)$/xmlsignature_mscryptimpl.obj \ $(SLO)$/x509certificate_mscryptimpl.obj \ $(SLO)$/seinitializer_mscryptimpl.obj \ - $(SLO)$/xsec_mscrypt.obj + $(SLO)$/xsec_mscrypt.obj \ + $(SLO)$/sanextension_mscryptimpl.obj .ENDIF diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx new file mode 100644 index 000000000000..bebc933701b7 --- /dev/null +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmlsecurity.hxx" +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_ +#include "sanextension_mscryptimpl.hxx" +#endif + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::security ; +using ::rtl::OUString ; + +using ::com::sun::star::security::XCertificateExtension ; + + +SanExtensionImpl :: SanExtensionImpl() : + m_critical( sal_False ) +{ +} + +SanExtensionImpl :: ~SanExtensionImpl() { +} + + +//Methods from XCertificateExtension +sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) { + return m_critical ; +} + +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) { + return m_xExtnId ; +} + +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) { + return m_xExtnValue ; +} + +//Methods from XSanExtension +::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){ + + if (!m_Entries.hasElements()) + { + CERT_ALT_NAME_INFO *subjectName; + DWORD size; + CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, (unsigned char*) m_xExtnValue.getArray(), m_xExtnValue.getLength(), CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,&subjectName, &size); + + CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[subjectName->cAltEntry]; + + for (unsigned int i = 0; i < (unsigned int)subjectName->cAltEntry; i++){ + PCERT_ALT_NAME_ENTRY pEntry = &subjectName->rgAltEntry[i]; + + switch(pEntry->dwAltNameChoice) { + case CERT_ALT_NAME_OTHER_NAME : + { + arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME; + PCERT_OTHER_NAME pOtherName = pEntry->pOtherName; + + ::com::sun::star::beans::NamedValue otherNameProp; + otherNameProp.Name = ::rtl::OUString::createFromAscii(pOtherName->pszObjId); + + Sequence< sal_Int8 > otherName( pOtherName->Value.cbData ) ; + for( unsigned int n = 0; n < (unsigned int) pOtherName->Value.cbData ; n ++ ) + otherName[n] = *( pOtherName->Value.pbData + n ) ; + + otherNameProp.Value <<= otherName; + + arrCertAltNameEntry[i].Value <<= otherNameProp; + break; + } + case CERT_ALT_NAME_RFC822_NAME : + arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszRfc822Name); + break; + case CERT_ALT_NAME_DNS_NAME : + arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszDNSName); + break; + case CERT_ALT_NAME_DIRECTORY_NAME : + { + arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; + + Sequence< sal_Int8 > directoryName( pEntry->DirectoryName.cbData ) ; + for( unsigned int n = 0; n < pEntry->DirectoryName.cbData ; n++ ) + directoryName[n] = *( pEntry->DirectoryName.pbData + n ) ; + + arrCertAltNameEntry[i].Value <<= directoryName; + break; + } + case CERT_ALT_NAME_URL : + arrCertAltNameEntry[i].Type = ExtAltNameType_URL; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszURL); + break; + case CERT_ALT_NAME_IP_ADDRESS : + { + arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS; + + Sequence< sal_Int8 > ipAddress( pEntry->IPAddress.cbData ) ; + for( unsigned int n = 0; n < pEntry->IPAddress.cbData ; n ++ ) + ipAddress[n] = *( pEntry->IPAddress.pbData + n ) ; + + arrCertAltNameEntry[i].Value <<= ipAddress; + break; + } + case CERT_ALT_NAME_REGISTERED_ID : + arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(pEntry->pszRegisteredID); + break; + } + } + m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, subjectName->cAltEntry); + + delete [] arrCertAltNameEntry; + } + + return m_Entries; +} + +//Helper method +void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { + m_critical = critical ; + m_xExtnId = extnId ; + m_xExtnValue = extnValue ; +} + +void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) { + unsigned int i ; + if( value != NULL && vlen != 0 ) { + Sequence< sal_Int8 > extnv( vlen ) ; + for( i = 0; i < vlen ; i ++ ) + extnv[i] = *( value + i ) ; + + m_xExtnValue = extnv ; + } else { + m_xExtnValue = Sequence(); + } + + if( id != NULL && idlen != 0 ) { + Sequence< sal_Int8 > extnId( idlen ) ; + for( i = 0; i < idlen ; i ++ ) + extnId[i] = *( id + i ) ; + + m_xExtnId = extnId ; + } else { + m_xExtnId = Sequence(); + } + + m_critical = critical ; +} + +void SanExtensionImpl :: extractCertExt () { +} + diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx new file mode 100644 index 000000000000..0fb3616486be --- /dev/null +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_ +#define _SANEXTENSION_MSCRYPTIMPL_HXX_ + +#ifdef _MSC_VER +#pragma warning(push,1) +#endif +#include "Windows.h" +#include "WinCrypt.h" +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#include +#include +#include +#include +#include +#include "com/sun/star/uno/SecurityException.hpp" +#include +#include +#include +#include + +class SanExtensionImpl : public ::cppu::WeakImplHelper1< + ::com::sun::star::security::XSanExtension > +{ + private : + sal_Bool m_critical ; + ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ; + ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ; + + ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries; + + public : + SanExtensionImpl() ; + virtual ~SanExtensionImpl() ; + + //Methods from XCertificateExtension + virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ; + + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ; + + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ; + + //Methods from XSanExtension + + virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ; + + //Helper method + void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ; + + void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ; + + void extractCertExt() ; +} ; + +#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_ + diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index a97c96b6c3d3..7d6f21ce1551 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -60,6 +60,9 @@ #include #include "xmlsec/xmlsec.h" +#include "sal/types.h" + + class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4< ::com::sun::star::xml::crypto::XSecurityEnvironment , ::com::sun::star::lang::XInitialization , diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index 48d27e4e6737..773c92e38c57 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -31,6 +31,7 @@ #include #include "x509certificate_mscryptimpl.hxx" #include "certificateextension_xmlsecimpl.hxx" +#include "sanextension_mscryptimpl.hxx" //MM : added by MM #include "oid.hxx" @@ -392,7 +393,13 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su for( unsigned int i = 0; i < m_pCertContext->pCertInfo->cExtension; i++ ) { pExtn = &(m_pCertContext->pCertInfo->rgExtension[i]) ; - xExtn = new CertificateExtension_XmlSecImpl() ; + + ::rtl::OUString objId = ::rtl::OUString::createFromAscii( pExtn->pszObjId ); + + if ( objId.equalsAscii("2.5.29.17") ) + xExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + else + xExtn = new CertificateExtension_XmlSecImpl() ; if( xExtn == NULL ) throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/nss/makefile.mk b/xmlsecurity/source/xmlsec/nss/makefile.mk index 227b6de88477..f4ba0bde768e 100644 --- a/xmlsecurity/source/xmlsec/nss/makefile.mk +++ b/xmlsecurity/source/xmlsec/nss/makefile.mk @@ -131,7 +131,8 @@ SLOFILES = \ $(SLO)$/x509certificate_nssimpl.obj \ $(SLO)$/seinitializer_nssimpl.obj \ $(SLO)$/xsec_nss.obj \ - $(SLO)$/secerror.obj + $(SLO)$/sanextension_nssimpl.obj \ + $(SLO)$/secerror.obj diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx new file mode 100644 index 000000000000..14b01b69864d --- /dev/null +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -0,0 +1,254 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmlsecurity.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef _SANEXTENSION_NSSIMPL_HXX_ +#include "sanextension_nssimpl.hxx" +#endif + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::security ; +using ::rtl::OUString ; + +using ::com::sun::star::security::XCertificateExtension ; + + +SanExtensionImpl :: SanExtensionImpl() : +m_critical( sal_False ) +{ +} + +SanExtensionImpl :: ~SanExtensionImpl() { +} + + +//Methods from XCertificateExtension +sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) { + return m_critical ; +} + +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) { + return m_xExtnId ; +} + +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) { + return m_xExtnValue ; +} + +namespace { + // Helper functions from nss/lib/certdb/genname.c + static int GetNamesLength(CERTGeneralName *names) + { + int length = 0; + CERTGeneralName *first; + + first = names; + if (names != NULL) { + do { + length++; + names = CERT_GetNextGeneralName(names); + } while (names != first); + } + return length; + } + + static SECStatus DestroyGeneralName(CERTGeneralName *name) + { + CERTGeneralName *first; + CERTGeneralName *next = NULL; + + first = name; + do { + next = CERT_GetNextGeneralName(name); + PORT_Free(name); + name = next; + } while (name != first); + return SECSuccess; + + } +} + +//Methods from XSanExtension +::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){ + + if (!m_Entries.hasElements()) + { + SECItem item; + + item.type = siDERCertBuffer; + item.data = (unsigned char*) m_xExtnValue.getArray(); + item.len = m_xExtnValue.getLength(); + + PRArenaPool *arena; + CERTGeneralName *nameList; + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + + if (!arena) + return m_Entries; + + nameList = CERT_DecodeAltNameExtension(arena, &item); + + CERTGeneralName* current = nameList; + + int size = GetNamesLength(nameList); + CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[size]; + for(int i = 0; i < size ; i++){ + switch (current->type) { + case certOtherName: { + arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME; + ::com::sun::star::beans::PropertyValue otherNameProp; + otherNameProp.Name = ::rtl::OUString::createFromAscii(CERT_GetOidString(¤t->name.OthName.oid)); + + Sequence< sal_Int8 > otherName( current->name.OthName.name.len ) ; + for( unsigned int r = 0; r < current->name.OthName.name.len ; r ++ ) + otherName[r] = *( current->name.OthName.name.data + r ) ; + + otherNameProp.Value <<= otherName; + + arrCertAltNameEntry[i].Value <<= otherNameProp; + break; + } + case certRFC822Name: + arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + break; + case certDNSName: + arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + break; + case certX400Address: { + // unsupported + arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS; + arrCertAltNameEntry[i].value <<= Any.VOID; + break; + } + case certDirectoryName: { + arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; + + char * directoryName = CERT_NameToAscii(¤t->name.directoryName); + + arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(directoryName); + + PORT_Free(directoryName); + break; + } + case certEDIPartyName: { + // unsupported + arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME; + arrCertAltNameEntry[i].Value <<= Any.VOID; + break; + } + case certURI: + arrCertAltNameEntry[i].Type = ExtAltNameType_URL; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US); + break; + case certIPAddress: { + arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS; + + Sequence< sal_Int8 > ipAddress( current->name.other.len ) ; + for( unsigned int r = 0; r < current->name.other.len ; r ++ ) + ipAddress[r] = *( current->name.other.data + r ) ; + + arrCertAltNameEntry[i].Value <<= ipAddress; + break; + } + case certRegisterID: + arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID; + arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(CERT_GetOidString(¤t->name.other)); + break; + } + + + // break; + + current = CERT_GetNextGeneralName(current); + } + + m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, size); + + delete [] arrCertAltNameEntry; + + PORT_FreeArena(arena, PR_FALSE); + + + } + + return m_Entries; +} + +//Helper method +void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { + m_critical = critical ; + m_xExtnId = extnId ; + m_xExtnValue = extnValue ; +} + +void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) { + unsigned int i ; + if( value != NULL && vlen != 0 ) { + Sequence< sal_Int8 > extnv( vlen ) ; + for( i = 0; i < vlen ; i ++ ) + extnv[i] = *( value + i ) ; + + m_xExtnValue = extnv ; + } else { + m_xExtnValue = Sequence(); + } + + if( id != NULL && idlen != 0 ) { + Sequence< sal_Int8 > extnId( idlen ) ; + for( i = 0; i < idlen ; i ++ ) + extnId[i] = *( id + i ) ; + + m_xExtnId = extnId ; + } else { + m_xExtnId = Sequence(); + } + + m_critical = critical ; +} + +void SanExtensionImpl :: extractCertExt () { +} + diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx new file mode 100644 index 000000000000..153185c38c6a --- /dev/null +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SANEXTENSION_NSSIMPL_HXX_ +#define _SANEXTENSION_NSSIMPL_HXX_ + +#include +#include +#include +#include +#include +#include "com/sun/star/uno/SecurityException.hpp" +#include +#include +#include +#include + +class SanExtensionImpl : public ::cppu::WeakImplHelper1< + ::com::sun::star::security::XSanExtension > +{ + private : + sal_Bool m_critical ; + ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ; + ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ; + + ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries; + + public : + SanExtensionImpl() ; + virtual ~SanExtensionImpl() ; + + //Methods from XCertificateExtension + virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ; + + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ; + + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ; + + //Methods from XSanExtension + + virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ; + + //Helper method + void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ; + + void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ; + + void extractCertExt() ; +} ; + +#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_ + diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 287dce6408ef..a9fb57c39769 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -51,6 +51,9 @@ #include "certificateextension_xmlsecimpl.hxx" #endif +#ifndef _SANEXTENSION_NSSIMPL_HXX_ +#include "sanextension_nssimpl.hxx" +#endif using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::security ; @@ -203,12 +206,27 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s Sequence< Reference< XCertificateExtension > > xExtns( len ) ; for( extns = m_pCert->extensions, len = 0; *extns != NULL; extns ++, len ++ ) { - pExtn = new CertificateExtension_XmlSecImpl() ; + const SECItem id = (*extns)->id; + ::rtl::OString oidString(CERT_GetOidString(&id)); + + // remove "OID." prefix if existing + ::rtl::OString objID; + ::rtl::OString oid("OID."); + if (oidString.match(oid)) + objID = oidString.copy(oid.getLength()); + else + objID = oidString; + + if ( objId.equals("2.5.29.17") ) + pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + else + pExtn = new CertificateExtension_XmlSecImpl() ; + if( (*extns)->critical.data == NULL ) crit = sal_False ; else crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ; - pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (*extns)->id.data, (*extns)->id.len, crit ) ; + pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objId.getStr(), objId.getLength(), crit ) ; xExtns[len] = pExtn ; } @@ -232,7 +250,12 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s pExtn = NULL ; for( extns = m_pCert->extensions; *extns != NULL; extns ++ ) { if( SECITEM_CompareItem( &idItem, &(*extns)->id ) == SECEqual ) { - pExtn = new CertificateExtension_XmlSecImpl() ; + const SECItem id = (*extns)->id; + ::rtl::OString objId(CERT_GetOidString(&id)); + if ( objId.equals("OID.2.5.29.17") ) + pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; + else + pExtn = new CertificateExtension_XmlSecImpl() ; if( (*extns)->critical.data == NULL ) crit = sal_False ; else diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt index 7061a98fa15f..f6c52e5ac22f 100755 --- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt +++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt @@ -32,3 +32,4 @@ V 350113102213Z 101E unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/C V 350113102601Z 101F unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x000\x00<\x00 \x00>\x00#\x00;\x00 \x00"\x00+\x00" V 350113102847Z 1020 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x001\x00 \x00\\x00"\x00a\x00,\x00b\x00"\x00+\x00C\x00N\x00=\x00U\x00S\x00,\x00 \x00>\x00 \x00\\x00\\x00d\x00e\x00 \x00< V 350113104059Z 1021 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x001\x004\x00 \x00"\x00,\x00m\x00i\x00d\x00d\x00l\x00e\x00 \x00q\x00u\x00o\x00t\x00e +V 111108105139Z 1022 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=User 35 diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem new file mode 100644 index 000000000000..6902605756af --- /dev/null +++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem @@ -0,0 +1,64 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4130 (0x1022) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11 + Validity + Not Before: Nov 8 10:51:39 2010 GMT + Not After : Nov 8 10:51:39 2011 GMT + Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f: + 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28: + 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc: + 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b: + 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19: + c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42: + 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70: + c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67: + 55:9b:90:91:f4:ce:56:04:d5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment + X509v3 Subject Key Identifier: + 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73 + X509v3 Authority Key Identifier: + keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55 + + X509v3 Subject Alternative Name: + DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/ + Signature Algorithm: sha1WithRSAEncryption + 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05: + a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee: + 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a: + 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa: + 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70: + 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6: + f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f: + a0:fd +-----BEGIN CERTIFICATE----- +MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx +EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD +VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx +MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i +dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l +bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt +XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43 +BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL +BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud +IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v +cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu +YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW +MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT +C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t +eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF +oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL +qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+ +lkd9/kphSJARC70PoP0= +-----END CERTIFICATE----- diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial index c7781419a38b..b70608fe859d 100755 --- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial +++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial @@ -1 +1 @@ -1022 +1023 diff --git a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg index 8bf98da50e74..9d98db508b63 100755 --- a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg +++ b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg @@ -178,13 +178,16 @@ authorityKeyIdentifier=keyid,issuer # An alternative to produce certificates that aren't # deprecated according to PKIX. # subjectAltName=email:move -subjectAltName=dirName:dn_subjectAlt -# Copy subject details -# issuerAltName=issuer:copy - - -[dn_subjectAlt] -CN=User 14 Root 11 +subjectAltName=DNS:alt.openoffice.org,IP:192.168.7.1,IP:13::17,email:my@other.address,RID:1.2.3.4,otherName:1.2.3.4;UTF8:some other identifier,dirName:dir_sect,URI:http://my.url.here/ +# Copy subject details +# issuerAltName=issuer:copy + + +[dir_sect] +C=DE +O=OpenOffice.org +OU=Development +CN=User 32 Root 11 [ v3_req ] diff --git a/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt new file mode 100644 index 000000000000..6902605756af --- /dev/null +++ b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt @@ -0,0 +1,64 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4130 (0x1022) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11 + Validity + Not Before: Nov 8 10:51:39 2010 GMT + Not After : Nov 8 10:51:39 2011 GMT + Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f: + 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28: + 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc: + 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b: + 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19: + c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42: + 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70: + c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67: + 55:9b:90:91:f4:ce:56:04:d5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment + X509v3 Subject Key Identifier: + 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73 + X509v3 Authority Key Identifier: + keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55 + + X509v3 Subject Alternative Name: + DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/ + Signature Algorithm: sha1WithRSAEncryption + 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05: + a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee: + 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a: + 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa: + 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70: + 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6: + f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f: + a0:fd +-----BEGIN CERTIFICATE----- +MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx +EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD +VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx +MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i +dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l +bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt +XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43 +BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL +BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud +IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v +cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu +YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW +MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT +C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t +eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF +oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL +qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+ +lkd9/kphSJARC70PoP0= +-----END CERTIFICATE----- -- cgit From 40872eccecbcba58c56a39a94a3a5cca7d055294 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Thu, 3 Feb 2011 16:22:52 +0100 Subject: tkr38: #i112307# Support for x509 v3 Subject Alternative Name extension added --- offapi/com/sun/star/security/CertAltNameEntry.idl | 59 ++++++++++++++ offapi/com/sun/star/security/ExtAltNameType.idl | 99 +++++++++++++++++++++++ offapi/com/sun/star/security/XSanExtension.idl | 57 +++++++++++++ offapi/com/sun/star/security/makefile.mk | 8 +- 4 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 offapi/com/sun/star/security/CertAltNameEntry.idl create mode 100644 offapi/com/sun/star/security/ExtAltNameType.idl create mode 100644 offapi/com/sun/star/security/XSanExtension.idl diff --git a/offapi/com/sun/star/security/CertAltNameEntry.idl b/offapi/com/sun/star/security/CertAltNameEntry.idl new file mode 100644 index 000000000000..1ef827b77f89 --- /dev/null +++ b/offapi/com/sun/star/security/CertAltNameEntry.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef __com_sun_star_security_CertAltNameEntry_idl__ +#define __com_sun_star_security_CertAltNameEntry_idl__ + +#include + +//============================================================================= + + module com { module sun { module star { module security { + +//============================================================================= +/** + * struct contains a single entry within a Subject Alternative Name Extension of a + * X509 certificate. + */ +struct CertAltNameEntry +{ + /** + * defines the type of the value . With this information you can determine how to interprete the Any value. + * @see com::sun::star::security::ExtAltNameType + */ + com::sun::star::security::ExtAltNameType Type; + + /** + * stores the value of entry. + */ + any Value; +}; + + +}; }; }; }; +#endif diff --git a/offapi/com/sun/star/security/ExtAltNameType.idl b/offapi/com/sun/star/security/ExtAltNameType.idl new file mode 100644 index 000000000000..13ee63936df0 --- /dev/null +++ b/offapi/com/sun/star/security/ExtAltNameType.idl @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/** -- idl definition -- **/ + +#ifndef __com_sun_star_security_ExtAltNameType_idl_ +#define __com_sun_star_security_ExtAltNameType_idl_ + +#include + +module com { module sun { module star { module security { + +/** + * Constant definiton of a single entry from Subject Alternative Name extension. + * + */ +enum ExtAltNameType +{ + /** + * Cutomize name/value pair + * The value of @see com::sun::star::security::CertAltNameEntry contains a NamedValue + */ + OTHER_NAME, + + /** + * The entry contains rfc822 name. + * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + */ + RFC822_NAME, + + /** + * The entry contains a dns name. + * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + */ + DNS_NAME, + + /** + * The entry contains a directory name. + * The value of @see com::sun::star::security::CertAltNameEntry contains a Sequence of sal_Int8 + */ + DIRECTORY_NAME, + + /** + * The entry contains an url. + * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + */ + URL, + + /** + * The entry contains a ip address. + * The value of @see com::sun::star::security::CertAltNameEntry contains a Sequence of sal_Int8 + */ + IP_ADDRESS, + + /** + * The entry contains a registered id. + * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + */ + REGISTERED_ID, + + /** + * Currently unsupported. + */ + EDI_PARTY_NAME, + + /** + * Currently unsupported. + */ + X400_ADDRESS +}; + +} ; } ; } ; } ; + +#endif + \ No newline at end of file diff --git a/offapi/com/sun/star/security/XSanExtension.idl b/offapi/com/sun/star/security/XSanExtension.idl new file mode 100644 index 000000000000..e378e1b0817e --- /dev/null +++ b/offapi/com/sun/star/security/XSanExtension.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//i20156 - new file for xmlsecurity module + +/** -- idl definition -- **/ + +#ifndef __com_sun_star_security_XSanExtension_idl_ +#define __com_sun_star_security_XSanExtension_idl_ + +#include +#include +#include + +module com { module sun { module star { module security { + +/** + * Interface of a X509 Subject Alternative Name Certificate Extension + * + *

This interface represents a x509 certificate extension.

+ */ +interface XSanExtension : com::sun::star::security::XCertificateExtension +{ + /** + * Contains the alternative names of a certificate + */ + [attribute, readonly] sequence< com::sun::star::security::CertAltNameEntry > AlternativeNames; +}; + +} ; } ; } ; } ; + +#endif + diff --git a/offapi/com/sun/star/security/makefile.mk b/offapi/com/sun/star/security/makefile.mk index 21667da10972..2064e9fb4bea 100644 --- a/offapi/com/sun/star/security/makefile.mk +++ b/offapi/com/sun/star/security/makefile.mk @@ -59,7 +59,13 @@ IDLFILES=\ XSerialNumberAdapter.idl \ SerialNumberAdapter.idl \ CertificateContainer.idl \ - CertificateContainerStatus.idl + CertificateContainerStatus.idl \ + ExtAltNameType.idl \ + XSanExtension.idl \ + CertAltNameEntry.idl + + + # ------------------------------------------------------------------ -- cgit From 3a6ae28ed1860d95d529c736396778367cd141b8 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Thu, 3 Feb 2011 16:22:52 +0100 Subject: tkr38: #i112307# Support for x509 v3 Subject Alternative Name extension added --- uui/source/iahndl-ssl.cxx | 67 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index 4df133c7c674..0703c329e9fc 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -25,12 +25,18 @@ * ************************************************************************/ + #include "com/sun/star/security/CertificateValidity.hpp" +#include "com/sun/star/security/XCertificateExtension.hpp" +#include "com/sun/star/security/XSanExtension.hpp" +#include #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionRequest.hpp" #include "com/sun/star/ucb/CertificateValidationRequest.hpp" +#include +#include #include "vos/mutex.hxx" #include "tools/datetime.hxx" #include "svl/zforlist.hxx" @@ -47,6 +53,9 @@ #define DESCRIPTION_2 2 #define TITLE 3 +#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17" + + using namespace com::sun::star; namespace { @@ -77,19 +86,25 @@ getContentPart( const String& _rRawString ) bool isDomainMatch( - rtl::OUString hostName, rtl::OUString certHostName) + rtl::OUString hostName, uno::Sequence< ::rtl::OUString > certHostNames) { - if (hostName.equalsIgnoreAsciiCase( certHostName )) - return true; - - if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) && - hostName.getLength() >= certHostName.getLength() ) - { - rtl::OUString cmpStr = certHostName.copy( 1 ); - - if ( hostName.matchIgnoreAsciiCase( - cmpStr, hostName.getLength() - cmpStr.getLength()) ) - return true; + for ( int i = 0; i < certHostNames.getLength(); i++){ + ::rtl::OUString element = certHostNames[i]; + + if (element.getLength() == 0) + continue; + + if (hostName.equalsIgnoreAsciiCase( element )) + return true; + + if ( 0 == element.indexOf( rtl::OUString::createFromAscii( "*" ) ) && + hostName.getLength() >= element.getLength() ) + { + rtl::OUString cmpStr = element.copy( 1 ); + if ( hostName.matchIgnoreAsciiCase( + cmpStr, hostName.getLength() - cmpStr.getLength()) ) + return true; + } } return false; @@ -278,10 +293,34 @@ handleCertificateValidationRequest_( rRequest.Certificate ); } + uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = rRequest.Certificate->getExtensions(); + uno::Sequence< security::CertAltNameEntry > altNames; + for (sal_Int32 i = 0 ; i < extensions.getLength(); i++){ + uno::Reference< security::XCertificateExtension >element = extensions[i]; + + rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength()); + if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME)) + { + uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY ); + altNames = sanExtension->getAlternativeNames(); + break; + } + } + + ::rtl::OUString certHostName = getContentPart( rRequest.Certificate->getSubjectName() ); + uno::Sequence< ::rtl::OUString > certHostNames(altNames.getLength() + 1); + + certHostNames[0] = certHostName; + + for(int n = 1; n < altNames.getLength(); n++){ + if (altNames[n].Type == security::ExtAltNameType_DNS_NAME){ + altNames[n].Value >>= certHostNames[n]; + } + } + if ( (!isDomainMatch( rRequest.HostName, - getContentPart( - rRequest.Certificate->getSubjectName()) )) && + certHostNames )) && trustCert ) { trustCert = executeSSLWarnDialog( pParent, -- cgit From 521ff181344e8625fc613c2706fca9585b6aca38 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 7 Feb 2011 14:05:48 +0100 Subject: dr78: #i116848# Use multiplication instead of a large row number for empty sheets in ScDrawUtil::CalcScale --- sc/source/ui/view/drawutil.cxx | 9 +++++++++ sc/source/ui/view/drawvie4.cxx | 2 +- sc/source/ui/view/drawview.cxx | 2 +- sc/source/ui/view/gridwin3.cxx | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx index ba250767c169..dcc750229ef1 100644 --- a/sc/source/ui/view/drawutil.cxx +++ b/sc/source/ui/view/drawutil.cxx @@ -81,6 +81,15 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab, nPixelY += ScViewData::ToPixel(nHeight, nPPTY); } + // #i116848# To get a large-enough number for PixelToLogic, multiply the integer values + // instead of using a larger number of rows + long nMultiply = 2000000 / nTwipsY; + if ( nMultiply > 1 ) + { + nTwipsY *= nMultiply; + nPixelY *= nMultiply; + } + MapMode aHMMMode( MAP_100TH_MM, Point(), rZoomX, rZoomY ); Point aPixelLog = pDev->PixelToLogic( Point( nPixelX,nPixelY ), aHMMMode ); diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index d4c5d714b2ee..8b9debdabfae 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -283,7 +283,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; Fraction aZoom(1,1); ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom, diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 3307398b5ef8..77b1d3622b3a 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -377,7 +377,7 @@ void ScDrawView::RecalcScale() if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; // #i116848# instead of a large row number for an empty sheet, heights are multiplied in CalcScale ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev,aZoomX,aZoomY,nPPTX,nPPTY, aScaleX,aScaleY ); diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index cdb7e8acfba7..5bfc0483b553 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -265,7 +265,7 @@ MapMode ScGridWindow::GetDrawMapMode( BOOL bForce ) SCROW nEndRow = 0; pDoc->GetTableArea( nTab, nEndCol, nEndRow ); if (nEndCol<20) nEndCol = 20; - if (nEndRow<20) nEndRow = 1000; + if (nEndRow<20) nEndRow = 20; ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this, pViewData->GetZoomX(),pViewData->GetZoomY(), pViewData->GetPPTX(),pViewData->GetPPTY(), -- cgit From b90b51166447402d79e24ed214ec6b158a98d7d1 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 7 Feb 2011 14:29:07 +0100 Subject: dr78: #i116250# set app flag in ScGlobal::SetSearchItem --- sc/source/core/data/global.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 10aacc678d74..4c0156f8cabb 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -284,6 +284,7 @@ void ScGlobal::SetSearchItem( const SvxSearchItem& rNew ) pSearchItem = (SvxSearchItem*)rNew.Clone(); pSearchItem->SetWhich( SID_SEARCH_ITEM ); + pSearchItem->SetAppFlag( SVX_SEARCHAPP_CALC ); } void ScGlobal::ClearAutoFormat() -- cgit From b7869b0ce416ca376bc7dd4d9e40a94c59b72013 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 7 Feb 2011 15:06:16 +0100 Subject: dr78: #i116691# don't reduce decimals if formula is shown --- sc/source/ui/view/output2.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 79f95ee5e690..f0fafc060bab 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -532,9 +532,9 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) if (eType == CELLTYPE_FORMULA) { ScFormulaCell* pFCell = static_cast(pCell); - if (pFCell->GetErrCode() != 0) + if (pFCell->GetErrCode() != 0 || pOutput->bShowFormulas) { - SetHashText(); // If the error string doesn't fit, always use "###" + SetHashText(); // If the error string doesn't fit, always use "###". Also for "display formulas" (#i116691#) return; } // If it's formula, the result must be a value. -- cgit From 1bf5a41b79d7d5bd9421918ab7f918daf7f113a4 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 7 Feb 2011 16:01:36 +0100 Subject: dr78: #i115128# TransliterateText: use EditEngine to handle TITLE_CASE --- sc/source/core/data/documen8.cxx | 119 ++++++++++++++------------------------- 1 file changed, 43 insertions(+), 76 deletions(-) diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 9eb4bad7466d..b9f94a58906e 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -60,6 +60,8 @@ #include #include +#include + #include "inputopt.hxx" #include "global.hxx" #include "table.hxx" @@ -1489,57 +1491,6 @@ SfxBindings* ScDocument::GetViewBindings() //------------------------------------------------------------------------ -void lcl_TransliterateEditEngine( ScEditEngineDefaulter& rEngine, - utl::TransliterationWrapper& rTranslitarationWrapper, - BOOL bConsiderLanguage, ScDocument* pDoc ) -{ - //! should use TransliterateText method of EditEngine instead, when available! - - sal_uInt16 nLanguage = LANGUAGE_SYSTEM; - - USHORT nParCount = rEngine.GetParagraphCount(); - for (USHORT nPar=0; nParGetStringScriptType( aOldStr ); - USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_LANGUAGE_CJK : - ( ( nScript == SCRIPTTYPE_COMPLEX ) ? EE_CHAR_LANGUAGE_CTL : - EE_CHAR_LANGUAGE ); - nLanguage = ((const SvxLanguageItem&)aAttr.Get(nWhich)).GetValue(); - } - - com::sun::star::uno::Sequence aOffsets; - String aNewStr = rTranslitarationWrapper.transliterate( aOldStr, nLanguage, 0, aOldStr.Len(), &aOffsets ); - - if ( aNewStr != aOldStr ) - { - // replace string, keep attributes - - rEngine.QuickInsertText( aNewStr, aSel ); - aSel.nEndPos = aSel.nStartPos + aNewStr.Len(); - rEngine.QuickSetAttribs( aAttr, aSel ); - } - } - } - } -} - void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType ) { DBG_ASSERT( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" ); @@ -1566,28 +1517,13 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp const ScBaseCell* pCell = GetCell( ScAddress( nCol, nRow, nTab ) ); CellType eType = pCell ? pCell->GetCellType() : CELLTYPE_NONE; - if ( eType == CELLTYPE_STRING ) - { - String aOldStr; - ((const ScStringCell*)pCell)->GetString(aOldStr); - xub_StrLen nOldLen = aOldStr.Len(); + // #i115128# TITLE_CASE/SENTENCE_CASE need the extra handling in EditEngine (loop over words/sentences). + // Still use TransliterationWrapper directly for text cells with other transliteration types, + // for performance reasons. - if ( bConsiderLanguage ) - { - BYTE nScript = GetStringScriptType( aOldStr ); //! cell script type? - USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : - ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : - ATTR_FONT_LANGUAGE ); - nLanguage = ((const SvxLanguageItem*)GetAttr( nCol, nRow, nTab, nWhich ))->GetValue(); - } - - com::sun::star::uno::Sequence aOffsets; - String aNewStr = aTranslitarationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets ); - - if ( aNewStr != aOldStr ) - PutCell( nCol, nRow, nTab, new ScStringCell( aNewStr ) ); - } - else if ( eType == CELLTYPE_EDIT ) + if ( eType == CELLTYPE_EDIT || + ( eType == CELLTYPE_STRING && ( nType == com::sun::star::i18n::TransliterationModulesExtra::SENTENCE_CASE || + nType == com::sun::star::i18n::TransliterationModulesExtra::TITLE_CASE ) ) ) { if (!pEngine) pEngine = new ScFieldEditEngine( GetEnginePool(), GetEditPool() ); @@ -1598,12 +1534,22 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp pPattern->FillEditItemSet( pDefaults ); pEngine->SetDefaults( pDefaults, TRUE ); - const EditTextObject* pData = ((const ScEditCell*)pCell)->GetData(); - pEngine->SetText( *pData ); - + if ( eType == CELLTYPE_STRING ) + pEngine->SetText( static_cast(pCell)->GetString() ); + else + { + const EditTextObject* pData = static_cast(pCell)->GetData(); + pEngine->SetText( *pData ); + } pEngine->ClearModifyFlag(); - lcl_TransliterateEditEngine( *pEngine, aTranslitarationWrapper, bConsiderLanguage, this ); + USHORT nLastPar = pEngine->GetParagraphCount(); + if (nLastPar) + --nLastPar; + xub_StrLen nTxtLen = pEngine->GetTextLen(nLastPar); + ESelection aSelAll( 0, 0, nLastPar, nTxtLen ); + + pEngine->TransliterateText( aSelAll, nType ); if ( pEngine->IsModified() ) { @@ -1626,6 +1572,27 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp } } } + else if ( eType == CELLTYPE_STRING ) + { + String aOldStr; + ((const ScStringCell*)pCell)->GetString(aOldStr); + xub_StrLen nOldLen = aOldStr.Len(); + + if ( bConsiderLanguage ) + { + BYTE nScript = GetStringScriptType( aOldStr ); //! cell script type? + USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : + ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : + ATTR_FONT_LANGUAGE ); + nLanguage = ((const SvxLanguageItem*)GetAttr( nCol, nRow, nTab, nWhich ))->GetValue(); + } + + com::sun::star::uno::Sequence aOffsets; + String aNewStr = aTranslitarationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets ); + + if ( aNewStr != aOldStr ) + PutCell( nCol, nRow, nTab, new ScStringCell( aNewStr ) ); + } bFound = GetNextMarkedCell( nCol, nRow, nTab, rMultiMark ); } -- cgit From 6e9c88663c43ef94504648ab832f5a32ceac1dd9 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 7 Feb 2011 16:57:14 +0100 Subject: dr78: #i115009# broadcast BCA_BRDCST_ALWAYS if paint is locked --- sc/source/ui/docshell/docsh.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d92167a1244f..d3d5159c15b5 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2605,7 +2605,9 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ ) if ( pPaintLockData && bIsModified ) { - //! BCA_BRDCST_ALWAYS etc. also needed here? + // #i115009# broadcast BCA_BRDCST_ALWAYS, so a component can read recalculated results + // of RecalcModeAlways formulas (like OFFSET) after modifying cells + aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL ); aDocument.InvalidateTableArea(); // #i105279# needed here aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); -- cgit From 7a5084f1acacb0858588d4d0c82651e47ca9914f Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 7 Feb 2011 17:18:11 +0100 Subject: dr78: rework of stream handling, improve handling of very large streams (prevent loading entire stream into array or string, esp. dumper and VML import), full support of XComponentContext --- oox/inc/oox/core/contexthandler.hxx | 4 +- oox/inc/oox/core/fasttokenhandler.hxx | 4 +- oox/inc/oox/core/filterbase.hxx | 4 +- oox/inc/oox/core/fragmenthandler.hxx | 4 +- oox/inc/oox/drawingml/chart/converterbase.hxx | 1 - oox/inc/oox/dump/biffdumper.hxx | 5 +- oox/inc/oox/dump/dffdumper.hxx | 1 - oox/inc/oox/dump/dumperbase.hxx | 135 ++++++---- oox/inc/oox/dump/oledumper.hxx | 11 +- oox/inc/oox/dump/pptxdumper.hxx | 5 +- oox/inc/oox/dump/xlsbdumper.hxx | 4 +- oox/inc/oox/helper/binaryinputstream.hxx | 323 +++++++++++++++++------ oox/inc/oox/helper/binaryoutputstream.hxx | 86 ++++--- oox/inc/oox/helper/binarystreambase.hxx | 130 +++++++--- oox/inc/oox/helper/containerhelper.hxx | 6 +- oox/inc/oox/helper/graphichelper.hxx | 2 +- oox/inc/oox/helper/helper.hxx | 30 ++- oox/inc/oox/helper/modelobjecthelper.hxx | 6 +- oox/inc/oox/helper/propertyset.hxx | 8 +- oox/inc/oox/helper/textinputstream.hxx | 89 ++++++- oox/inc/oox/helper/zipstorage.hxx | 6 +- oox/inc/oox/ole/axbinaryreader.hxx | 16 +- oox/inc/oox/ole/oleobjecthelper.hxx | 2 +- oox/inc/oox/ole/olestorage.hxx | 10 +- oox/inc/oox/ole/vbacontrol.hxx | 2 +- oox/inc/oox/ole/vbainputstream.hxx | 17 +- oox/inc/oox/ole/vbamodule.hxx | 4 + oox/inc/oox/ole/vbaproject.hxx | 2 +- oox/inc/oox/vml/vmlinputstream.hxx | 66 +++-- oox/inc/oox/xls/biffhelper.hxx | 2 +- oox/inc/oox/xls/biffinputstream.hxx | 28 +- oox/inc/oox/xls/biffoutputstream.hxx | 32 +-- oox/inc/oox/xls/formulabase.hxx | 4 +- oox/inc/oox/xls/ooxformulaparser.hxx | 4 +- oox/inc/oox/xls/workbookhelper.hxx | 6 - oox/source/core/binaryfilterbase.cxx | 4 +- oox/source/core/contexthandler.cxx | 2 +- oox/source/core/filterdetect.cxx | 188 +++++++------- oox/source/core/fragmenthandler.cxx | 4 +- oox/source/core/xmlfilterbase.cxx | 4 +- oox/source/dump/biffdumper.cxx | 18 +- oox/source/dump/dumperbase.cxx | 358 ++++++++++++-------------- oox/source/dump/oledumper.cxx | 46 ++-- oox/source/dump/pptxdumper.cxx | 23 +- oox/source/dump/xlsbdumper.cxx | 29 +-- oox/source/helper/binaryinputstream.cxx | 179 +++++++------ oox/source/helper/binaryoutputstream.cxx | 73 +++--- oox/source/helper/binarystreambase.cxx | 63 +++-- oox/source/helper/containerhelper.cxx | 15 +- oox/source/helper/graphichelper.cxx | 11 +- oox/source/helper/modelobjecthelper.cxx | 11 +- oox/source/helper/propertyset.cxx | 20 ++ oox/source/helper/textinputstream.cxx | 223 +++++++++++----- oox/source/helper/zipstorage.cxx | 25 +- oox/source/ole/axbinaryreader.cxx | 57 ++-- oox/source/ole/axcontrol.cxx | 12 +- oox/source/ole/axcontrolfragment.cxx | 2 +- oox/source/ole/oleobjecthelper.cxx | 18 +- oox/source/ole/olestorage.cxx | 59 ++--- oox/source/ole/vbacontrol.cxx | 12 +- oox/source/ole/vbainputstream.cxx | 51 ++-- oox/source/ole/vbamodule.cxx | 6 +- oox/source/ole/vbaproject.cxx | 27 +- oox/source/vml/vmldrawing.cxx | 4 +- oox/source/vml/vmldrawingfragment.cxx | 3 +- oox/source/vml/vmlinputstream.cxx | 300 +++++++++++++-------- oox/source/vml/vmlshape.cxx | 5 +- oox/source/vml/vmltextboxcontext.cxx | 27 +- oox/source/xls/addressconverter.cxx | 4 +- oox/source/xls/biffdetector.cxx | 7 +- oox/source/xls/biffhelper.cxx | 15 +- oox/source/xls/biffinputstream.cxx | 137 ++++------ oox/source/xls/biffoutputstream.cxx | 92 +++---- oox/source/xls/drawingmanager.cxx | 3 +- oox/source/xls/excelchartconverter.cxx | 4 +- oox/source/xls/formulabase.cxx | 20 +- oox/source/xls/formulaparser.cxx | 2 +- oox/source/xls/numberformatsbuffer.cxx | 2 +- oox/source/xls/ooxformulaparser.cxx | 20 +- oox/source/xls/pagesettings.cxx | 3 +- oox/source/xls/pivotcachebuffer.cxx | 2 +- oox/source/xls/viewsettings.cxx | 4 +- oox/source/xls/workbookfragment.cxx | 2 +- oox/source/xls/workbookhelper.cxx | 10 - oox/source/xls/workbooksettings.cxx | 2 +- oox/source/xls/worksheethelper.cxx | 4 +- 86 files changed, 1903 insertions(+), 1368 deletions(-) diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx index b1f24d051c70..0242ee023589 100644 --- a/oox/inc/oox/core/contexthandler.hxx +++ b/oox/inc/oox/core/contexthandler.hxx @@ -57,9 +57,9 @@ typedef ::rtl::Reference< ContextHandler > ContextHandlerRef; struct FragmentBaseData; typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef; -typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandlerImplBase; +typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE; -class ContextHandler : public ContextHandlerImplBase +class ContextHandler : public ContextHandler_BASE { public: explicit ContextHandler( ContextHandler& rParent ); diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx index a6c73de9842b..c85bfda085f9 100644 --- a/oox/inc/oox/core/fasttokenhandler.hxx +++ b/oox/inc/oox/core/fasttokenhandler.hxx @@ -39,12 +39,12 @@ namespace core { // ============================================================================ -typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandlerBase; +typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE; /** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface that provides access to the tokens generated from the internal token name list. */ -class FastTokenHandler : public FastTokenHandlerBase +class FastTokenHandler : public FastTokenHandler_BASE { public: explicit FastTokenHandler(); diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx index 80dc233491d4..839eec165974 100644 --- a/oox/inc/oox/core/filterbase.hxx +++ b/oox/inc/oox/core/filterbase.hxx @@ -87,9 +87,9 @@ typedef ::cppu::WeakImplHelper5< ::com::sun::star::document::XImporter, ::com::sun::star::document::XExporter, ::com::sun::star::document::XFilter > - FilterBaseBase; + FilterBase_BASE; -class OOX_DLLPUBLIC FilterBase : public FilterBaseBase, public ::cppu::BaseMutex +class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex { public: explicit FilterBase( diff --git a/oox/inc/oox/core/fragmenthandler.hxx b/oox/inc/oox/core/fragmenthandler.hxx index ba3164a74da8..f9c32a8814dd 100644 --- a/oox/inc/oox/core/fragmenthandler.hxx +++ b/oox/inc/oox/core/fragmenthandler.hxx @@ -81,9 +81,9 @@ struct RecordInfo // ============================================================================ -typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandlerImplBase; +typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE; -class FragmentHandler : public FragmentHandlerImplBase +class FragmentHandler : public FragmentHandler_BASE { public: explicit FragmentHandler( XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath ); diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index aec646d4c610..95affa5eb643 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -34,7 +34,6 @@ namespace com { namespace sun { namespace star { namespace awt { struct Rectangle; } namespace awt { struct Size; } - namespace lang { class XMultiServiceFactory; } namespace chart2 { class XChartDocument; } namespace chart2 { class XTitle; } namespace drawing { class XShape; } diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx index a3bdc4a87c73..8e90e362eff1 100644 --- a/oox/inc/oox/dump/biffdumper.hxx +++ b/oox/inc/oox/dump/biffdumper.hxx @@ -530,7 +530,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -554,7 +554,7 @@ public: explicit Dumper( const ::oox::core::FilterBase& rFilter ); explicit Dumper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, const ::rtl::OUString& rSysFileName ); @@ -571,4 +571,3 @@ protected: #endif #endif - diff --git a/oox/inc/oox/dump/dffdumper.hxx b/oox/inc/oox/dump/dffdumper.hxx index f229c19eff8c..93868b29e5a7 100644 --- a/oox/inc/oox/dump/dffdumper.hxx +++ b/oox/inc/oox/dump/dffdumper.hxx @@ -79,4 +79,3 @@ private: #endif #endif - diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx index d9acaa1f1011..4b10a1b25324 100644 --- a/oox/inc/oox/dump/dumperbase.hxx +++ b/oox/inc/oox/dump/dumperbase.hxx @@ -49,10 +49,9 @@ namespace com { namespace sun { namespace star { namespace io { class XInputStream; } - namespace io { class XTextInputStream; } namespace io { class XOutputStream; } namespace io { class XTextOutputStream; } - namespace lang { class XMultiServiceFactory; } + namespace uno { class XComponentContext; } } } } namespace comphelper { @@ -123,44 +122,47 @@ public: // input streams ---------------------------------------------------------- - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > - getXInputStream( BinaryInputStream& rStrm ); - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > openInputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& rFileName ); - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > - openTextInputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, - const ::rtl::OUString& rEncoding ); - - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > - openTextInputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::rtl::OUString& rFileName, - const ::rtl::OUString& rEncoding ); - // output streams --------------------------------------------------------- static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > openOutputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& rFileName ); static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > openTextOutputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm, - const ::rtl::OUString& rEncoding ); + rtl_TextEncoding eTextEnc ); static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > openTextOutputStream( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& rFileName, - const ::rtl::OUString& rEncoding ); + rtl_TextEncoding eTextEnc ); +}; + +// ============================================================================ + +class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef +{ +public: + inline BinaryInputStreamRef() {} + + inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) : + ::oox::BinaryInputStreamRef( pInStrm ) {} + + inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) : + ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {} + + template< typename StreamType > + inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) : + ::oox::BinaryInputStreamRef( rxInStrm ) {} }; // ============================================================================ @@ -550,7 +552,9 @@ typedef ::boost::shared_ptr< Base > BaseRef; | | | +----> BinaryStreamObject | | - | +----> TextStreamObject + | +----> TextStreamObjectBase + | | | + | | +----> TextStreamObject | | | | | +----> XmlStreamObject | | @@ -890,14 +894,14 @@ class SharedConfigData : public Base, public ConfigItemBase public: explicit SharedConfigData( const ::rtl::OUString& rFileName, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const StorageRef& rxRootStrg, const ::rtl::OUString& rSysFileName, ::comphelper::MediaDescriptor& rMediaDesc ); virtual ~SharedConfigData(); - inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxFactory; } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; } inline const StorageRef& getRootStorage() const { return mxRootStrg; } inline const ::rtl::OUString& getSysFileName() const { return maSysFileName; } @@ -932,7 +936,7 @@ private: typedef ::std::map< ::rtl::OUString, ::rtl::OUString > ConfigDataMap; typedef ::std::map< ::rtl::OUString, NameListRef > NameListMap; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; StorageRef mxRootStrg; ::rtl::OUString maSysFileName; ::comphelper::MediaDescriptor& mrMediaDesc; @@ -977,14 +981,14 @@ public: const ::oox::core::FilterBase& rFilter ); explicit Config( const sal_Char* pcEnvVar, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const StorageRef& rxRootStrg, const ::rtl::OUString& rSysFileName, ::comphelper::MediaDescriptor& rMediaDesc ); virtual ~Config(); - inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxCfgData->getFactory(); } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); } inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); } inline const ::rtl::OUString& getSysFileName() const { return mxCfgData->getSysFileName(); } @@ -1022,7 +1026,7 @@ protected: const ::oox::core::FilterBase& rFilter ); void construct( const sal_Char* pcEnvVar, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const StorageRef& rxRootStrg, const ::rtl::OUString& rSysFileName, ::comphelper::MediaDescriptor& rMediaDesc ); @@ -1076,10 +1080,7 @@ class Output : public Base { public: explicit Output( - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm ); - - explicit Output( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& rFileName ); // ------------------------------------------------------------------------ @@ -1152,8 +1153,6 @@ public: // ------------------------------------------------------------------------ protected: - void construct( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm ); - virtual bool implIsValid() const; private: @@ -1279,8 +1278,8 @@ class ObjectBase : public Base public: virtual ~ObjectBase(); - inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - getFactory() const { return mxConfig->getFactory(); } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& + getContext() const { return mxConfig->getContext(); } void dump(); @@ -1323,7 +1322,7 @@ protected: virtual void implDump(); virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -1394,7 +1393,6 @@ protected: using ObjectBase::construct; void construct( const ObjectBase& rParent, const ::rtl::OUString& rSysFileName ); - void construct( const ObjectBase& rParent, const OutputRef& rxOut ); void construct( const OutputObjectBase& rParent ); virtual bool implIsValid() const; @@ -1453,6 +1451,7 @@ protected: protected: OutputRef mxOut; + ::rtl::OUString maSysFileName; }; typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef; @@ -1578,7 +1577,6 @@ protected: using OutputObjectBase::construct; void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName ); - void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut ); void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm ); void construct( const InputObjectBase& rParent ); @@ -1804,47 +1802,77 @@ protected: virtual void implDump(); }; +// ============================================================================ // ============================================================================ -class TextStreamObject : public InputObjectBase +class TextStreamObjectBase : public InputObjectBase { -public: - explicit TextStreamObject( +protected: + inline TextStreamObjectBase() {} + + using InputObjectBase::construct; + void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const ::rtl::OUString& rSysFileName ); - - explicit TextStreamObject( + void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc ); + void construct( + const InputObjectBase& rParent, + rtl_TextEncoding eTextEnc ); -protected: virtual bool implIsValid() const; virtual void implDump(); - virtual void implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine ); + + virtual void implDumpText( TextInputStream& rTextStrm ) = 0; private: + void constructTextStrmObj( rtl_TextEncoding eTextEnc ); + +protected: ::boost::shared_ptr< TextInputStream > mxTextStrm; }; // ============================================================================ -class XmlStreamObject : public TextStreamObject +class TextLineStreamObject : public TextStreamObjectBase { public: - explicit XmlStreamObject( + explicit TextLineStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, + rtl_TextEncoding eTextEnc, const ::rtl::OUString& rSysFileName ); + explicit TextLineStreamObject( + const OutputObjectBase& rParent, + const BinaryInputStreamRef& rxStrm, + rtl_TextEncoding eTextEnc ); + protected: - virtual void implDump(); + virtual void implDumpText( TextInputStream& rTextStrm ); virtual void implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine ); +}; -private: - ::rtl::OUString maIncompleteLine; +// ============================================================================ + +class XmlStreamObject : public TextStreamObjectBase +{ +public: + explicit XmlStreamObject( + const ObjectBase& rParent, + const BinaryInputStreamRef& rxStrm, + const ::rtl::OUString& rSysFileName ); + + explicit XmlStreamObject( + const OutputObjectBase& rParent, + const BinaryInputStreamRef& rxStrm ); + +protected: + virtual void implDumpText( TextInputStream& rTextStrm ); }; // ============================================================================ @@ -1976,4 +2004,3 @@ do { \ #endif // OOX_INCLUDE_DUMPER #endif - diff --git a/oox/inc/oox/dump/oledumper.hxx b/oox/inc/oox/dump/oledumper.hxx index 8f706f4c40f1..ac59f0efcc68 100644 --- a/oox/inc/oox/dump/oledumper.hxx +++ b/oox/inc/oox/dump/oledumper.hxx @@ -180,7 +180,7 @@ protected: void construct( const ObjectBase& rParent ); virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -762,7 +762,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -857,7 +857,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -879,7 +879,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -897,7 +897,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -936,4 +936,3 @@ protected: #endif #endif - diff --git a/oox/inc/oox/dump/pptxdumper.hxx b/oox/inc/oox/dump/pptxdumper.hxx index 535c7ceadc36..acfa08244552 100644 --- a/oox/inc/oox/dump/pptxdumper.hxx +++ b/oox/inc/oox/dump/pptxdumper.hxx @@ -45,7 +45,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -59,7 +59,7 @@ public: explicit Dumper( const ::oox::core::FilterBase& rFilter ); explicit Dumper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, const ::rtl::OUString& rSysFileName ); @@ -75,4 +75,3 @@ protected: #endif #endif - diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx index 6fa1c9bd7e45..606af8c1cc6b 100644 --- a/oox/inc/oox/dump/xlsbdumper.hxx +++ b/oox/inc/oox/dump/xlsbdumper.hxx @@ -225,7 +225,7 @@ public: protected: virtual void implDumpStream( - const BinaryInputStreamRef& rxStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm, const ::rtl::OUString& rStrgPath, const ::rtl::OUString& rStrmName, const ::rtl::OUString& rSysFileName ); @@ -239,7 +239,7 @@ public: explicit Dumper( const ::oox::core::FilterBase& rFilter ); explicit Dumper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, const ::rtl::OUString& rSysFileName ); diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx index 52a3a4de9f0f..052c7920b05d 100644 --- a/oox/inc/oox/helper/binaryinputstream.hxx +++ b/oox/inc/oox/helper/binaryinputstream.hxx @@ -28,10 +28,14 @@ #ifndef OOX_HELPER_BINARYINPUTSTREAM_HXX #define OOX_HELPER_BINARYINPUTSTREAM_HXX -#include +#include #include #include "oox/helper/binarystreambase.hxx" +namespace com { namespace sun { namespace star { + namespace io { class XInputStream; } +} } } + namespace oox { class BinaryOutputStream; @@ -46,24 +50,51 @@ class BinaryInputStream : public virtual BinaryStreamBase { public: /** Derived classes implement reading nBytes bytes to the passed sequence. - @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ) = 0; - /** Derived classes implement reading nBytes bytes to the (existing) buffer opMem. - @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ) = 0; + The sequence will be reallocated internally. + + @param nAtomSize + The size of the elements in the memory block, if available. Derived + classes may be interested in this information. + + @return + Number of bytes really read. + */ + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0; + + /** Derived classes implement reading nBytes bytes to the (preallocated!) + memory buffer opMem. + + @param nAtomSize + The size of the elements in the memory block, if available. Derived + classes may be interested in this information. + + @return + Number of bytes really read. + */ + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0; + /** Derived classes implement seeking the stream forward by the passed - number of bytes. This should work for non-seekable streams too. */ - virtual void skip( sal_Int32 nBytes ) = 0; + number of bytes. This should work for non-seekable streams too. + + @param nAtomSize + The size of the elements in the memory block, if available. Derived + classes may be interested in this information. + */ + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0; /** Reads a value from the stream and converts it to platform byte order. - Supported types: SAL integers (8 to 64 bit), float, double. */ + All data types supported by the ByteOrderConverter class can be used. + */ template< typename Type > void readValue( Type& ornValue ); + /** Reads a value from the stream and converts it to platform byte order. - Supported types: SAL integers (8 to 64 bit), float, double. */ + All data types supported by the ByteOrderConverter class can be used. + */ template< typename Type > inline Type readValue() { Type nValue; readValue( nValue ); return nValue; } - /** Stream operator for integral and floating-point types. */ + + /** Stream operator for all data types supported by the readValue() function. */ template< typename Type > inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } @@ -78,46 +109,135 @@ public: inline float readFloat() { return readValue< float >(); } inline double readDouble() { return readValue< double >(); } - /** Reads a NUL-terminated byte character array and returns the string. */ + /** Reads a (preallocated!) C array of values from the stream. + + Converts all values in the array to platform byte order. All data types + supported by the ByteOrderConverter class can be used. + + @param nElemCount + Number of array elements to read (NOT byte count). + + @return + Number of array elements really read (NOT byte count). + */ + template< typename Type > + sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount ); + + /** Reads a sequence of values from the stream. + + The sequence will be reallocated internally. Converts all values in the + array to platform byte order. All data types supported by the + ByteOrderConverter class can be used. + + @param nElemCount + Number of elements to put into the sequence (NOT byte count). + + @return + Number of sequence elements really read (NOT byte count). + */ + template< typename Type > + sal_Int32 readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount ); + + /** Reads a vector of values from the stream. + + The vector will be resized internally. Converts all values in the + vector to platform byte order. All data types supported by the + ByteOrderConverter class can be used. + + @param nElemCount + Number of elements to put into the vector (NOT byte count). + + @return + Number of vector elements really read (NOT byte count). + */ + template< typename Type > + sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount ); + + /** Skips an array of values of a certain type in the stream. + + All data types supported by the ByteOrderConverter class can be used. + + @param nElemCount + Number of array elements to skip (NOT byte count). + */ + template< typename Type > + void skipArray( sal_Int32 nElemCount ); + + /** Reads a NUL-terminated byte character array and returns the string. + */ ::rtl::OString readNulCharArray(); /** Reads a NUL-terminated byte character array and returns a Unicode string. - @param eTextEnc The text encoding used to create the Unicode string. */ + + @param eTextEnc + The text encoding used to create the Unicode string. + */ ::rtl::OUString readNulCharArrayUC( rtl_TextEncoding eTextEnc ); - /** Reads a NUL-terminated Unicode character array and returns the string. */ + /** Reads a NUL-terminated Unicode character array and returns the string. + */ ::rtl::OUString readNulUnicodeArray(); - /** Reads nChar byte characters and returns the string. - @param nChars Number of characters (bytes) to read from the stream. + /** Reads a byte character array and returns the string. + + @param nChars + Number of characters (bytes) to read from the stream. + @param bAllowNulChars True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). */ + False = NUL characters are replaced by question marks (default). + */ ::rtl::OString readCharArray( sal_Int32 nChars, bool bAllowNulChars = false ); - /** Reads nChar byte characters and returns a Unicode string. - @param nChars Number of characters (bytes) to read from the stream. - @param eTextEnc The text encoding used to create the Unicode string. + /** Reads a byte character array and returns a Unicode string. + + @param nChars + Number of characters (bytes) to read from the stream. + + @param eTextEnc + The text encoding used to create the Unicode string. + @param bAllowNulChars True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). */ + False = NUL characters are replaced by question marks (default). + */ ::rtl::OUString readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false ); - /** Reads nChars Unicode characters and returns the string. - @param nChars Number of 16-bit characters to read from the stream. + /** Reads a Unicode character array and returns the string. + + @param nChars + Number of 16-bit characters to read from the stream. + @param bAllowNulChars True = NUL characters are inserted into the imported string. - False = NUL characters are replaced by question marks (default). */ + False = NUL characters are replaced by question marks (default). + */ ::rtl::OUString readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars = false ); - /** Copies nBytes bytes from the current position to the passed output stream. */ - void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64 ); + /** Reads a Unicode character array (may be compressed) and returns the + string. -private: - /** Used by the readValue() template functions to read built-in types. - @descr Derived classes may overwrite this default implementation which - simply calls readMemory() with something own. */ - virtual void readAtom( void* opMem, sal_uInt8 nSize ); + @param nChars + Number of 8-bit or 16-bit characters to read from the stream. + + @param bCompressed + True = Character array is compressed (stored as 8-bit characters). + False = Character array is not compressed (stored as 16-bit characters). + + @param bAllowNulChars + True = NUL characters are inserted into the imported string. + False = NUL characters are replaced by question marks (default). + */ + ::rtl::OUString readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars = false ); + + /** Copies nBytes bytes from the current position to the passed output stream. + */ + void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 ); + +protected: + /** This dummy default c'tor will never call the c'tor of the virtual base + class BinaryStreamBase as this class cannot be instanciated directly. */ + inline explicit BinaryInputStream() : BinaryStreamBase( false ) {} }; typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef; @@ -127,14 +247,47 @@ typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef; template< typename Type > void BinaryInputStream::readValue( Type& ornValue ) { - // can be instanciated for all types supported in class ByteOrderConverter - readAtom( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ) ); + readMemory( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) ); ByteOrderConverter::convertLittleEndian( ornValue ); } +template< typename Type > +sal_Int32 BinaryInputStream::readArray( Type* opnArray, sal_Int32 nElemCount ) +{ + sal_Int32 nRet = 0; + if( !mbEof ) + { + sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type ); + nRet = readMemory( opnArray, nReadSize, sizeof( Type ) ) / sizeof( Type ); + ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nRet ) ); + } + return nRet; +} + +template< typename Type > +sal_Int32 BinaryInputStream::readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount ) +{ + orSequence.reallocate( nElemCount ); + return orSequence.hasElements() ? readArray( orSequence.getArray(), nElemCount ) : 0; +} + +template< typename Type > +sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount ) +{ + orVector.resize( static_cast< size_t >( nElemCount ) ); + return orVector.empty() ? 0 : readArray( &orVector.front(), nElemCount ); +} + +template< typename Type > +void BinaryInputStream::skipArray( sal_Int32 nElemCount ) +{ + sal_Int32 nSkipSize = getLimitedValue< sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type ); + implSkip( nSkipSize, sizeof( Type ) ); +} + // ============================================================================ -/** Wraps a com.sun.star.io.XInputStream and provides convenient access functions. +/** Wraps a UNO input stream and provides convenient access functions. The binary data in the stream is assumed to be in little-endian format. */ @@ -143,10 +296,13 @@ class BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStrea public: /** Constructs the wrapper object for the passed input stream. - @param rxInStream The com.sun.star.io.XInputStream interface of the - input stream to be wrapped. - @param bAutoClose True = automatically close the wrapped input stream - on destruction of this wrapper. + @param rxInStream + The com.sun.star.io.XInputStream interface of the UNO input stream + to be wrapped. + + @param bAutoClose + True = automatically close the wrapped input stream on destruction + of this wrapper or when close() is called. */ explicit BinaryXInputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, @@ -154,26 +310,26 @@ public: virtual ~BinaryXInputStream(); + /** Closes the input stream. Does also close the wrapped UNO input stream + if bAutoClose has been set to true in the constructor. */ + virtual void close(); + /** Reads nBytes bytes to the passed sequence. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Reads nBytes bytes to the (existing) buffer opMem. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Seeks the stream forward by the passed number of bytes. This works for non-seekable streams too. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Stream operator for all data types supported by the readValue() function. */ template< typename Type > inline BinaryXInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } - /** Returns the XInputStream interface of the wrapped input stream. */ - inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > - getXInputStream() const { return mxInStrm; } - /** Closes the wrapped XInputStream. */ - void close(); - private: StreamDataSequence maBuffer; /// Data buffer used in readMemory() function. ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > @@ -181,8 +337,6 @@ private: bool mbAutoClose; /// True = automatically close stream on destruction. }; -typedef ::boost::shared_ptr< BinaryXInputStream > BinaryXInputStreamRef; - // ============================================================================ /** Wraps a StreamDataSequence and provides convenient access functions. @@ -203,86 +357,97 @@ public: /** Reads nBytes bytes to the passed sequence. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Reads nBytes bytes to the (existing) buffer opMem. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Seeks the stream forward by the passed number of bytes. This works for non-seekable streams too. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Stream operator for all data types supported by the readValue() function. */ template< typename Type > inline SequenceInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } -}; -typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef; +private: + /** Returns the number of bytes available in the sequence for the passed byte count. */ + inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const + { return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); } +}; // ============================================================================ /** Wraps a BinaryInputStream and provides access to a specific part of the stream data. - @descr - Provides access to the stream data block starting at the current - position of the stream, and with a specific length. If the wrapped - stream is seekable, this wrapper will treat the position the wrapped - has at construction time as position "0" (therefore the class name). + Provides access to the stream data block starting at the current position + of the stream, and with a specific length. If the wrapped stream is + seekable, this wrapper will treat the position of the wrapped stream at + construction time as position "0" (therefore the class name). + + The passed input stream MUST live at least as long as this stream wrapper. + The stream MUST NOT be changed from outside as long as this stream wrapper + is used to read from it. */ class RelativeInputStream : public BinaryInputStream { public: /** Constructs the wrapper object for the passed stream. - @attention - The passed input stream MUST live at least as long as this stream - wrapper. The stream MUST NOT be changed from outside as long as - this stream wrapper is used to read from it. - - @param nLength + @param nSize If specified, restricts the amount of data that can be read from the passed input stream. */ explicit RelativeInputStream( BinaryInputStream& rInStrm, - sal_Int64 nLength = SAL_MAX_INT64 ); + sal_Int64 nSize = SAL_MAX_INT64 ); - /** Returns whether the wrapped stream is seekable. */ - virtual bool isSeekable() const; /** Returns the size of the data block in the wrapped stream offered by this wrapper. */ - virtual sal_Int64 getLength() const; + virtual sal_Int64 size() const; + /** Returns the current relative stream position. */ virtual sal_Int64 tell() const; + /** Seeks the stream to the passed relative position, if the wrapped stream is seekable. */ virtual void seek( sal_Int64 nPos ); + /** Closes the input stream but not the wrapped stream. */ + virtual void close(); + /** Reads nBytes bytes to the passed sequence. Does not read out of the data block whose size has been specified on construction. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of the data block whose size has been specified on construction. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); + /** Seeks the stream forward by the passed number of bytes. This works for non-seekable streams too. Does not seek out of the data block. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Stream operator for all data types supported by the readValue() function. */ template< typename Type > inline RelativeInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; } private: - BinaryInputStream& mrInStrm; + /** Returns the number of bytes available in the sequence for the passed byte count. */ + inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const + { return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); } + +private: + BinaryInputStream* mpInStrm; sal_Int64 mnStartPos; sal_Int64 mnRelPos; - sal_Int64 mnLength; + sal_Int64 mnSize; }; -typedef ::boost::shared_ptr< RelativeInputStream > RelativeInputStreamRef; - // ============================================================================ } // namespace oox diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx index e24777c4f296..362c7fbdea87 100644 --- a/oox/inc/oox/helper/binaryoutputstream.hxx +++ b/oox/inc/oox/helper/binaryoutputstream.hxx @@ -28,10 +28,12 @@ #ifndef OOX_HELPER_BINARYOUTPUTSTREAM_HXX #define OOX_HELPER_BINARYOUTPUTSTREAM_HXX -#include -#include #include "oox/helper/binarystreambase.hxx" +namespace com { namespace sun { namespace star { + namespace io { class XOutputStream; } +} } } + namespace oox { // ============================================================================ @@ -43,24 +45,38 @@ namespace oox { class BinaryOutputStream : public virtual BinaryStreamBase { public: - /** Derived classes implement writing the passed data sequence. */ - virtual void writeData( const StreamDataSequence& rData ) = 0; - /** Derived classes implement writing from the (existing) buffer pMem. */ - virtual void writeMemory( const void* pMem, sal_Int32 nBytes ) = 0; + /** Derived classes implement writing the contents of the passed data + sequence. + + @param nAtomSize + The size of the elements in the memory block, if available. Derived + classes may be interested in this information. + */ + virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) = 0; + + /** Derived classes implement writing the contents of the (preallocated!) + memory buffer pMem. + + @param nAtomSize + The size of the elements in the memory block, if available. Derived + classes may be interested in this information. + */ + virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0; /** Writes a value to the stream and converts it to platform byte order. - Supported types: SAL integers (8 to 64 bit), float, double. */ + All data types supported by the ByteOrderConverter class can be used. + */ template< typename Type > void writeValue( Type nValue ); - /** Stream operator for integral and floating-point types. */ + + /** Stream operator for all data types supported by the writeValue() function. */ template< typename Type > inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } -private: - /** Used by the writeValue() template function to write built-in types. - @descr Derived classes may overwrite this default implementation which - simply calls writeMemory() with something own. */ - virtual void writeAtom( const void* pMem, sal_uInt8 nSize ); +protected: + /** This dummy default c'tor will never call the c'tor of the virtual base + class BinaryStreamBase as this class cannot be instanciated directly. */ + inline explicit BinaryOutputStream() : BinaryStreamBase( false ) {} }; typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef; @@ -70,14 +86,13 @@ typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef; template< typename Type > void BinaryOutputStream::writeValue( Type nValue ) { - // can be instanciated for all types supported in class ByteOrderConverter ByteOrderConverter::convertLittleEndian( nValue ); - writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ) ); + writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) ); } // ============================================================================ -/** Wraps a com.sun.star.io.XOutputStream and provides convenient access functions. +/** Wraps a UNO output stream and provides convenient access functions. The binary data in the stream is written in little-endian format. */ @@ -86,10 +101,13 @@ class BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStr public: /** Constructs the wrapper object for the passed output stream. - @param rxOutStream The com.sun.star.io.XOutputStream interface of the - output stream to be wrapped. - @param bAutoClose True = automatically close the wrapped output stream - on destruction of this wrapper. + @param rxOutStream + The com.sun.star.io.XOutputStream interface of the output stream to + be wrapped. + + @param bAutoClose + True = automatically close the wrapped output stream on destruction + of this wrapper or when close() is called. */ explicit BinaryXOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm, @@ -97,20 +115,23 @@ public: virtual ~BinaryXOutputStream(); + /** Flushes and closes the output stream. Does also close the wrapped UNO + output stream if bAutoClose has been set to true in the constructor. */ + void close(); + /** Writes the passed data sequence. */ - virtual void writeData( const StreamDataSequence& rData ); - /** Write nBytes bytes from the (existing) buffer pMem. */ - virtual void writeMemory( const void* pMem, sal_Int32 nBytes ); + virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ); + + /** Write nBytes bytes from the (preallocated!) buffer pMem. */ + virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Stream operator for all data types supported by the writeValue() function. */ template< typename Type > inline BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } /** Returns the XOutputStream interface of the wrapped output stream. */ inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getXOutputStream() const { return mxOutStrm; } - /** Flushes and closes the wrapped XOutputStream. */ - void close(); private: StreamDataSequence maBuffer; /// Data buffer used in writeMemory() function. @@ -119,8 +140,6 @@ private: bool mbAutoClose; /// True = automatically close stream on destruction. }; -typedef ::boost::shared_ptr< BinaryXOutputStream > BinaryXOutputStreamRef; - // ============================================================================ /** Wraps a StreamDataSequence and provides convenient access functions. @@ -142,17 +161,16 @@ public: explicit SequenceOutputStream( StreamDataSequence& rData ); /** Writes the passed data sequence. */ - virtual void writeData( const StreamDataSequence& rData ); - /** Write nBytes bytes from the (existing) buffer pMem. */ - virtual void writeMemory( const void* pMem, sal_Int32 nBytes ); + virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Write nBytes bytes from the (preallocated!) buffer pMem. */ + virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); + + /** Stream operator for all data types supported by the writeValue() function. */ template< typename Type > inline SequenceOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } }; -typedef ::boost::shared_ptr< SequenceOutputStream > SequenceOutputStreamRef; - // ============================================================================ } // namespace oox diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx index ba0f34b21f40..0088b29208b0 100644 --- a/oox/inc/oox/helper/binarystreambase.hxx +++ b/oox/inc/oox/helper/binarystreambase.hxx @@ -29,75 +29,123 @@ #define OOX_HELPER_BINARYSTREAMBASE_HXX #include -#include +#include #include "oox/helper/helper.hxx" +namespace com { namespace sun { namespace star { + namespace io { class XSeekable; } +} } } + namespace oox { typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence; // ============================================================================ -/** Base interface for binary stream classes. Implemenetations may or may not - support seeking the stream. */ +/** Base class for binary stream classes. + */ class BinaryStreamBase { public: virtual ~BinaryStreamBase(); - /** Derived classes return whether the stream is seekable. Default: false. */ - virtual bool isSeekable() const; - /** Derived classes return the size of the stream, if possible, - otherwise/default: -1. May return something for unseekable streams. */ - virtual sal_Int64 getLength() const; - /** Derived classes return the current stream position, if possible, - otherwise/default: -1. May return something for unseekable streams. */ - virtual sal_Int64 tell() const; - /** Derived classes implement seeking the stream to the passed position, if - the stream is seekable. */ - virtual void seek( sal_Int64 nPos ); + /** Implementations return the size of the stream, if possible. + + This function may be implemented for some types of unseekable streams, + and MUST be implemented for all seekable streams. + + @return + The size of the stream in bytes, or -1, if not implemented. + */ + virtual sal_Int64 size() const = 0; + + /** Implementations return the current stream position, if possible. + + This function may be implemented for some types of unseekable streams, + and MUST be implemented for all seekable streams. + + @return + The current position in the stream, or -1, if not implemented. + */ + virtual sal_Int64 tell() const = 0; + + /** Implementations seek the stream to the passed position, if + the stream is seekable. + */ + virtual void seek( sal_Int64 nPos ) = 0; + + /** Implementations close the stream. + */ + virtual void close() = 0; + + /** Returns true, if the implementation supports the seek() operation. + + Implementations may still implement size() and tell() even if the + stream is not seekable. + */ + inline bool isSeekable() const { return mbSeekable; } /** Returns true, if the stream position is invalid (EOF). This flag turns - true *after* the first attempt to seek/read beyond the stream end. */ + true *after* the first attempt to seek/read beyond the stream end. + */ inline bool isEof() const { return mbEof; } - /** Returns the size of the remaining data, if stream is seekable, otherwise -1. */ + /** Returns the size of the remaining data available in the stream, if + stream supports size() and tell(), otherwise -1. + */ sal_Int64 getRemaining() const; - /** Seeks the stream to the beginning, if stream is seekable. */ + + /** Seeks the stream to the beginning, if stream is seekable. + */ inline void seekToStart() { seek( 0 ); } - /** Seeks the stream to the end, if stream is seekable. */ - inline void seekToEnd() { seek( getLength() ); } + + /** Seeks the stream to the end, if stream is seekable. + */ + inline void seekToEnd() { seek( size() ); } + /** Seeks the stream forward to a position that is a multiple of the passed - block size, relative to the passed stream position, if stream is seekable. */ + block size, if stream is seekable. + + @param nBlockSize + The size of the data blocks the streams needs to be aligned to. + + @param nAnchorPos + Position in the stream the data blocks are aligned to. + */ void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos = 0 ); protected: - inline explicit BinaryStreamBase() : mbEof( false ) {} + inline explicit BinaryStreamBase( bool bSeekable ) : mbEof( false ), mbSeekable( bSeekable ) {} private: BinaryStreamBase( const BinaryStreamBase& ); BinaryStreamBase& operator=( const BinaryStreamBase& ); protected: - bool mbEof; + bool mbEof; /// End of stream flag. + +private: + const bool mbSeekable; /// True = implementation supports seeking. }; // ============================================================================ -/** Base class for binary input and output streams wrapping an API stream, +/** Base class for binary input and output streams wrapping a UNO stream, seekable via the com.sun.star.io.XSeekable interface. */ class BinaryXSeekableStream : public virtual BinaryStreamBase { public: - /** Returns true, if the wrapped stream is seekable. */ - virtual bool isSeekable() const; - /** Returns the size of the stream, if stream is seekable, otherwise -1. */ - virtual sal_Int64 getLength() const; - /** Returns the current stream position, if stream is seekable, otherwise -1. */ + virtual ~BinaryXSeekableStream(); + + /** Returns the size of the stream, if wrapped stream is seekable, otherwise -1. */ + virtual sal_Int64 size() const; + /** Returns the current stream position, if wrapped stream is seekable, otherwise -1. */ virtual sal_Int64 tell() const; - /** Seeks the stream to the passed position, if stream is seekable. */ + /** Seeks the stream to the passed position, if wrapped stream is seekable. */ virtual void seek( sal_Int64 nPos ); + /** Releases the reference to the UNO XSeekable interface. */ + virtual void close(); protected: explicit BinaryXSeekableStream( @@ -111,31 +159,29 @@ private: // ============================================================================ /** Base class for binary input and output streams wrapping a - StreamDataSequence, which is always seekable. */ + StreamDataSequence, which is always seekable. + + The wrapped data sequence MUST live at least as long as this stream + wrapper. The data sequence MUST NOT be changed from outside as long as this + stream wrapper is used to modify it. + */ class SequenceSeekableStream : public virtual BinaryStreamBase { public: - /** Returns true (data sequence streams are always seekable). */ - virtual bool isSeekable() const; /** Returns the size of the wrapped data sequence. */ - virtual sal_Int64 getLength() const; + virtual sal_Int64 size() const; /** Returns the current stream position. */ virtual sal_Int64 tell() const; /** Seeks the stream to the passed position. */ virtual void seek( sal_Int64 nPos ); + /** Releases the reference to the data sequence. */ + virtual void close(); protected: - /** Constructs the wrapper object for the passed data sequence. - - @attention - The passed data sequence MUST live at least as long as this stream - wrapper. The data sequence MUST NOT be changed from outside as long - as this stream wrapper is used to modify it. - */ - inline explicit SequenceSeekableStream( const StreamDataSequence& rData ) : mrData( rData ), mnPos( 0 ) {} + explicit SequenceSeekableStream( const StreamDataSequence& rData ); protected: - const StreamDataSequence& mrData; /// Wrapped data sequence. + const StreamDataSequence* mpData; /// Wrapped data sequence. sal_Int32 mnPos; /// Current position in the sequence. }; diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx index 96b9feeffe07..d6c9721ef0a8 100644 --- a/oox/inc/oox/helper/containerhelper.hxx +++ b/oox/inc/oox/helper/containerhelper.hxx @@ -40,7 +40,7 @@ namespace com { namespace sun { namespace star { namespace container { class XIndexContainer; } namespace container { class XNameAccess; } namespace container { class XNameContainer; } - namespace lang { class XMultiServiceFactory; } + namespace uno { class XComponentContext; } } } } namespace oox { @@ -124,7 +124,7 @@ public: /** Creates a new index container object from scratch. */ static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > - createIndexContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory ); + createIndexContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); /** Inserts an object into an indexed container. @@ -146,7 +146,7 @@ public: /** Creates a new name container object from scratch. */ static ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - createNameContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory ); + createNameContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); /** Returns a name that is not used in the passed name container. diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx index b2b9e1cd133b..a8544196d790 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -157,7 +157,7 @@ private: typedef ::std::deque< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > > GraphicObjectDeque; typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > EmbeddedGraphicMap; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicProvider > mxGraphicProvider; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion > mxUnitConversion; ::com::sun::star::awt::DeviceInfo maDeviceInfo; /// Current output device info. diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index 84c501fae2e5..4e5efea96f20 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -236,9 +236,9 @@ private: class ByteOrderConverter { public: +#ifdef OSL_BIGENDIAN inline static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates inline static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates -#ifdef OSL_BIGENDIAN inline static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); } inline static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); } inline static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); } @@ -247,15 +247,20 @@ public: inline static void convertLittleEndian( sal_uInt64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); } inline static void convertLittleEndian( float& rfValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rfValue ) ); } inline static void convertLittleEndian( double& rfValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rfValue ) ); } + + template< typename Type > + inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount ); + + template<> inline static void convertLittleEndianArray( sal_Int8*, size_t ) {} + template<> inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {} + #else - inline static void convertLittleEndian( sal_Int16& ) {} - inline static void convertLittleEndian( sal_uInt16& ) {} - inline static void convertLittleEndian( sal_Int32& ) {} - inline static void convertLittleEndian( sal_uInt32& ) {} - inline static void convertLittleEndian( sal_Int64& ) {} - inline static void convertLittleEndian( sal_uInt64& ) {} - inline static void convertLittleEndian( float& ) {} - inline static void convertLittleEndian( double& ) {} + template< typename Type > + inline static void convertLittleEndian( Type& ) {} + + template< typename Type > + inline static void convertLittleEndianArray( Type*, size_t ) {} + #endif /** Reads a value from memory, assuming memory buffer in little-endian. @@ -297,6 +302,13 @@ inline void ByteOrderConverter::writeLittleEndian( void* pDstBuffer, Type nValue } #ifdef OSL_BIGENDIAN +template< typename Type > +inline void ByteOrderConverter::convertLittleEndianArray( Type* pnArray, size_t nElemCount ) +{ + for( Type* pnArrayEnd = pnArray + nElemCount; pnArray != pnArrayEnd; ++pnArray ) + convertLittleEndian( *pnArray ); +} + inline void ByteOrderConverter::swap2( sal_uInt8* pnData ) { ::std::swap( pnData[ 0 ], pnData[ 1 ] ); diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx index b4eb38cd7cbe..b25035dd7107 100644 --- a/oox/inc/oox/helper/modelobjecthelper.hxx +++ b/oox/inc/oox/helper/modelobjecthelper.hxx @@ -48,7 +48,7 @@ class ObjectContainer { public: explicit ObjectContainer( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, const ::rtl::OUString& rServiceName ); ~ObjectContainer(); @@ -68,8 +68,8 @@ private: void createContainer() const; private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxFactory; /// Factory to create the container. + mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + mxModelFactory; /// Factory to create the container. mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxContainer; /// Container for the objects. ::rtl::OUString maServiceName; /// Service name to create the container. diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx index c86de41ee4e6..8b5b562e84f2 100644 --- a/oox/inc/oox/helper/propertyset.hxx +++ b/oox/inc/oox/helper/propertyset.hxx @@ -28,8 +28,9 @@ #ifndef OOX_HELPER_PROPERTYSET_HXX #define OOX_HELPER_PROPERTYSET_HXX -#include #include +#include +#include #include "oox/token/properties.hxx" namespace oox { @@ -82,6 +83,9 @@ public: inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getXPropertySet() const { return mxPropSet; } + /** Returns true, if the specified property is supported by the property set. */ + bool hasProperty( sal_Int32 nPropId ) const; + // Get properties --------------------------------------------------------- /** Gets the specified property from the property set. @@ -141,6 +145,8 @@ private: mxPropSet; /// The mandatory property set interface. ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > mxMultiPropSet; /// The optional multi property set interface. + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + mxPropSetInfo; /// Property information. }; // ============================================================================ diff --git a/oox/inc/oox/helper/textinputstream.hxx b/oox/inc/oox/helper/textinputstream.hxx index 2e98d3fc8c84..1c8ef471c587 100644 --- a/oox/inc/oox/helper/textinputstream.hxx +++ b/oox/inc/oox/helper/textinputstream.hxx @@ -25,29 +25,100 @@ * ************************************************************************/ -#ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX -#define OOX_HELPER_RECORDINPUTSTREAM_HXX +#ifndef OOX_HELPER_TEXTINPUTSTREAM_HXX +#define OOX_HELPER_TEXTINPUTSTREAM_HXX -#include "oox/helper/binaryinputstream.hxx" +#include +#include + +namespace com { namespace sun { namespace star { + namespace io { class XInputStream; } + namespace io { class XTextInputStream; } + namespace uno { class XComponentContext; } +} } } namespace oox { +class BinaryInputStream; + // ============================================================================ class TextInputStream { public: - explicit TextInputStream( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc ); + explicit TextInputStream( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, + rtl_TextEncoding eTextEnc ); + + explicit TextInputStream( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + BinaryInputStream& rInStrm, + rtl_TextEncoding eTextEnc ); + + ~TextInputStream(); - /** Returns true, if the wrapped input stream is in EOF state. */ + /** Returns true, if no more text is available in the stream. + */ bool isEof() const; - /** Reads a text line from the stream. */ + + /** Reads a text line from the stream. + + If the last line in the stream is not terminated with line-end + character(s), the stream will immediately go into EOF state and return + the text line. Otherwise, if the last character in the stream is a + line-end character, the next call to this function will turn the stream + into EOF state and return an empty string. + */ ::rtl::OUString readLine(); + /** Reads a text portion from the stream until the specified character is + found. + + If the end of the stream is not terminated with the specified + character, the stream will immediately go into EOF state and return the + remaining text portion. Otherwise, if the last character in the stream + is the specified character (and caller specifies to read and return it, + see parameter bIncludeChar), the next call to this function will turn + the stream into EOF state and return an empty string. + + @param cChar + The separator character to be read to. + + @param bIncludeChar + True = if found, the specified character will be read from stream + and included in the returned string. + False = the specified character will neither be read from the + stream nor included in the returned string, but will be + returned as first character in the next call of this function + or readLine(). + */ + ::rtl::OUString readToChar( sal_Unicode cChar, bool bIncludeChar ); + + // ------------------------------------------------------------------------ + + /** Creates a UNO text input stream object from the passed UNO input stream. + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > + createXTextInputStream( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, + rtl_TextEncoding eTextEnc ); + + // ------------------------------------------------------------------------ +private: + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm, + rtl_TextEncoding eTextEnc ); + + /** Adds the pending character in front of the passed string, if existing. */ + ::rtl::OUString createFinalString( const ::rtl::OUString& rString ); + private: - BinaryInputStream& mrInStrm; - rtl_TextEncoding meTextEnc; - sal_Unicode mcLastEolChar; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > + mxTextStrm; + sal_Unicode mcPendingChar; }; // ============================================================================ diff --git a/oox/inc/oox/helper/zipstorage.hxx b/oox/inc/oox/helper/zipstorage.hxx index d4bc68794323..26eeebc47979 100644 --- a/oox/inc/oox/helper/zipstorage.hxx +++ b/oox/inc/oox/helper/zipstorage.hxx @@ -31,7 +31,7 @@ #include "oox/helper/storagebase.hxx" namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } + namespace uno { class XComponentContext; } } } } namespace oox { @@ -43,11 +43,11 @@ class ZipStorage : public StorageBase { public: explicit ZipStorage( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ); explicit ZipStorage( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ); virtual ~ZipStorage(); diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx index f26075ff52eb..b986fc8065c6 100644 --- a/oox/inc/oox/ole/axbinaryreader.hxx +++ b/oox/inc/oox/ole/axbinaryreader.hxx @@ -40,7 +40,7 @@ namespace ole { /** A wrapper for a binary input stream that supports aligned read operations. The implementation does not support seeking back the wrapped stream. All - seeking operations (tell, seek, align) are performed relative to the + seeking operations (tell, seekTo, align) are performed relative to the position of the wrapped stream at construction time of this wrapper. It is possible to construct this wrapper with an unseekable input stream without loosing any functionality. @@ -50,21 +50,26 @@ class AxAlignedInputStream : public BinaryInputStream public: explicit AxAlignedInputStream( BinaryInputStream& rInStrm ); + /** Returns the size of the data this stream represents, if the wrapped + stream supports the size() operation. */ + virtual sal_Int64 size() const; /** Return the current relative stream position (relative to position of the wrapped stream at construction time). */ virtual sal_Int64 tell() const; /** Seeks the stream to the passed relative position, if it is behind the current position. */ virtual void seek( sal_Int64 nPos ); + /** Closes the input stream but not the wrapped stream. */ + virtual void close(); /** Reads nBytes bytes to the passed sequence. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Reads nBytes bytes to the (existing) buffer opMem. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Seeks the stream forward by the passed number of bytes. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Aligns the stream to a multiple of the passed size (relative to the position of the wrapped stream at construction time). */ @@ -78,8 +83,9 @@ public: inline void skipAligned() { align( sizeof( Type ) ); skip( sizeof( Type ) ); } private: - BinaryInputStream& mrInStrm; /// The wrapped input stream. + BinaryInputStream* mpInStrm; /// The wrapped input stream. sal_Int64 mnStrmPos; /// Tracks relative position in the stream. + sal_Int64 mnStrmSize; /// Size of the wrapped stream data. }; // ============================================================================ diff --git a/oox/inc/oox/ole/oleobjecthelper.hxx b/oox/inc/oox/ole/oleobjecthelper.hxx index c3a58213abc9..159384b0fcab 100644 --- a/oox/inc/oox/ole/oleobjecthelper.hxx +++ b/oox/inc/oox/ole/oleobjecthelper.hxx @@ -63,7 +63,7 @@ class OleObjectHelper { public: explicit OleObjectHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory ); ~OleObjectHelper(); bool importOleObject( diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx index eabcfd4d0f87..5ea9d023257b 100644 --- a/oox/inc/oox/ole/olestorage.hxx +++ b/oox/inc/oox/ole/olestorage.hxx @@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } - namespace lang { class XMultiServiceFactory; } + namespace uno { class XComponentContext; } } } } namespace oox { @@ -45,12 +45,12 @@ class OleStorage : public StorageBase { public: explicit OleStorage( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream, bool bBaseStreamAccess ); explicit OleStorage( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream, bool bBaseStreamAccess ); @@ -101,8 +101,8 @@ private: virtual void implCommit() const; private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxFactory; /// Factory for storage/stream creation. + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + mxContext; /// Component context with service manager. ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxStorage; /// Access to elements of this sub storage. const OleStorage* mpParentStorage; /// Parent OLE storage that contains this storage. diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx index 8c4274ffda7e..941b7d06d95a 100644 --- a/oox/inc/oox/ole/vbacontrol.hxx +++ b/oox/inc/oox/ole/vbacontrol.hxx @@ -206,7 +206,7 @@ public: rtl_TextEncoding eTextEnc ); private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; ControlConverter maConverter; }; diff --git a/oox/inc/oox/ole/vbainputstream.hxx b/oox/inc/oox/ole/vbainputstream.hxx index 858698518968..bc73eb3b2ce2 100644 --- a/oox/inc/oox/ole/vbainputstream.hxx +++ b/oox/inc/oox/ole/vbainputstream.hxx @@ -42,14 +42,23 @@ class VbaInputStream : public BinaryInputStream public: explicit VbaInputStream( BinaryInputStream& rInStrm ); + /** Returns -1, stream size is not determinable. */ + virtual sal_Int64 size() const; + /** Returns -1, stream position is not tracked. */ + virtual sal_Int64 tell() const; + /** Does nothing, stream is not seekable. */ + virtual void seek( sal_Int64 nPos ); + /** Closes the input stream but not the wrapped stream. */ + virtual void close(); + /** Reads nBytes bytes to the passed sequence. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Reads nBytes bytes to the (existing) buffer opMem. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Seeks the stream forward by the passed number of bytes. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); private: /** If no data left in chunk buffer, reads the next chunk from stream. */ @@ -58,7 +67,7 @@ private: private: typedef ::std::vector< sal_uInt8 > ChunkBuffer; - BinaryInputStream& mrInStrm; + BinaryInputStream* mpInStrm; ChunkBuffer maChunk; size_t mnChunkPos; }; diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx index 52b2261e55b5..57a1de3169a3 100644 --- a/oox/inc/oox/ole/vbamodule.hxx +++ b/oox/inc/oox/ole/vbamodule.hxx @@ -35,6 +35,7 @@ namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } namespace container { class XNameContainer; } namespace frame { class XModel; } + namespace uno { class XComponentContext; } } } } namespace oox { @@ -51,6 +52,7 @@ class VbaModule { public: explicit VbaModule( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const ::rtl::OUString& rName, rtl_TextEncoding eTextEnc, @@ -90,6 +92,8 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const; private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + mxContext; /// Component context with service manager. ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; /// Document model used to import/export the VBA project. ::rtl::OUString maName; diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index 40e81c923d25..c5446e86dace 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -189,7 +189,7 @@ private: typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - mxCompContext; /// Component context with service manager. + mxContext; /// Component context with service manager. ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel; /// Document model used to import/export the VBA project. ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > diff --git a/oox/inc/oox/vml/vmlinputstream.hxx b/oox/inc/oox/vml/vmlinputstream.hxx index a425425cd0cb..d0121f8d85e2 100644 --- a/oox/inc/oox/vml/vmlinputstream.hxx +++ b/oox/inc/oox/vml/vmlinputstream.hxx @@ -28,36 +28,72 @@ #ifndef OOX_VML_VMLINPUTSTREAM_HXX #define OOX_VML_VMLINPUTSTREAM_HXX -#include +#include +#include +#include + +namespace com { namespace sun { namespace star { + namespace io { class XTextInputStream; } + namespace uno { class XComponentContext; } +} } } namespace oox { namespace vml { // ============================================================================ -struct StreamDataContainer -{ - ::comphelper::ByteSequence maDataSeq; +typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream > InputStream_BASE; - explicit StreamDataContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ); -}; +/** An input stream class for VML streams, implementing the UNO interface + com.sun.star.io.XInputStream needed by the Expat XML parsers. -// ============================================================================ + This stream reads the data from the input stream passed to the constructor, + and parses all XML elements for features unsupported by the current Expat + XML parser: -/** An input stream class for VML streams. + 1) All elements that have the form '' where 'inst' is any string + not containing the characters '<' and '>' are stripped from the input + stream. - This stream reads the entire data from the input stream passed to the - constructor, and parses all XML elements for features unsupported by the - current Expat parser. + 2) Multiple occurences of the same attribute in an element but the last + are removed. - All elements that have the form '' where 'inst' is any string not - containing the characters '<' and '>' are stripped from the input stream. + 3) Line breaks represented by a single
element (without matching +
element) are replaced by a literal LF character. */ -class InputStream : private StreamDataContainer, public ::comphelper::SequenceInputStream +class InputStream : public InputStream_BASE { public: - explicit InputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ); + explicit InputStream( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ); virtual ~InputStream(); + + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) + throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) + throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available() + throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput() + throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + +private: + void updateBuffer() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + ::rtl::OString readToElementBegin() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + ::rtl::OString readToElementEnd() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream > + mxTextStrm; + ::com::sun::star::uno::Sequence< sal_Unicode > maOpeningBracket; + ::com::sun::star::uno::Sequence< sal_Unicode > maClosingBracket; + const ::rtl::OString maOpeningCData; + const ::rtl::OString maClosingCData; + ::rtl::OString maBuffer; + sal_Int32 mnBufferPos; }; // ============================================================================ diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index 5a65eb088315..9fbeee937f29 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -621,7 +621,7 @@ public: // BIFF12 import ---------------------------------------------------------- /** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */ - static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true ); + static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true, bool bAllowNulChars = false ); // BIFF2-BIFF8 import ----------------------------------------------------- diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx index 003ab28be34f..9f0ffa853ebc 100644 --- a/oox/inc/oox/xls/biffinputstream.hxx +++ b/oox/inc/oox/xls/biffinputstream.hxx @@ -242,30 +242,30 @@ public: // BinaryStreamBase interface (seeking) ----------------------------------- - /** Returns true, as the BIFF input stream is required to be seekable. */ - virtual bool isSeekable() const; + /** Returns the data size of the whole record without record headers. */ + virtual sal_Int64 size() const; /** Returns the position inside of the whole record content. */ virtual sal_Int64 tell() const; - /** Returns the data size of the whole record without record headers. */ - virtual sal_Int64 getLength() const; /** Seeks in record content to the specified position. */ virtual void seek( sal_Int64 nRecPos ); + /** Closes the input stream but not the wrapped stream. */ + virtual void close(); /** Returns the absolute position in the wrapped binary stream. */ sal_Int64 tellBase() const; /** Returns the total size of the wrapped binary stream. */ - sal_Int64 getBaseLength() const; + sal_Int64 sizeBase() const; // BinaryInputStream interface (stream read access) ----------------------- /** Reads nBytes bytes to the passed sequence. @return Number of bytes really read. */ - virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ); + virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Reads nBytes bytes and copies them to the passed buffer opMem. @return Number of bytes really read. */ - virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ); + virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Seeks forward inside the current record. */ - virtual void skip( sal_Int32 nBytes ); + virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Stream operator for integral and floating-point types. */ template< typename Type > @@ -352,9 +352,6 @@ public: // ------------------------------------------------------------------------ private: - /** Forwards calls of readValue() template functions to the record buffer. */ - virtual void readAtom( void* opMem, sal_uInt8 nSize ); - /** Initializes all members after base stream has been seeked to new record. */ void setupRecord(); /** Restarts the current record from the beginning. */ @@ -383,16 +380,9 @@ private: records, stores the length in mnComplRecSize. */ void calcRecordLength(); - /** Ensures that reading nBytes bytes is possible with next stream access. - @descr Stream must be located at the end of a raw record, and handling - of CONTINUE records must be enabled. - @return True if nBytes can be read from stream. */ - bool ensureRawReadSize( sal_uInt16 nBytes ); /** Returns the maximum size of raw data possible to read in one block. */ - sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes ) const; + sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const; - /** Reads an array of Unicode characters and appends them to the passed buffer. */ - void appendUnicodeArray( ::rtl::OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16BitChars, bool bAllowNulChars ); /** Reads the BIFF8 Unicode string header fields. */ void readUniStringHeader( bool& orb16BitChars, sal_Int32& ornAddSize ); diff --git a/oox/inc/oox/xls/biffoutputstream.hxx b/oox/inc/oox/xls/biffoutputstream.hxx index ada646bd879a..7d03572be5ec 100644 --- a/oox/inc/oox/xls/biffoutputstream.hxx +++ b/oox/inc/oox/xls/biffoutputstream.hxx @@ -94,9 +94,6 @@ private: CONTINUE record, use setPortionSize(). Example: To write a sequence of 16-bit values where 4 values form a unit and cannot be split, call setPortionSize(8) first (4*2 bytes == 8). - - To write unicode character arrays, call writeUnicodeBuffer(). It creates - CONTINUE records and repeats the unicode string flag byte automatically. */ class BiffOutputStream : public BinaryOutputStream { @@ -113,47 +110,44 @@ public: /** Finishes the current record. Must be called for every started record. */ void endRecord(); - /** Sets size of data portion in bytes. 0 means no portions are used. */ - void setPortionSize( sal_uInt16 nSize ); + /** Sets size of data portion in bytes. 0 or 1 means no portions are used. */ + void setPortionSize( sal_uInt8 nSize ); // BinaryStreamBase interface (seeking) ----------------------------------- /** Returns the absolute position in the wrapped binary stream. */ sal_Int64 tellBase() const; /** Returns the total size of the wrapped binary stream. */ - sal_Int64 getBaseLength() const; + sal_Int64 sizeBase() const; // BinaryOutputStream interface (stream write access) --------------------- /** Writes the passed data sequence. */ - virtual void writeData( const StreamDataSequence& rData ); + virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ); /** Writes nBytes bytes from the passed buffer pMem. */ - virtual void writeMemory( const void* pMem, sal_Int32 nBytes ); + virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ); /** Writes a sequence of nBytes bytes with the passed value. */ - void fill( sal_uInt8 nValue, sal_Int32 nBytes ); - /** Writes a block of memory, ensures that it is not split to a CONTINUE record. */ - void writeBlock( const void* pMem, sal_uInt16 nBytes ); + void fill( sal_uInt8 nValue, sal_Int32 nBytes, size_t nAtomSize = 1 ); - /** Stream operator for integral and floating-point types. */ + /** Stream operator for all data types supported by the writeValue() function. */ template< typename Type > inline BiffOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } // ------------------------------------------------------------------------ private: - /** Forwards calls of writeValue() template functions to the record buffer. */ - virtual void writeAtom( const void* pMem, sal_uInt8 nSize ); - /** Checks the remaining size in the current record, creates CONTINUE record if needed. */ void ensureRawBlock( sal_uInt16 nSize ); - /** Checks the remaining size in the current record and creates CONTINUE record if needed. + + /** Checks the remaining size in the current record and creates a CONTINUE + record if needed. @return Maximum size left for writing to current record. */ - sal_uInt16 prepareRawBlock( sal_Int32 nTotalSize ); + sal_uInt16 prepareWriteBlock( sal_Int32 nTotalSize, size_t nAtomSize ); private: prv::BiffOutputRecordBuffer maRecBuffer; /// Raw record data buffer. - sal_uInt16 mnPortionSize; /// Size of data portions. - sal_uInt16 mnPortionPos; /// Position in current portion. + sal_uInt8 mnPortionSize; /// Size of data portions. + sal_uInt8 mnPortionPos; /// Position in current portion. }; // ============================================================================ diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx index d5336a2d7354..47dac1aaf114 100644 --- a/oox/inc/oox/xls/formulabase.hxx +++ b/oox/inc/oox/xls/formulabase.hxx @@ -577,7 +577,7 @@ class OpCodeProvider : public FunctionProvider // not derived from WorkbookHelpe { public: explicit OpCodeProvider( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, FilterType eFilter, BiffType eBiff, bool bImportFilter ); virtual ~OpCodeProvider(); @@ -604,7 +604,7 @@ class ApiParserWrapper : public OpCodeProvider { public: explicit ApiParserWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory, const OpCodeProvider& rOpCodeProv ); /** Returns read/write access to the formula parser property set. */ diff --git a/oox/inc/oox/xls/ooxformulaparser.hxx b/oox/inc/oox/xls/ooxformulaparser.hxx index 7bc1bbdd4909..f74a6ddf455b 100644 --- a/oox/inc/oox/xls/ooxformulaparser.hxx +++ b/oox/inc/oox/xls/ooxformulaparser.hxx @@ -46,10 +46,10 @@ class OOXMLFormulaPrinterImpl; typedef ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XInitialization, - ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParserBase; + ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParser_BASE; /** OOXML formula parser/compiler service for usage in ODF filters. */ -class OOXMLFormulaParser : public OOXMLFormulaParserBase +class OOXMLFormulaParser : public OOXMLFormulaParser_BASE { public: explicit OOXMLFormulaParser(); diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index ecf824076ef5..a67d1477b11a 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -133,9 +133,6 @@ public: /** Returns the base filter object (base class of all filters). */ ::oox::core::FilterBase& getBaseFilter() const; - /** Returns a reference to the global service factory. */ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getGlobalFactory() const; /** Returns the file type of the current filter. */ FilterType getFilterType() const; /** Returns the filter progress bar. */ @@ -157,9 +154,6 @@ public: /** Returns a reference to the source/target spreadsheet document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > getDocument() const; - /** Returns a reference to the service factory of the spreadsheet document model. */ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getDocumentFactory() const; /** Returns a reference to the specified spreadsheet in the document model. */ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > diff --git a/oox/source/core/binaryfilterbase.cxx b/oox/source/core/binaryfilterbase.cxx index 9bebedb9c96b..edff8a788808 100644 --- a/oox/source/core/binaryfilterbase.cxx +++ b/oox/source/core/binaryfilterbase.cxx @@ -55,12 +55,12 @@ BinaryFilterBase::~BinaryFilterBase() StorageRef BinaryFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const { - return StorageRef( new ::oox::ole::OleStorage( getServiceFactory(), rxInStream, true ) ); + return StorageRef( new ::oox::ole::OleStorage( getComponentContext(), rxInStream, true ) ); } StorageRef BinaryFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const { - return StorageRef( new ::oox::ole::OleStorage( getServiceFactory(), rxOutStream, true ) ); + return StorageRef( new ::oox::ole::OleStorage( getComponentContext(), rxOutStream, true ) ); } // ============================================================================ diff --git a/oox/source/core/contexthandler.cxx b/oox/source/core/contexthandler.cxx index 8bf2c4eadfeb..1ff793cd0c84 100644 --- a/oox/source/core/contexthandler.cxx +++ b/oox/source/core/contexthandler.cxx @@ -42,7 +42,7 @@ using ::rtl::OUString; // ============================================================================ ContextHandler::ContextHandler( ContextHandler& rParent ) : - ContextHandlerImplBase(), + ContextHandler_BASE(), mxBaseData( rParent.mxBaseData ) { } diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index cdab111e9898..f836720a48a2 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -269,9 +269,9 @@ const sal_uInt32 ENCRYPT_HASH_SHA1 = 0x00008004; // ---------------------------------------------------------------------------- -bool lclIsZipPackage( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm ) +bool lclIsZipPackage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) { - ZipStorage aZipStorage( rxFactory, rxInStrm ); + ZipStorage aZipStorage( rxContext, rxInStrm ); return aZipStorage.isStorage(); } @@ -499,109 +499,106 @@ PasswordVerifier::PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo ) Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescriptor& rMediaDesc ) const { - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY ); - if( xFactory.is() ) + // try the plain input stream + Reference< XInputStream > xInStrm( rMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY ); + if( !xInStrm.is() || lclIsZipPackage( mxContext, xInStrm ) ) + return xInStrm; + + // check if a temporary file is passed in the 'ComponentData' property + Reference< XStream > xDecrypted( rMediaDesc.getComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ) ), UNO_QUERY ); + if( xDecrypted.is() ) { - // try the plain input stream - Reference< XInputStream > xInStrm( rMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY ); - if( !xInStrm.is() || lclIsZipPackage( xFactory, xInStrm ) ) - return xInStrm; - - // check if a temporary file is passed in the 'ComponentData' property - Reference< XStream > xDecrypted( rMediaDesc.getComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ) ), UNO_QUERY ); - if( xDecrypted.is() ) - { - Reference< XInputStream > xDecrInStrm = xDecrypted->getInputStream(); - if( lclIsZipPackage( xFactory, xDecrInStrm ) ) - return xDecrInStrm; - } + Reference< XInputStream > xDecrInStrm = xDecrypted->getInputStream(); + if( lclIsZipPackage( mxContext, xDecrInStrm ) ) + return xDecrInStrm; + } - // try to decrypt an encrypted OLE package - ::oox::ole::OleStorage aOleStorage( xFactory, xInStrm, false ); - if( aOleStorage.isStorage() ) try + // try to decrypt an encrypted OLE package + ::oox::ole::OleStorage aOleStorage( mxContext, xInStrm, false ); + if( aOleStorage.isStorage() ) try + { + // open the required input streams in the encrypted package + Reference< XInputStream > xEncryptionInfo( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptionInfo" ) ), UNO_SET_THROW ); + Reference< XInputStream > xEncryptedPackage( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptedPackage" ) ), UNO_SET_THROW ); + + // read the encryption info stream + PackageEncryptionInfo aEncryptInfo; + BinaryXInputStream aInfoStrm( xEncryptionInfo, true ); + bool bValidInfo = lclReadEncryptionInfo( aEncryptInfo, aInfoStrm ); + + // check flags and agorithm IDs, requiered are AES128 and SHA-1 + bool bImplemented = bValidInfo && + getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_CRYPTOAPI ) && + getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_AES ) && + // algorithm ID 0 defaults to AES128 too, if ENCRYPTINFO_AES flag is set + ((aEncryptInfo.mnAlgorithmId == 0) || (aEncryptInfo.mnAlgorithmId == ENCRYPT_ALGO_AES128)) && + // hash algorithm ID 0 defaults to SHA-1 too + ((aEncryptInfo.mnAlgorithmIdHash == 0) || (aEncryptInfo.mnAlgorithmIdHash == ENCRYPT_HASH_SHA1)) && + (aEncryptInfo.mnVerifierHashSize == 20); + + if( bImplemented ) { - // open the required input streams in the encrypted package - Reference< XInputStream > xEncryptionInfo( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptionInfo" ) ), UNO_SET_THROW ); - Reference< XInputStream > xEncryptedPackage( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptedPackage" ) ), UNO_SET_THROW ); - - // read the encryption info stream - PackageEncryptionInfo aEncryptInfo; - BinaryXInputStream aInfoStrm( xEncryptionInfo, true ); - bool bValidInfo = lclReadEncryptionInfo( aEncryptInfo, aInfoStrm ); - - // check flags and agorithm IDs, requiered are AES128 and SHA-1 - bool bImplemented = bValidInfo && - getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_CRYPTOAPI ) && - getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_AES ) && - // algorithm ID 0 defaults to AES128 too, if ENCRYPTINFO_AES flag is set - ((aEncryptInfo.mnAlgorithmId == 0) || (aEncryptInfo.mnAlgorithmId == ENCRYPT_ALGO_AES128)) && - // hash algorithm ID 0 defaults to SHA-1 too - ((aEncryptInfo.mnAlgorithmIdHash == 0) || (aEncryptInfo.mnAlgorithmIdHash == ENCRYPT_HASH_SHA1)) && - (aEncryptInfo.mnVerifierHashSize == 20); - - if( bImplemented ) + /* "VelvetSweatshop" is the built-in default encryption + password used by MS Excel for the "workbook protection" + feature with password. Try this first before prompting the + user for a password. */ + ::std::vector< OUString > aDefaultPasswords; + aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) ); + + /* Use the comphelper password helper to request a password. + This helper returns either with the correct password + (according to the verifier), or with an empty string if + user has cancelled the password input dialog. */ + PasswordVerifier aVerifier( aEncryptInfo ); + Sequence< NamedValue > aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + aVerifier, rMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords ); + + if( aEncryptionData.getLength() == 0 ) { - /* "VelvetSweatshop" is the built-in default encryption - password used by MS Excel for the "workbook protection" - feature with password. Try this first before prompting the - user for a password. */ - ::std::vector< OUString > aDefaultPasswords; - aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) ); - - /* Use the comphelper password helper to request a password. - This helper returns either with the correct password - (according to the verifier), or with an empty string if - user has cancelled the password input dialog. */ - PasswordVerifier aVerifier( aEncryptInfo ); - Sequence< NamedValue > aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( - aVerifier, rMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords ); - - if( aEncryptionData.getLength() == 0 ) - { - rMediaDesc[ MediaDescriptor::PROP_ABORTED() ] <<= true; - } - else + rMediaDesc[ MediaDescriptor::PROP_ABORTED() ] <<= true; + } + else + { + // create temporary file for unencrypted package + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW ); + BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true ); + BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true ); + + EVP_CIPHER_CTX aes_ctx; + EVP_CIPHER_CTX_init( &aes_ctx ); + EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, aVerifier.getKey(), 0 ); + EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); + + sal_uInt8 pnInBuffer[ 1024 ]; + sal_uInt8 pnOutBuffer[ 1024 ]; + sal_Int32 nInLen; + int nOutLen; + aEncryptedPackage.skip( 8 ); // decrypted size + while( (nInLen = aEncryptedPackage.readMemory( pnInBuffer, sizeof( pnInBuffer ) )) > 0 ) { - // create temporary file for unencrypted package - Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); - Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW ); - BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true ); - BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true ); - - EVP_CIPHER_CTX aes_ctx; - EVP_CIPHER_CTX_init( &aes_ctx ); - EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, aVerifier.getKey(), 0 ); - EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); - - sal_uInt8 pnInBuffer[ 1024 ]; - sal_uInt8 pnOutBuffer[ 1024 ]; - sal_Int32 nInLen; - int nOutLen; - aEncryptedPackage.skip( 8 ); // decrypted size - while( (nInLen = aEncryptedPackage.readMemory( pnInBuffer, sizeof( pnInBuffer ) )) > 0 ) - { - EVP_DecryptUpdate( &aes_ctx, pnOutBuffer, &nOutLen, pnInBuffer, nInLen ); - aDecryptedPackage.writeMemory( pnOutBuffer, nOutLen ); - } - EVP_DecryptFinal_ex( &aes_ctx, pnOutBuffer, &nOutLen ); + EVP_DecryptUpdate( &aes_ctx, pnOutBuffer, &nOutLen, pnInBuffer, nInLen ); aDecryptedPackage.writeMemory( pnOutBuffer, nOutLen ); + } + EVP_DecryptFinal_ex( &aes_ctx, pnOutBuffer, &nOutLen ); + aDecryptedPackage.writeMemory( pnOutBuffer, nOutLen ); - EVP_CIPHER_CTX_cleanup( &aes_ctx ); - xDecryptedPackage->flush(); - aDecryptedPackage.seekToStart(); + EVP_CIPHER_CTX_cleanup( &aes_ctx ); + xDecryptedPackage->flush(); + aDecryptedPackage.seekToStart(); - // store temp file in media descriptor to keep it alive - rMediaDesc.setComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ), Any( xTempFile ) ); + // store temp file in media descriptor to keep it alive + rMediaDesc.setComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ), Any( xTempFile ) ); - Reference< XInputStream > xDecrInStrm = xTempFile->getInputStream(); - if( lclIsZipPackage( xFactory, xDecrInStrm ) ) - return xDecrInStrm; - } + Reference< XInputStream > xDecrInStrm = xTempFile->getInputStream(); + if( lclIsZipPackage( mxContext, xDecrInStrm ) ) + return xDecrInStrm; } } - catch( Exception& ) - { - } + } + catch( Exception& ) + { } return Reference< XInputStream >(); @@ -633,7 +630,6 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq { OUString aFilterName; MediaDescriptor aMediaDesc( rMediaDescSeq ); - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); /* Check that the user has not choosen to abort detection, e.g. by hitting 'Cancel' in the password input dialog. This may happen because this @@ -650,7 +646,7 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq Reference< XInputStream > xInStrm( extractUnencryptedPackage( aMediaDesc ), UNO_SET_THROW ); // stream must be a ZIP package - ZipStorage aZipStorage( xFactory, xInStrm ); + ZipStorage aZipStorage( mxContext, xInStrm ); if( aZipStorage.isStorage() ) { // create the fast parser, register the XML namespaces, set document handler diff --git a/oox/source/core/fragmenthandler.cxx b/oox/source/core/fragmenthandler.cxx index a1c42e56c155..14abe0d537fc 100644 --- a/oox/source/core/fragmenthandler.cxx +++ b/oox/source/core/fragmenthandler.cxx @@ -52,12 +52,12 @@ FragmentBaseData::FragmentBaseData( XmlFilterBase& rFilter, const OUString& rFra // ============================================================================ FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) : - FragmentHandlerImplBase( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) ) + FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) ) { } FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) : - FragmentHandlerImplBase( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, xRelations ) ) ) + FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, xRelations ) ) ) { } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index fe13d9322346..a77789edbeb8 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -496,12 +496,12 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM StorageRef XmlFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const { - return StorageRef( new ZipStorage( getServiceFactory(), rxInStream ) ); + return StorageRef( new ZipStorage( getComponentContext(), rxInStream ) ); } StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const { - return StorageRef( new ZipStorage( getServiceFactory(), rxOutStream ) ); + return StorageRef( new ZipStorage( getComponentContext(), rxOutStream ) ); } // ============================================================================ diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 279c9d3c0487..54e1fad7febc 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -166,7 +166,7 @@ void BiffCtlsStreamObject::implDump() { IndentGuard aIndGuard( mxOut ); mxStrm->seek( mnStartPos ); - RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, mnLength ) ); + BinaryInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, mnLength ) ); FormControlStreamObject( *this, xRelStrm ).dump(); } writeEmptyItem( "CTLS-END" ); @@ -356,7 +356,7 @@ bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos, break; } - ornRecSize = mxBiffStrm->getLength(); + ornRecSize = mxBiffStrm->size(); return bValid; } @@ -810,7 +810,7 @@ void FormulaObject::implDump() if( mnSize == 0 ) return; sal_Int64 nStartPos = mxStrm->tell(); - sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() ); + sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->size() ); bool bValid = mxTokens.get(); mxStack.reset( new FormulaStack ); @@ -1603,7 +1603,7 @@ void WorkbookStreamObject::implDumpRecordBody() { BiffInputStream& rStrm = getBiffStream(); sal_uInt16 nRecId = rStrm.getRecId(); - sal_Int64 nRecSize = rStrm.getLength(); + sal_Int64 nRecSize = rStrm.size(); BiffType eBiff = getBiff(); switch( nRecId ) @@ -4524,7 +4524,7 @@ RootStorageObject::RootStorageObject( const DumperBase& rParent ) addPreferredStream( "Workbook" ); } -void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAscii( "Book" ) || rStrmName.equalsAscii( "Workbook" )) ) WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump(); @@ -4562,13 +4562,13 @@ Dumper::Dumper( const FilterBase& rFilter ) DumperBase::construct( xCfg ); } -Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) +Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) { - if( rxFactory.is() && rxInStrm.is() ) + if( rxContext.is() && rxInStrm.is() ) { - StorageRef xStrg( new ::oox::ole::OleStorage( rxFactory, rxInStrm, true ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( rxContext, rxInStrm, true ) ); MediaDescriptor aMediaDesc; - ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) ); + ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName, aMediaDesc ) ); DumperBase::construct( xCfg ); } } diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index f7c6c6102b1d..eeca65e88cc5 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -29,14 +29,13 @@ #include #include -#include #include -#include #include #include #include #include #include +#include #include "oox/core/filterbase.hxx" #include "oox/helper/binaryoutputstream.hxx" #include "oox/helper/textinputstream.hxx" @@ -112,20 +111,14 @@ OUString InputOutputHelper::getFileNameExtension( const OUString& rFileUrl ) // input streams -------------------------------------------------------------- -Reference< XInputStream > InputOutputHelper::getXInputStream( BinaryInputStream& rStrm ) -{ - if( BinaryXInputStream* pXStrm = dynamic_cast< BinaryXInputStream* >( &rStrm ) ) - return pXStrm->getXInputStream(); - return 0; -} - Reference< XInputStream > InputOutputHelper::openInputStream( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName ) + const Reference< XComponentContext >& rxContext, const OUString& rFileName ) { Reference< XInputStream > xInStrm; - if( rxFactory.is() ) try + if( rxContext.is() ) try { - Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); xInStrm = xFileAccess->openFileRead( rFileName ); } catch( Exception& ) @@ -134,38 +127,16 @@ Reference< XInputStream > InputOutputHelper::openInputStream( return xInStrm; } -Reference< XTextInputStream > InputOutputHelper::openTextInputStream( - const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rEncoding ) -{ - Reference< XTextInputStream > xTextInStrm; - if( rxFactory.is() && rxInStrm.is() ) try - { - Reference< XActiveDataSink > xDataSink( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW ); - xDataSink->setInputStream( rxInStrm ); - xTextInStrm.set( xDataSink, UNO_QUERY_THROW ); - xTextInStrm->setEncoding( rEncoding ); - } - catch( Exception& ) - { - } - return xTextInStrm; -} - -Reference< XTextInputStream > InputOutputHelper::openTextInputStream( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding ) -{ - return openTextInputStream( rxFactory, openInputStream( rxFactory, rFileName ), rEncoding ); -} - // output streams ------------------------------------------------------------- Reference< XOutputStream > InputOutputHelper::openOutputStream( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName ) + const Reference< XComponentContext >& rxContext, const OUString& rFileName ) { Reference< XOutputStream > xOutStrm; - if( rxFactory.is() ) try + if( rxContext.is() ) try { - Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); xOutStrm = xFileAccess->openFileWrite( rFileName ); } catch( Exception& ) @@ -175,15 +146,17 @@ Reference< XOutputStream > InputOutputHelper::openOutputStream( } Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream( - const Reference< XMultiServiceFactory >& rxFactory, const Reference< XOutputStream >& rxOutStrm, const OUString& rEncoding ) + const Reference< XComponentContext >& rxContext, const Reference< XOutputStream >& rxOutStrm, rtl_TextEncoding eTextEnc ) { Reference< XTextOutputStream > xTextOutStrm; - if( rxFactory.is() && rxOutStrm.is() ) try + const char* pcCharset = rtl_getMimeCharsetFromTextEncoding( eTextEnc ); + if( rxContext.is() && rxOutStrm.is() && pcCharset ) try { - Reference< XActiveDataSource > xDataSource( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XActiveDataSource > xDataSource( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW ); xDataSource->setOutputStream( rxOutStrm ); xTextOutStrm.set( xDataSource, UNO_QUERY_THROW ); - xTextOutStrm->setEncoding( rEncoding ); + xTextOutStrm->setEncoding( OUString::createFromAscii( pcCharset ) ); } catch( Exception& ) { @@ -192,9 +165,9 @@ Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream( } Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream( - const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding ) + const Reference< XComponentContext >& rxContext, const OUString& rFileName, rtl_TextEncoding eTextEnc ) { - return openTextOutputStream( rxFactory, openOutputStream( rxFactory, rFileName ), rEncoding ); + return openTextOutputStream( rxContext, openOutputStream( rxContext, rFileName ), eTextEnc ); } // ============================================================================ @@ -1531,9 +1504,9 @@ NameListRef NameListWrapper::getNameList( const Config& rCfg ) const // ============================================================================ SharedConfigData::SharedConfigData( const OUString& rFileName, - const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, + const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) : - mxFactory( rxFactory ), + mxContext( rxContext ), mxRootStrg( rxRootStrg ), maSysFileName( rSysFileName ), mrMediaDesc( rMediaDesc ), @@ -1600,7 +1573,7 @@ Sequence< NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::ID bool SharedConfigData::implIsValid() const { - return mbLoaded && mxFactory.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0); + return mbLoaded && mxContext.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0); } void SharedConfigData::implProcessConfigItemStr( @@ -1629,9 +1602,8 @@ bool SharedConfigData::readConfigFile( const OUString& rFileUrl ) bool bLoaded = maConfigFiles.count( rFileUrl ) > 0; if( !bLoaded ) { - Reference< XInputStream > xInStrm = InputOutputHelper::openInputStream( mxFactory, rFileUrl ); - BinaryXInputStream aInStrm( xInStrm, true ); - TextInputStream aTxtStrm( aInStrm, RTL_TEXTENCODING_UTF8 ); + Reference< XInputStream > xInStrm = InputOutputHelper::openInputStream( mxContext, rFileUrl ); + TextInputStream aTxtStrm( mxContext, xInStrm, RTL_TEXTENCODING_UTF8 ); if( !aTxtStrm.isEof() ) { maConfigFiles.insert( rFileUrl ); @@ -1698,9 +1670,9 @@ Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter ) construct( pcEnvVar, rFilter ); } -Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) +Config::Config( const sal_Char* pcEnvVar, const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) { - construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName, rMediaDesc ); + construct( pcEnvVar, rxContext, rxRootStrg, rSysFileName, rMediaDesc ); } Config::~Config() @@ -1715,14 +1687,14 @@ void Config::construct( const Config& rParent ) void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter ) { if( rFilter.getFileUrl().getLength() > 0 ) - construct( pcEnvVar, rFilter.getServiceFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() ); + construct( pcEnvVar, rFilter.getComponentContext(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() ); } -void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) +void Config::construct( const sal_Char* pcEnvVar, const Reference< XComponentContext >& rxContext, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) { if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) ) if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) ) - mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName, rMediaDesc ) ); + mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxContext, rxRootStrg, rSysFileName, rMediaDesc ) ); } void Config::setStringOption( const String& rKey, const String& rData ) @@ -1795,14 +1767,16 @@ NameListRef Config::implGetNameList( const OUString& rListName ) const // ============================================================================ // ============================================================================ -Output::Output( const Reference< XTextOutputStream >& rxStrm ) -{ - construct( rxStrm ); -} - -Output::Output( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName ) +Output::Output( const Reference< XComponentContext >& rxContext, const OUString& rFileName ) : + mxStrm( InputOutputHelper::openTextOutputStream( rxContext, rFileName, RTL_TEXTENCODING_UTF8 ) ), + mnCol( 0 ), + mnItemLevel( 0 ), + mnMultiLevel( 0 ), + mnItemIdx( 0 ), + mnLastItem( 0 ) { - construct( InputOutputHelper::openTextOutputStream( rxFactory, rFileName, CREATE_OUSTRING( "UTF-8" ) ) ); + if( mxStrm.is() ) + mxStrm->writeString( OUString( OOX_DUMP_BOM ) ); } // ---------------------------------------------------------------------------- @@ -2084,19 +2058,6 @@ void Output::writeRangeList( const RangeList& rRanges ) // ---------------------------------------------------------------------------- -void Output::construct( const Reference< XTextOutputStream >& rxStrm ) -{ - mxStrm = rxStrm; - mnCol = mnItemLevel = mnMultiLevel = 0; - mnItemIdx = 0; - mnLastItem = 0; - if( mxStrm.is() ) - { - writeChar( OOX_DUMP_BOM ); - newLine(); - } -} - bool Output::implIsValid() const { return mxStrm.is(); @@ -2240,7 +2201,8 @@ void StorageObjectBase::implDump() if( bIsRoot ) try { aSysOutPath += OOX_DUMP_DUMPEXT; - Reference< XSimpleFileAccess > xFileAccess( getFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( getContext()->getServiceManager(), UNO_QUERY_THROW ); + Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW ); xFileAccess->kill( aSysOutPath ); } catch( Exception& ) @@ -2259,7 +2221,7 @@ void StorageObjectBase::implDump() } } -void StorageObjectBase::implDumpStream( const BinaryInputStreamRef&, const OUString&, const OUString&, const OUString& ) +void StorageObjectBase::implDumpStream( const Reference< XInputStream >&, const OUString&, const OUString&, const OUString& ) { } @@ -2305,12 +2267,12 @@ void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrg BinaryXInputStream aInStrm( rStrg.openInputStream( rStrmName ), true ); if( !aInStrm.isEof() ) { - BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getFactory(), rSysFileName ), true ); + BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getContext(), rSysFileName ), true ); if( !aOutStrm.isEof() ) aInStrm.copyToStream( aOutStrm ); } - BinaryXInputStreamRef xDumpStrm( new BinaryXInputStream( InputOutputHelper::openInputStream( getFactory(), rSysFileName ), true ) ); - if( !xDumpStrm->isEof() ) + Reference< XInputStream > xDumpStrm = InputOutputHelper::openInputStream( getContext(), rSysFileName ); + if( xDumpStrm.is() ) implDumpStream( xDumpStrm, rStrgPath, rStrmName, rSysFileName ); } @@ -2366,13 +2328,10 @@ void OutputObjectBase::construct( const ObjectBase& rParent, const OUString& rSy { ObjectBase::construct( rParent ); if( ObjectBase::implIsValid() ) - mxOut.reset( new Output( getFactory(), rSysFileName + OOX_DUMP_DUMPEXT ) ); -} - -void OutputObjectBase::construct( const ObjectBase& rParent, const OutputRef& rxOut ) -{ - ObjectBase::construct( rParent ); - mxOut = rxOut; + { + maSysFileName = rSysFileName; + mxOut.reset( new Output( getContext(), rSysFileName + OOX_DUMP_DUMPEXT ) ); + } } void OutputObjectBase::construct( const OutputObjectBase& rParent ) @@ -2551,12 +2510,6 @@ void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStr mxStrm = rxStrm; } -void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut ) -{ - OutputObjectBase::construct( rParent, rxOut ); - mxStrm = rxStrm; -} - void InputObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm ) { OutputObjectBase::construct( rParent ); @@ -2575,7 +2528,7 @@ bool InputObjectBase::implIsValid() const void InputObjectBase::skipBlock( sal_Int64 nBytes, bool bShowSize ) { - sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() ); + sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->size() ); if( mxStrm->tell() < nEndPos ) { if( bShowSize ) @@ -2595,8 +2548,8 @@ void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bS sal_Int64 nMaxShowSize = cfg().getIntOption< sal_Int64 >( bStream ? "max-binary-stream-size" : "max-binary-data-size", SAL_MAX_INT64 ); - bool bSeekable = mxStrm->getLength() >= 0; - sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() ) : 0; + bool bSeekable = mxStrm->size() >= 0; + sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->size() ) : 0; sal_Int64 nDumpEnd = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nMaxShowSize, nEndPos ) : nMaxShowSize; sal_Int64 nPos = bSeekable ? mxStrm->tell() : 0; bool bLoop = true; @@ -2671,12 +2624,12 @@ void InputObjectBase::dumpRemainingTo( sal_Int64 nPos ) void InputObjectBase::dumpRemainingStream() { - dumpRemainingTo( mxStrm->getLength() ); + dumpRemainingTo( mxStrm->size() ); } void InputObjectBase::dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep ) { - sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nBytes ); + sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->size() - mxStrm->tell(), 0, nBytes ); if( nDumpSize > OOX_DUMP_MAXARRAY ) { dumpBinary( rName, nBytes, false ); @@ -2712,7 +2665,7 @@ sal_Unicode InputObjectBase::dumpUnicode( const String& rName ) OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul ) { - sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nLen ); + sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->size() - mxStrm->tell(), 0, nLen ); OUString aString; if( nDumpSize > 0 ) { @@ -2892,7 +2845,7 @@ BinaryStreamObject::BinaryStreamObject( const OutputObjectBase& rParent, const B void BinaryStreamObject::dumpBinaryStream( bool bShowOffset ) { mxStrm->seekToStart(); - dumpRawBinary( mxStrm->getLength(), bShowOffset, true ); + dumpRawBinary( mxStrm->size(), bShowOffset, true ); mxOut->emptyLine(); } @@ -2901,43 +2854,71 @@ void BinaryStreamObject::implDump() dumpBinaryStream(); } +// ============================================================================ // ============================================================================ -TextStreamObject::TextStreamObject( const ObjectBase& rParent, +void TextStreamObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName ) { InputObjectBase::construct( rParent, rxStrm, rSysFileName ); - if( rxStrm.get() ) - mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) ); + constructTextStrmObj( eTextEnc ); } -TextStreamObject::TextStreamObject( const OutputObjectBase& rParent, +void TextStreamObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc ) { InputObjectBase::construct( rParent, rxStrm ); - if( rxStrm.get() ) - mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) ); + constructTextStrmObj( eTextEnc ); +} + +void TextStreamObjectBase::construct( const InputObjectBase& rParent, rtl_TextEncoding eTextEnc ) +{ + InputObjectBase::construct( rParent ); + constructTextStrmObj( eTextEnc ); } -bool TextStreamObject::implIsValid() const +bool TextStreamObjectBase::implIsValid() const { return InputObjectBase::implIsValid() && mxTextStrm.get(); } -void TextStreamObject::implDump() +void TextStreamObjectBase::implDump() +{ + implDumpText( *mxTextStrm ); +} + +void TextStreamObjectBase::constructTextStrmObj( rtl_TextEncoding eTextEnc ) +{ + if( mxStrm.get() ) + mxTextStrm.reset( new TextInputStream( getContext(), *mxStrm, eTextEnc ) ); +} + +// ============================================================================ + +TextLineStreamObject::TextLineStreamObject( const ObjectBase& rParent, + const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName ) +{ + TextStreamObjectBase::construct( rParent, rxStrm, eTextEnc, rSysFileName ); +} + +TextLineStreamObject::TextLineStreamObject( const OutputObjectBase& rParent, + const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc ) +{ + TextStreamObjectBase::construct( rParent, rxStrm, eTextEnc ); +} + +void TextLineStreamObject::implDumpText( TextInputStream& rTextStrm ) { - OUString aLine; sal_uInt32 nLine = 0; - while( !mxTextStrm->isEof() ) + while( !rTextStrm.isEof() ) { - aLine = mxTextStrm->readLine(); - if( !mxTextStrm->isEof() ) + OUString aLine = rTextStrm.readLine(); + if( !rTextStrm.isEof() || (aLine.getLength() > 0) ) implDumpLine( aLine, ++nLine ); } - mxOut->emptyLine(); } -void TextStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine ) +void TextLineStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine ) { TableGuard aTabGuard( mxOut, 8 ); mxOut->writeDec( nLine, 6 ); @@ -2948,110 +2929,93 @@ void TextStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine ) // ============================================================================ -XmlStreamObject::XmlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) : - TextStreamObject( rParent, rxStrm, RTL_TEXTENCODING_UTF8, rSysFileName ) +XmlStreamObject::XmlStreamObject( const ObjectBase& rParent, + const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) { + TextStreamObjectBase::construct( rParent, rxStrm, RTL_TEXTENCODING_UTF8, rSysFileName ); } -void XmlStreamObject::implDump() +XmlStreamObject::XmlStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm ) { - maIncompleteLine = OUString(); - TextStreamObject::implDump(); - if( maIncompleteLine.getLength() > 0 ) - { - mxOut->resetIndent(); - mxOut->writeString( maIncompleteLine ); - mxOut->emptyLine(); - writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM ); - } + TextStreamObjectBase::construct( rParent, rxStrm, RTL_TEXTENCODING_UTF8 ); } -void XmlStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 ) +void XmlStreamObject::implDumpText( TextInputStream& rTextStrm ) { - // build input line from cached incomplete element and new text data - OUStringBuffer aLine; - if( maIncompleteLine.getLength() > 0 ) - aLine.append( maIncompleteLine ).append( sal_Unicode( ' ' ) ); - aLine.append( rLine ); - maIncompleteLine = OUString(); + /* Buffers a start element and the following element text. Needed to dump + matching start/end elements and the element text on the same line. */ + OUStringBuffer aOldStartElem; + // special handling for VML + bool bIsVml = InputOutputHelper::getFileNameExtension( maSysFileName ).equalsIgnoreAsciiCaseAscii( "vml" ); - if( aLine.getLength() == 0 ) + while( !rTextStrm.isEof() ) { - mxOut->newLine(); - return; - } + // get the next element and the following element text from text stream + OUString aElem = rTextStrm.readToChar( '>', true ).trim(); + OUString aText = rTextStrm.readToChar( '<', false ); - const sal_Unicode* pcPos = aLine.getStr(); - const sal_Unicode* pcEnd = pcPos + aLine.getLength(); - while( pcPos < pcEnd ) - { - OUStringBuffer aOutLine; - bool bIsStartElement = false; - bool bIsComplElement = false; - bool bIsEndElement = false; - - /* check for start element at beginning of the line - pcEnd and thus (pcPos+1) - are dereferenceable, because OUStringBuffer::getStr is null-terminated. */ - if( (*pcPos == '<') && (pcPos[ 1 ] != '/') ) + // remove multiple whitespace from element + sal_Int32 nPos = 0; + while( nPos < aElem.getLength() ) { - const sal_Unicode* pcElementEnd = ::std::find( pcPos, pcEnd, '>' ); - if( pcElementEnd == pcEnd ) - { - // incomplete start element - maIncompleteLine = OUString( pcPos, static_cast< sal_Int32 >( pcEnd - pcPos ) ); - pcPos = pcEnd; - } - else - { - bIsComplElement = (pcPos[ 1 ] == '?') || (pcPos[ 1 ] == '!') || (pcElementEnd[ -1 ] == '/'); - bIsStartElement = !bIsComplElement; - ++pcElementEnd; - aOutLine.append( pcPos, static_cast< sal_Int32 >( pcElementEnd - pcPos ) ); - pcPos = pcElementEnd; - } + while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos; + if( nPos < aElem.getLength() ) + aElem = OUStringBuffer( aElem.copy( 0, nPos ) ).append( sal_Unicode( ' ' ) ).append( aElem.copy( nPos ).trim() ).makeStringAndClear(); + ++nPos; } - // check for following element text - if( !bIsComplElement && (pcPos < pcEnd) ) + sal_Int32 nElemLen = aElem.getLength(); + if( (nElemLen >= 2) && (aElem[ 0 ] == '<') && (aElem[ nElemLen - 1 ] == '>') ) { - const sal_Unicode* pcElementStart = ::std::find( pcPos, pcEnd, '<' ); - // append text between elements - if( pcPos < pcElementStart ) + // determine type of the element + bool bSimpleElem = (aElem[ 1 ] == '!') || (aElem[ 1 ] == '?') || (aElem[ nElemLen - 2 ] == '/') || + (bIsVml && (nElemLen == 4) && (aElem[ 1 ] == 'b') && (aElem[ 2 ] == 'r')); + bool bStartElem = !bSimpleElem && (aElem[ 1 ] != '/'); + bool bEndElem = !bSimpleElem && !bStartElem; + + /* Start element or simple element: flush old start element and + its text from previous iteration, and start a new indentation + level for the new element. Trim whitespace and line breaks from + the text of the old start element. */ + if( (bSimpleElem || bStartElem) && (aOldStartElem.getLength() > 0) ) { - OUString aText( pcPos, static_cast< sal_Int32 >( pcElementStart - pcPos ) ); - if( aText.trim().getLength() > 0 ) - aOutLine.append( aText ); - pcPos = pcElementStart; + mxOut->writeString( aOldStartElem.makeStringAndClear().trim() ); + mxOut->newLine(); + mxOut->incIndent(); } - } - // check for stand-alone or following end element - if( !bIsComplElement && (pcPos < pcEnd) && (pcPos[ 1 ] == '/') ) - { - const sal_Unicode* pcElementEnd = ::std::find( pcPos, pcEnd, '>' ); - if( pcElementEnd == pcEnd ) + /* Start element: remember it and its text, to be able to print the + matching end element on the same line in the next iteration. */ + if( bStartElem ) { - // incomplete end element - aOutLine.append( pcPos, static_cast< sal_Int32 >( pcEnd - pcPos ) ); - maIncompleteLine = aOutLine.makeStringAndClear(); - pcPos = pcEnd; + aOldStartElem.append( aElem ).append( aText ); } else { - bIsEndElement = true; - ++pcElementEnd; - aOutLine.append( pcPos, static_cast< sal_Int32 >( pcElementEnd - pcPos ) ); - pcPos = pcElementEnd; - } - } + /* End element: if a start element has been remembered in the + previous iteration, write it out here untrimmed, to show + all whitespace in the element text, and without trailing + line break. Code below will add the end element right after + it. Otherwise, return to previous indentation level. */ + if( bEndElem ) + { + if( aOldStartElem.getLength() == 0 ) + mxOut->decIndent(); + else + mxOut->writeString( aOldStartElem.makeStringAndClear() ); + } - // flush output line - if( maIncompleteLine.getLength() == 0 ) - { - if( !bIsStartElement && bIsEndElement ) mxOut->decIndent(); - mxOut->writeString( aOutLine.makeStringAndClear() ); - mxOut->newLine(); - if( bIsStartElement && !bIsEndElement ) mxOut->incIndent(); + /* Write the element. Write following element text in a new + line, but only, if it does not contain of white space + entirely. */ + mxOut->writeString( aElem ); + mxOut->newLine(); + if( aText.trim().getLength() > 0 ) + { + mxOut->writeString( aText ); + mxOut->newLine(); + } + } } } } @@ -3167,7 +3131,7 @@ bool SequenceRecordObjectBase::implStartRecord( BinaryInputStream& rBaseStrm, sa { ornRecPos = rBaseStrm.tell(); // do not try to overread seekable streams, may cause assertions - bValid = ornRecPos < rBaseStrm.getLength(); + bValid = ornRecPos < rBaseStrm.size(); } // read the record header diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index bd2a0e05ecce..e0135af1604f 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -469,9 +469,9 @@ void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos ) if( nType == OLEPROP_TYPE_INT16 ) { sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ); - rtl_TextEncoding nNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage ); - if( nNewTextEnc != RTL_TEXTENCODING_DONTKNOW ) - meTextEnc = nNewTextEnc; + rtl_TextEncoding eNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage ); + if( eNewTextEnc != RTL_TEXTENCODING_DONTKNOW ) + meTextEnc = eNewTextEnc; mbIsUnicode = nCodePage == CODEPAGE_UNICODE; } else @@ -586,15 +586,8 @@ OUString OlePropertyStreamObject::dumpString8( const String& rName ) OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32 nLen ) { - OUString aData; - size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 ); - if( nNewLen > 0 ) - { - ::std::vector< sal_Char > aBuffer( nNewLen + 1 ); - mxStrm->readMemory( &aBuffer.front(), nNewLen ); - aBuffer[ nNewLen ] = 0; - aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc ); - } + sal_Int32 nNewLen = getLimitedValue< sal_Int32, sal_Int32 >( nLen, 0, 1024 ); + OUString aData = mxStrm->readCharArrayUC( nNewLen, meTextEnc ); writeStringItem( rName, aData ); return aData; } @@ -607,13 +600,8 @@ OUString OlePropertyStreamObject::dumpString16( const String& rName ) OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int32 nLen ) { - size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 ); - ::std::vector< sal_Unicode > aBuffer; - aBuffer.reserve( nNewLen + 1 ); - for( size_t nIdx = 0; nIdx < nNewLen; ++nIdx ) - aBuffer.push_back( static_cast< sal_Unicode >( mxStrm->readuInt16() ) ); - aBuffer.push_back( 0 ); - OUString aData( &aBuffer.front() ); + sal_Int32 nNewLen = getLimitedValue< sal_Int32, sal_Int32 >( nLen, 0, 1024 ); + OUString aData = mxStrm->readUnicodeArray( nNewLen ); writeStringItem( rName, aData ); if( nNewLen & 1 ) dumpUnused( 2 ); // always padding to 32bit return aData; @@ -687,7 +675,7 @@ void OleStorageObject::construct( const ObjectBase& rParent ) StorageObjectBase::construct( rParent ); } -void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName ) +void OleStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName ) { if( rStrmName.equalsAscii( "\001CompObj" ) ) OleCompObjObject( *this, rxStrm, rSysFileName ).dump(); @@ -1926,7 +1914,7 @@ void VbaFStreamObject::dumpSiteData() sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" ); sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" ); sal_Int64 nEndPos = mxStrm->tell() + nSiteLength; - if( ensureValid( nEndPos <= mxStrm->getLength() ) ) + if( ensureValid( nEndPos <= mxStrm->size() ) ) { mxOut->resetItemIndex(); sal_uInt32 nSiteIdx = 0; @@ -1984,7 +1972,7 @@ void VbaOStreamObject::implDump() writeDecItem( "control-id", aIt->mnId ); writeInfoItem( "prog-id", aIt->maProgId ); IndentGuard aIndGuard( mxOut ); - RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, aIt->mnLength ) ); + BinaryInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, aIt->mnLength ) ); FormControlStreamObject( *this, xRelStrm, &aIt->maProgId ).dump(); } } @@ -2068,7 +2056,7 @@ VbaContainerStorageObject::VbaContainerStorageObject( const ObjectBase& rParent, addPreferredStream( "f" ); } -void VbaContainerStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void VbaContainerStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { if( rStrmName.equalsAscii( "f" ) ) VbaFStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump(); @@ -2280,7 +2268,7 @@ void VbaModuleStreamObject::implDump() writeEmptyItem( "source-code" ); IndentGuard aIndGuard( mxOut ); BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxStrm ) ); - TextStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump(); + TextLineStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump(); } // ============================================================================ @@ -2292,7 +2280,7 @@ VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& addPreferredStream( "dir" ); } -void VbaStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void VbaStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "dir" ) ) VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump(); @@ -2310,10 +2298,10 @@ VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const Sto { } -void VbaFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void VbaFormStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { if( rStrmName.equalsAscii( "\003VBFrame" ) ) - TextStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump(); + TextLineStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump(); else VbaContainerStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName ); } @@ -2326,10 +2314,10 @@ VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, con addPreferredStorage( "VBA" ); } -void VbaProjectStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void VbaProjectStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "PROJECT" ) ) - TextStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump(); + TextLineStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump(); else OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName ); } diff --git a/oox/source/dump/pptxdumper.cxx b/oox/source/dump/pptxdumper.cxx index 39e0ccc2be55..c98ffac7e38d 100644 --- a/oox/source/dump/pptxdumper.cxx +++ b/oox/source/dump/pptxdumper.cxx @@ -56,14 +56,13 @@ RootStorageObject::RootStorageObject( const DumperBase& rParent ) StorageObjectBase::construct( rParent ); } -void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName ); - Reference< XInputStream > xInStrm = InputOutputHelper::getXInputStream( *rxStrm ); if( aExt.equalsIgnoreAsciiCaseAscii( "pptx" ) || aExt.equalsIgnoreAsciiCaseAscii( "potx" ) ) { - Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) || @@ -72,7 +71,7 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) || aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) ) { - ::oox::dump::xlsb::Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + ::oox::dump::xlsb::Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "xla" ) || @@ -82,7 +81,7 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) || aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) ) { - ::oox::dump::biff::Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + ::oox::dump::biff::Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "xml" ) || @@ -95,17 +94,17 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons { if( rStrgPath.equalsAscii( "ppt" ) && rStrmName.equalsAscii( "vbaProject.bin" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) ); VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump(); } else if( rStrgPath.equalsAscii( "ppt/embeddings" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) ); OleStorageObject( *this, xStrg, rSysFileName ).dump(); } else if( rStrgPath.equalsAscii( "ppt/activeX" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, true ) ); ActiveXStorageObject( *this, xStrg, rSysFileName ).dump(); } else @@ -125,13 +124,13 @@ Dumper::Dumper( const FilterBase& rFilter ) DumperBase::construct( xCfg ); } -Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) +Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) { - if( rxFactory.is() && rxInStrm.is() ) + if( rxContext.is() && rxInStrm.is() ) { - StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) ); + StorageRef xStrg( new ZipStorage( rxContext, rxInStrm ) ); MediaDescriptor aMediaDesc; - ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) ); + ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName, aMediaDesc ) ); DumperBase::construct( xCfg ); } } diff --git a/oox/source/dump/xlsbdumper.cxx b/oox/source/dump/xlsbdumper.cxx index 3dc2974420a6..a5ffab059b52 100644 --- a/oox/source/dump/xlsbdumper.cxx +++ b/oox/source/dump/xlsbdumper.cxx @@ -368,7 +368,7 @@ void FormulaObject::implDump() if( mnSize < 0 ) return; sal_Int64 nStartPos = mxStrm->tell(); - sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() ); + sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->size() ); bool bValid = mxTokens.get(); mxStack.reset( new FormulaStack ); @@ -889,8 +889,8 @@ bool FormulaObject::dumpAttrToken() void FormulaObject::dumpAddTokenData() { mxOut->resetItemIndex(); - sal_Int32 nAddDataSize = (mxStrm->getLength() - mxStrm->tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0; - sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nAddDataSize, mxStrm->getLength() ); + sal_Int32 nAddDataSize = (mxStrm->size() - mxStrm->tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0; + sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nAddDataSize, mxStrm->size() ); for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !mxStrm->isEof() && (mxStrm->tell() < nEndPos); ++aIt ) { AddDataType eType = *aIt; @@ -2231,10 +2231,9 @@ RootStorageObject::RootStorageObject( const DumperBase& rParent ) StorageObjectBase::construct( rParent ); } -void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) +void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName ) { OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName ); - Reference< XInputStream > xInStrm = InputOutputHelper::getXInputStream( *rxStrm ); if( aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) || aExt.equalsIgnoreAsciiCaseAscii( "xlsm" ) || @@ -2242,7 +2241,7 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) || aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) ) { - Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "xla" ) || @@ -2252,13 +2251,13 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) || aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) ) { - ::oox::dump::biff::Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + ::oox::dump::biff::Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "pptx" ) || aExt.equalsIgnoreAsciiCaseAscii( "potx" ) ) { - ::oox::dump::pptx::Dumper( getFactory(), xInStrm, rSysFileName ).dump(); + ::oox::dump::pptx::Dumper( getContext(), rxStrm, rSysFileName ).dump(); } else if( aExt.equalsIgnoreAsciiCaseAscii( "xml" ) || @@ -2271,12 +2270,12 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons { if( rStrgPath.equalsAscii( "xl" ) && rStrmName.equalsAscii( "vbaProject.bin" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) ); VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump(); } else if( rStrgPath.equalsAscii( "xl/embeddings" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) ); OleStorageObject( *this, xStrg, rSysFileName ).dump(); } else if( @@ -2295,7 +2294,7 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons } else if( rStrgPath.equalsAscii( "xl/activeX" ) ) { - StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) ); + StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, true ) ); ActiveXStorageObject( *this, xStrg, rSysFileName ).dump(); } else @@ -2315,13 +2314,13 @@ Dumper::Dumper( const FilterBase& rFilter ) DumperBase::construct( xCfg ); } -Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) +Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName ) { - if( rxFactory.is() && rxInStrm.is() ) + if( rxContext.is() && rxInStrm.is() ) { - StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) ); + StorageRef xStrg( new ZipStorage( getContext(), rxInStrm ) ); MediaDescriptor aMediaDesc; - ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) ); + ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName, aMediaDesc ) ); DumperBase::construct( xCfg ); } } diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx index 2d547cdbf724..e61000675006 100644 --- a/oox/source/helper/binaryinputstream.cxx +++ b/oox/source/helper/binaryinputstream.cxx @@ -27,6 +27,8 @@ #include "oox/helper/binaryinputstream.hxx" +#include +#include #include #include #include @@ -80,11 +82,16 @@ OString BinaryInputStream::readCharArray( sal_Int32 nChars, bool bAllowNulChars if( nChars <= 0 ) return OString(); - ::std::vector< sal_Char > aBuffer( static_cast< size_t >( nChars ) ); - size_t nCharsRead = static_cast< size_t >( readMemory( &aBuffer.front(), nChars ) ); + ::std::vector< sal_uInt8 > aBuffer; + sal_Int32 nCharsRead = readArray( aBuffer, nChars ); + if( nCharsRead <= 0 ) + return OString(); + + aBuffer.resize( static_cast< size_t >( nCharsRead ) ); if( !bAllowNulChars ) - ::std::replace( aBuffer.begin(), aBuffer.begin() + nCharsRead, '\0', '?' ); - return OString( &aBuffer.front(), nCharsRead ); + ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' ); + + return OString( reinterpret_cast< sal_Char* >( &aBuffer.front() ), nCharsRead ); } OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars ) @@ -94,30 +101,44 @@ OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding OUString BinaryInputStream::readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars ) { - OUStringBuffer aBuffer; - if( nChars > 0 ) - { - aBuffer.ensureCapacity( nChars ); - sal_uInt16 nChar; - for( sal_uInt16 nCharIdx = 0; !mbEof && (nCharIdx < nChars); ++nCharIdx ) - { - readValue( nChar ); - aBuffer.append( static_cast< sal_Unicode >( (!bAllowNulChars && (nChar == 0)) ? '?' : nChar ) ); - } - } - return aBuffer.makeStringAndClear(); + if( nChars <= 0 ) + return OUString(); + + ::std::vector< sal_uInt16 > aBuffer; + sal_Int32 nCharsRead = readArray( aBuffer, nChars ); + if( nCharsRead <= 0 ) + return OUString(); + + aBuffer.resize( static_cast< size_t >( nCharsRead ) ); + if( !bAllowNulChars ) + ::std::replace( aBuffer.begin(), aBuffer.begin() + nCharsRead, '\0', '?' ); + + OUStringBuffer aStringBuffer; + aStringBuffer.ensureCapacity( nCharsRead ); + for( ::std::vector< sal_uInt16 >::iterator aIt = aBuffer.begin(), aEnd = aBuffer.end(); aIt != aEnd; ++aIt ) + aStringBuffer.append( static_cast< sal_Unicode >( *aIt ) ); + return aStringBuffer.makeStringAndClear(); +} + +OUString BinaryInputStream::readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars ) +{ + return bCompressed ? + // ISO-8859-1 maps all byte values 0xHH to the same Unicode code point U+00HH + readCharArrayUC( nChars, RTL_TEXTENCODING_ISO_8859_1, bAllowNulChars ) : + readUnicodeArray( nChars, bAllowNulChars ); } -void BinaryInputStream::copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes ) +void BinaryInputStream::copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes, sal_Int32 nAtomSize ) { if( nBytes > 0 ) { - sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, INPUTSTREAM_BUFFERSIZE ); + // make buffer size a multiple of the passed atom size + sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, (INPUTSTREAM_BUFFERSIZE / nAtomSize) * nAtomSize ); StreamDataSequence aBuffer( nBufferSize ); while( nBytes > 0 ) { sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize ); - sal_Int32 nBytesRead = readData( aBuffer, nReadSize ); + sal_Int32 nBytesRead = readData( aBuffer, nReadSize, nAtomSize ); rOutStrm.writeData( aBuffer ); if( nReadSize == nBytesRead ) nBytes -= nReadSize; @@ -127,14 +148,10 @@ void BinaryInputStream::copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nB } } -void BinaryInputStream::readAtom( void* opMem, sal_uInt8 nSize ) -{ - readMemory( opMem, nSize ); -} - // ============================================================================ BinaryXInputStream::BinaryXInputStream( const Reference< XInputStream >& rxInStrm, bool bAutoClose ) : + BinaryStreamBase( Reference< XSeekable >( rxInStrm, UNO_QUERY ).is() ), BinaryXSeekableStream( Reference< XSeekable >( rxInStrm, UNO_QUERY ) ), maBuffer( INPUTSTREAM_BUFFERSIZE ), mxInStrm( rxInStrm ), @@ -145,16 +162,29 @@ BinaryXInputStream::BinaryXInputStream( const Reference< XInputStream >& rxInStr BinaryXInputStream::~BinaryXInputStream() { - if( mbAutoClose ) - close(); + close(); +} + +void BinaryXInputStream::close() +{ + OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::close - invalid call" ); + if( mbAutoClose && mxInStrm.is() ) try + { + mxInStrm->closeInput(); + } + catch( Exception& ) + { + OSL_ENSURE( false, "BinaryXInputStream::close - closing input stream failed" ); + } + mxInStrm.clear(); + BinaryXSeekableStream::close(); } -sal_Int32 BinaryXInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +sal_Int32 BinaryXInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t /*nAtomSize*/ ) { sal_Int32 nRet = 0; if( !mbEof && (nBytes > 0) ) try { - OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::readData - invalid call" ); nRet = mxInStrm->readBytes( orData, nBytes ); mbEof = nRet != nBytes; } @@ -165,7 +195,7 @@ sal_Int32 BinaryXInputStream::readData( StreamDataSequence& orData, sal_Int32 nB return nRet; } -sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nRet = 0; if( !mbEof && (nBytes > 0) ) @@ -175,7 +205,7 @@ sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes ) while( !mbEof && (nBytes > 0) ) { sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, nBufferSize ); - sal_Int32 nBytesRead = readData( maBuffer, nReadSize ); + sal_Int32 nBytesRead = readData( maBuffer, nReadSize, nAtomSize ); if( nBytesRead > 0 ) memcpy( opnMem, maBuffer.getConstArray(), static_cast< size_t >( nBytesRead ) ); opnMem += nBytesRead; @@ -186,11 +216,10 @@ sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes ) return nRet; } -void BinaryXInputStream::skip( sal_Int32 nBytes ) +void BinaryXInputStream::skip( sal_Int32 nBytes, size_t /*nAtomSize*/ ) { if( !mbEof ) try { - OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::skip - invalid call" ); mxInStrm->skipBytes( nBytes ); } catch( Exception& ) @@ -199,60 +228,48 @@ void BinaryXInputStream::skip( sal_Int32 nBytes ) } } -void BinaryXInputStream::close() -{ - if( mxInStrm.is() ) try - { - mxInStrm->closeInput(); - mxInStrm.clear(); - } - catch( Exception& ) - { - OSL_ENSURE( false, "BinaryXInputStream::close - closing input stream failed" ); - } -} - // ============================================================================ SequenceInputStream::SequenceInputStream( const StreamDataSequence& rData ) : + BinaryStreamBase( true ), SequenceSeekableStream( rData ) { } -sal_Int32 SequenceInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +sal_Int32 SequenceInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t /*nAtomSize*/ ) { sal_Int32 nReadBytes = 0; if( !mbEof ) { - nReadBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos ); + nReadBytes = getMaxBytes( nBytes ); orData.realloc( nReadBytes ); if( nReadBytes > 0 ) - memcpy( orData.getArray(), mrData.getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) ); + memcpy( orData.getArray(), mpData->getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) ); mnPos += nReadBytes; mbEof = nReadBytes < nBytes; } return nReadBytes; } -sal_Int32 SequenceInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 SequenceInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t /*nAtomSize*/ ) { sal_Int32 nReadBytes = 0; if( !mbEof ) { - nReadBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos ); + nReadBytes = getMaxBytes( nBytes ); if( nReadBytes > 0 ) - memcpy( opMem, mrData.getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) ); + memcpy( opMem, mpData->getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) ); mnPos += nReadBytes; mbEof = nReadBytes < nBytes; } return nReadBytes; } -void SequenceInputStream::skip( sal_Int32 nBytes ) +void SequenceInputStream::skip( sal_Int32 nBytes, size_t /*nAtomSize*/ ) { if( !mbEof ) { - sal_Int32 nSkipBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos ); + sal_Int32 nSkipBytes = getMaxBytes( nBytes ); mnPos += nSkipBytes; mbEof = nSkipBytes < nBytes; } @@ -260,73 +277,75 @@ void SequenceInputStream::skip( sal_Int32 nBytes ) // ============================================================================ -RelativeInputStream::RelativeInputStream( BinaryInputStream& rInStrm, sal_Int64 nLength ) : - mrInStrm( rInStrm ), +RelativeInputStream::RelativeInputStream( BinaryInputStream& rInStrm, sal_Int64 nSize ) : + BinaryStreamBase( rInStrm.isSeekable() ), + mpInStrm( &rInStrm ), mnStartPos( rInStrm.tell() ), mnRelPos( 0 ) { sal_Int64 nRemaining = rInStrm.getRemaining(); - mnLength = (nRemaining >= 0) ? ::std::min( nLength, nRemaining ) : nLength; - mbEof = mnLength < 0; + mnSize = (nRemaining >= 0) ? ::std::min( nSize, nRemaining ) : nSize; + mbEof = mbEof || rInStrm.isEof() || (mnSize < 0); } -bool RelativeInputStream::isSeekable() const +sal_Int64 RelativeInputStream::size() const { - return mrInStrm.isSeekable(); -} - -sal_Int64 RelativeInputStream::getLength() const -{ - return mnLength; + return mpInStrm ? mnSize : -1; } sal_Int64 RelativeInputStream::tell() const { - return mnRelPos; + return mpInStrm ? mnRelPos : -1; } void RelativeInputStream::seek( sal_Int64 nPos ) { - if( mrInStrm.isSeekable() && (mnStartPos >= 0) ) + if( mpInStrm && isSeekable() && (mnStartPos >= 0) ) { - mnRelPos = getLimitedValue< sal_Int64, sal_Int64 >( nPos, 0, mnLength ); - mrInStrm.seek( mnStartPos + mnRelPos ); - mbEof = (mnRelPos != nPos) || mrInStrm.isEof(); + mnRelPos = getLimitedValue< sal_Int64, sal_Int64 >( nPos, 0, mnSize ); + mpInStrm->seek( mnStartPos + mnRelPos ); + mbEof = (mnRelPos != nPos) || mpInStrm->isEof(); } } -sal_Int32 RelativeInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +void RelativeInputStream::close() +{ + mpInStrm = 0; + mbEof = true; +} + +sal_Int32 RelativeInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nReadBytes = 0; if( !mbEof ) { - sal_Int32 nRealBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos ); - nReadBytes = mrInStrm.readData( orData, nRealBytes ); + sal_Int32 nMaxBytes = getMaxBytes( nBytes ); + nReadBytes = mpInStrm->readData( orData, nMaxBytes, nAtomSize ); mnRelPos += nReadBytes; - mbEof = (nRealBytes < nBytes) || mrInStrm.isEof(); + mbEof = (nMaxBytes < nBytes) || mpInStrm->isEof(); } return nReadBytes; } -sal_Int32 RelativeInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 RelativeInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nReadBytes = 0; if( !mbEof ) { - sal_Int32 nRealBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos ); - nReadBytes = mrInStrm.readMemory( opMem, nRealBytes ); + sal_Int32 nMaxBytes = getMaxBytes( nBytes ); + nReadBytes = mpInStrm->readMemory( opMem, nMaxBytes, nAtomSize ); mnRelPos += nReadBytes; - mbEof = (nRealBytes < nBytes) || mrInStrm.isEof(); + mbEof = (nMaxBytes < nBytes) || mpInStrm->isEof(); } return nReadBytes; } -void RelativeInputStream::skip( sal_Int32 nBytes ) +void RelativeInputStream::skip( sal_Int32 nBytes, size_t nAtomSize ) { if( !mbEof ) { - sal_Int32 nSkipBytes = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnLength - mnRelPos ); - mrInStrm.skip( nSkipBytes ); + sal_Int32 nSkipBytes = getMaxBytes( nBytes ); + mpInStrm->skip( nSkipBytes, nAtomSize ); mnRelPos += nSkipBytes; mbEof = nSkipBytes < nBytes; } diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx index f4ea9378aa90..1ae7b15d7595 100644 --- a/oox/source/helper/binaryoutputstream.cxx +++ b/oox/source/helper/binaryoutputstream.cxx @@ -27,6 +27,8 @@ #include "oox/helper/binaryoutputstream.hxx" +#include +#include #include #include @@ -45,14 +47,8 @@ const sal_Int32 OUTPUTSTREAM_BUFFERSIZE = 0x8000; // ============================================================================ -void BinaryOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize ) -{ - writeMemory( pMem, nSize ); -} - -// ============================================================================ - BinaryXOutputStream::BinaryXOutputStream( const Reference< XOutputStream >& rxOutStrm, bool bAutoClose ) : + BinaryStreamBase( Reference< XSeekable >( rxOutStrm, UNO_QUERY ).is() ), BinaryXSeekableStream( Reference< XSeekable >( rxOutStrm, UNO_QUERY ) ), maBuffer( OUTPUTSTREAM_BUFFERSIZE ), mxOutStrm( rxOutStrm ), @@ -63,15 +59,30 @@ BinaryXOutputStream::BinaryXOutputStream( const Reference< XOutputStream >& rxOu BinaryXOutputStream::~BinaryXOutputStream() { - if( mbAutoClose ) - close(); + close(); +} + +void BinaryXOutputStream::close() +{ + OSL_ENSURE( mxOutStrm.is(), "BinaryXOutputStream::close - invalid call" ); + if( mxOutStrm.is() ) try + { + mxOutStrm->flush(); + if( mbAutoClose ) + mxOutStrm->closeOutput(); + } + catch( Exception& ) + { + OSL_ENSURE( false, "BinaryXOutputStream::close - closing output stream failed" ); + } + mxOutStrm.clear(); + BinaryXSeekableStream::close(); } -void BinaryXOutputStream::writeData( const StreamDataSequence& rData ) +void BinaryXOutputStream::writeData( const StreamDataSequence& rData, size_t /*nAtomSize*/ ) { - try + if( mxOutStrm.is() ) try { - OSL_ENSURE( mxOutStrm.is(), "BinaryXOutputStream::writeData - invalid call" ); mxOutStrm->writeBytes( rData ); } catch( Exception& ) @@ -80,57 +91,45 @@ void BinaryXOutputStream::writeData( const StreamDataSequence& rData ) } } -void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes ) +void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize ) { - if( nBytes > 0 ) + if( mxOutStrm.is() && (nBytes > 0) ) { - sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, OUTPUTSTREAM_BUFFERSIZE ); + sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, (OUTPUTSTREAM_BUFFERSIZE / nAtomSize) * nAtomSize ); const sal_uInt8* pnMem = reinterpret_cast< const sal_uInt8* >( pMem ); while( nBytes > 0 ) { sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, nBufferSize ); maBuffer.realloc( nWriteSize ); memcpy( maBuffer.getArray(), pnMem, static_cast< size_t >( nWriteSize ) ); - writeData( maBuffer ); + writeData( maBuffer, nAtomSize ); pnMem += nWriteSize; nBytes -= nWriteSize; } } } -void BinaryXOutputStream::close() -{ - if( mxOutStrm.is() ) try - { - mxOutStrm->flush(); - mxOutStrm->closeOutput(); - } - catch( Exception& ) - { - OSL_ENSURE( false, "BinaryXOutputStream::close - closing output stream failed" ); - } -} - // ============================================================================ SequenceOutputStream::SequenceOutputStream( StreamDataSequence& rData ) : + BinaryStreamBase( true ), SequenceSeekableStream( rData ) { } -void SequenceOutputStream::writeData( const StreamDataSequence& rData ) +void SequenceOutputStream::writeData( const StreamDataSequence& rData, size_t nAtomSize ) { - if( rData.hasElements() ) - writeMemory( rData.getConstArray(), rData.getLength() ); + if( mpData && rData.hasElements() ) + writeMemory( rData.getConstArray(), rData.getLength(), nAtomSize ); } -void SequenceOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes ) +void SequenceOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_t /*nAtomSize*/ ) { - if( nBytes > 0 ) + if( mpData && (nBytes > 0) ) { - if( mrData.getLength() - mnPos < nBytes ) - const_cast< StreamDataSequence& >( mrData ).realloc( mnPos + nBytes ); - memcpy( const_cast< StreamDataSequence& >( mrData ).getArray() + mnPos, pMem, static_cast< size_t >( nBytes ) ); + if( mpData->getLength() - mnPos < nBytes ) + const_cast< StreamDataSequence* >( mpData )->realloc( mnPos + nBytes ); + memcpy( const_cast< StreamDataSequence* >( mpData )->getArray() + mnPos, pMem, static_cast< size_t >( nBytes ) ); mnPos += nBytes; } } diff --git a/oox/source/helper/binarystreambase.cxx b/oox/source/helper/binarystreambase.cxx index d1e11850a68c..f189a37f97f5 100644 --- a/oox/source/helper/binarystreambase.cxx +++ b/oox/source/helper/binarystreambase.cxx @@ -27,6 +27,7 @@ #include "oox/helper/binarystreambase.hxx" +#include #include namespace oox { @@ -42,30 +43,11 @@ BinaryStreamBase::~BinaryStreamBase() { } -bool BinaryStreamBase::isSeekable() const -{ - return false; -} - -sal_Int64 BinaryStreamBase::getLength() const -{ - return -1; -} - -sal_Int64 BinaryStreamBase::tell() const -{ - return -1; -} - -void BinaryStreamBase::seek( sal_Int64 ) -{ -} - sal_Int64 BinaryStreamBase::getRemaining() const { // do not use isSeekable(), implementations may provide stream position and size even if not seekable sal_Int64 nPos = tell(); - sal_Int64 nLen = getLength(); + sal_Int64 nLen = size(); return ((nPos >= 0) && (nLen >= 0)) ? ::std::max< sal_Int64 >( nLen - nPos, 0 ) : -1; } @@ -73,7 +55,7 @@ void BinaryStreamBase::alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos { sal_Int64 nStrmPos = tell(); // nothing to do, if stream is at anchor position - if( isSeekable() && (0 <= nAnchorPos) && (nAnchorPos != nStrmPos) && (nBlockSize > 1) ) + if( mbSeekable && (0 <= nAnchorPos) && (nAnchorPos != nStrmPos) && (nBlockSize > 1) ) { // prevent modulo with negative arguments... sal_Int64 nSkipSize = (nAnchorPos < nStrmPos) ? @@ -86,16 +68,16 @@ void BinaryStreamBase::alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos // ============================================================================ BinaryXSeekableStream::BinaryXSeekableStream( const Reference< XSeekable >& rxSeekable ) : + BinaryStreamBase( mxSeekable.is() ), mxSeekable( rxSeekable ) { } -bool BinaryXSeekableStream::isSeekable() const +BinaryXSeekableStream::~BinaryXSeekableStream() { - return mxSeekable.is(); } -sal_Int64 BinaryXSeekableStream::getLength() const +sal_Int64 BinaryXSeekableStream::size() const { if( mxSeekable.is() ) try { @@ -103,7 +85,7 @@ sal_Int64 BinaryXSeekableStream::getLength() const } catch( Exception& ) { - OSL_ENSURE( false, "BinaryXSeekableStream::getLength - exception caught" ); + OSL_ENSURE( false, "BinaryXSeekableStream::size - exception caught" ); } return -1; } @@ -134,27 +116,44 @@ void BinaryXSeekableStream::seek( sal_Int64 nPos ) } } +void BinaryXSeekableStream::close() +{ + mxSeekable.clear(); + mbEof = true; +} + // ============================================================================ -bool SequenceSeekableStream::isSeekable() const +SequenceSeekableStream::SequenceSeekableStream( const StreamDataSequence& rData ) : + BinaryStreamBase( true ), + mpData( &rData ), + mnPos( 0 ) { - return true; } -sal_Int64 SequenceSeekableStream::getLength() const +sal_Int64 SequenceSeekableStream::size() const { - return mrData.getLength(); + return mpData ? mpData->getLength() : -1; } sal_Int64 SequenceSeekableStream::tell() const { - return mnPos; + return mpData ? mnPos : -1; } void SequenceSeekableStream::seek( sal_Int64 nPos ) { - mnPos = getLimitedValue< sal_Int32, sal_Int64 >( nPos, 0, mrData.getLength() ); - mbEof = mnPos != nPos; + if( mpData ) + { + mnPos = getLimitedValue< sal_Int32, sal_Int64 >( nPos, 0, mpData->getLength() ); + mbEof = mnPos != nPos; + } +} + +void SequenceSeekableStream::close() +{ + mpData = 0; + mbEof = true; } // ============================================================================ diff --git a/oox/source/helper/containerhelper.cxx b/oox/source/helper/containerhelper.cxx index e7f322ff10e3..4fb0d93d6224 100644 --- a/oox/source/helper/containerhelper.cxx +++ b/oox/source/helper/containerhelper.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "oox/helper/helper.hxx" @@ -46,12 +47,13 @@ using ::rtl::OUStringBuffer; // ============================================================================ -Reference< XIndexContainer > ContainerHelper::createIndexContainer( const Reference< XMultiServiceFactory >& rxFactory ) +Reference< XIndexContainer > ContainerHelper::createIndexContainer( const Reference< XComponentContext >& rxContext ) { Reference< XIndexContainer > xContainer; - if( rxFactory.is() ) try + if( rxContext.is() ) try { - xContainer.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.IndexedPropertyValues" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + xContainer.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.IndexedPropertyValues" ) ), UNO_QUERY_THROW ); } catch( Exception& ) { @@ -78,12 +80,13 @@ bool ContainerHelper::insertByIndex( return bRet; } -Reference< XNameContainer > ContainerHelper::createNameContainer( const Reference< XMultiServiceFactory >& rxFactory ) +Reference< XNameContainer > ContainerHelper::createNameContainer( const Reference< XComponentContext >& rxContext ) { Reference< XNameContainer > xContainer; - if( rxFactory.is() ) try + if( rxContext.is() ) try { - xContainer.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.NamedPropertyValues" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + xContainer.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.NamedPropertyValues" ) ), UNO_QUERY_THROW ); } catch( Exception& ) { diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 2e5a612699e2..aeed0322b536 100755 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -69,14 +69,13 @@ inline sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double fPixelPerHmm // ============================================================================ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rxTargetFrame, const StorageRef& rxStorage ) : - mxCompContext( rxContext ), + mxContext( rxContext ), mxStorage( rxStorage ), maGraphicObjScheme( CREATE_OUSTRING( "vnd.sun.star.GraphicObject:" ) ) { - OSL_ENSURE( mxCompContext.is(), "GraphicHelper::GraphicHelper - missing component context" ); - Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW ); + OSL_ENSURE( mxContext.is(), "GraphicHelper::GraphicHelper - missing component context" ); + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY ); OSL_ENSURE( xFactory.is(), "GraphicHelper::GraphicHelper - missing service factory" ); - if( xFactory.is() ) mxGraphicProvider.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ); @@ -319,9 +318,9 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr OUString GraphicHelper::createGraphicObject( const Reference< XGraphic >& rxGraphic ) const { OUString aGraphicObjUrl; - if( mxCompContext.is() && rxGraphic.is() ) try + if( mxContext.is() && rxGraphic.is() ) try { - Reference< XGraphicObject > xGraphicObj( GraphicObject::create( mxCompContext ), UNO_SET_THROW ); + Reference< XGraphicObject > xGraphicObj( GraphicObject::create( mxContext ), UNO_SET_THROW ); xGraphicObj->setGraphic( rxGraphic ); maGraphicObjects.push_back( xGraphicObj ); aGraphicObjUrl = maGraphicObjScheme + xGraphicObj->getUniqueID(); diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx index f9d8af74bcb8..d9c5bddff0f2 100644 --- a/oox/source/helper/modelobjecthelper.cxx +++ b/oox/source/helper/modelobjecthelper.cxx @@ -48,12 +48,12 @@ using ::rtl::OUString; // ============================================================================ -ObjectContainer::ObjectContainer( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) : - mxFactory( rxFactory ), +ObjectContainer::ObjectContainer( const Reference< XMultiServiceFactory >& rxModelFactory, const OUString& rServiceName ) : + mxModelFactory( rxModelFactory ), maServiceName( rServiceName ), mnIndex( 0 ) { - OSL_ENSURE( mxFactory.is(), "ObjectContainer::ObjectContainer - missing service factory" ); + OSL_ENSURE( mxModelFactory.is(), "ObjectContainer::ObjectContainer - missing service factory" ); } ObjectContainer::~ObjectContainer() @@ -94,9 +94,10 @@ OUString ObjectContainer::insertObject( const OUString& rObjName, const Any& rOb void ObjectContainer::createContainer() const { - if( !mxContainer.is() && mxFactory.is() ) try + if( !mxContainer.is() && mxModelFactory.is() ) try { - mxContainer.set( mxFactory->createInstance( maServiceName ), UNO_QUERY_THROW ); + mxContainer.set( mxModelFactory->createInstance( maServiceName ), UNO_QUERY_THROW ); + mxModelFactory.clear(); } catch( Exception& ) { diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx index 769bd9974fb9..c21b8959e2bc 100644 --- a/oox/source/helper/propertyset.cxx +++ b/oox/source/helper/propertyset.cxx @@ -48,6 +48,26 @@ void PropertySet::set( const Reference< XPropertySet >& rxPropSet ) { mxPropSet = rxPropSet; mxMultiPropSet.set( mxPropSet, UNO_QUERY ); + if( mxPropSet.is() ) try + { + mxPropSetInfo = mxPropSet->getPropertySetInfo(); + } + catch( Exception& ) + { + } +} + +bool PropertySet::hasProperty( sal_Int32 nPropId ) const +{ + if( mxPropSetInfo.is() ) try + { + const OUString& rPropName = PropertyMap::getPropertyName( nPropId ); + return mxPropSetInfo->hasPropertyByName( rPropName ); + } + catch( Exception& ) + { + } + return false; } // Get properties ------------------------------------------------------------- diff --git a/oox/source/helper/textinputstream.cxx b/oox/source/helper/textinputstream.cxx index d590781c6fd3..9087dea7b26f 100644 --- a/oox/source/helper/textinputstream.cxx +++ b/oox/source/helper/textinputstream.cxx @@ -27,102 +27,209 @@ #include "oox/helper/textinputstream.hxx" -#include -#include +#include +#include +#include +#include #include "oox/helper/binaryinputstream.hxx" namespace oox { // ============================================================================ -using ::rtl::OStringBuffer; -using ::rtl::OStringToOUString; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + using ::rtl::OUString; -using ::rtl::OUStringBuffer; // ============================================================================ namespace { -/** Reads a text line from stream. First, tries to skip the second character of - a two-character line end sequence. Returns the new line-end character. */ -template< typename BufferType, typename CharType, typename StreamDataType > -sal_Unicode lclReadLine( BufferType& orBuffer, BinaryInputStream& rInStrm, sal_Unicode cLastEolChar ) +typedef ::cppu::WeakImplHelper1< XInputStream > UnoBinaryInputStream_BASE; + +/** Implementation of a UNO input stream wrapping a binary input stream. + */ +class UnoBinaryInputStream : public UnoBinaryInputStream_BASE { - // try to skip LF following CR, or CR following LF - if( !rInStrm.isEof() && (cLastEolChar != 0) ) - { - CharType cChar = static_cast< CharType >( rInStrm.readValue< StreamDataType >() ); - // return on EOF after line-end - if( rInStrm.isEof() ) - return 0; - // return on sequence of equal line-end characters - bool bIsEolChar = (cChar == 10) || (cChar == 13); - if( bIsEolChar && (cChar == cLastEolChar) ) - return cChar; - // append the character, if it is not the other line-end charcter - if( !bIsEolChar ) - orBuffer.append( cChar ); - } +public: + explicit UnoBinaryInputStream( BinaryInputStream& rInStrm ); + + virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException); + virtual sal_Int32 SAL_CALL available() + throw (NotConnectedException, IOException, RuntimeException); + virtual void SAL_CALL closeInput() + throw (NotConnectedException, IOException, RuntimeException); + +private: + void ensureConnected() const throw (NotConnectedException); + +private: + BinaryInputStream* mpInStrm; +}; + +// ---------------------------------------------------------------------------- + +UnoBinaryInputStream::UnoBinaryInputStream( BinaryInputStream& rInStrm ) : + mpInStrm( &rInStrm ) +{ +} - // read chars until EOF or line end character (LF or CR) - while( true ) - { - CharType cChar = static_cast< CharType >( rInStrm.readValue< StreamDataType >() ); - if( rInStrm.isEof() ) - return 0; - if( (cChar == 10) || (cChar == 13) ) - return cChar; - orBuffer.append( cChar ); - } +sal_Int32 SAL_CALL UnoBinaryInputStream::readBytes( Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + ensureConnected(); + return mpInStrm->readData( rData, nBytesToRead, 1 ); +} + +sal_Int32 SAL_CALL UnoBinaryInputStream::readSomeBytes( Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + ensureConnected(); + return mpInStrm->readData( rData, nMaxBytesToRead, 1 ); +} + +void SAL_CALL UnoBinaryInputStream::skipBytes( sal_Int32 nBytesToSkip ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + ensureConnected(); + mpInStrm->skip( nBytesToSkip, 1 ); +} + +sal_Int32 SAL_CALL UnoBinaryInputStream::available() throw (NotConnectedException, IOException, RuntimeException) +{ + ensureConnected(); + throw RuntimeException( CREATE_OUSTRING( "Functionality not supported" ), Reference< XInputStream >() ); +} + +void SAL_CALL UnoBinaryInputStream::closeInput() throw (NotConnectedException, IOException, RuntimeException) +{ + ensureConnected(); + mpInStrm->close(); + mpInStrm = 0; +} + +void UnoBinaryInputStream::ensureConnected() const throw (NotConnectedException) +{ + if( !mpInStrm ) + throw NotConnectedException( CREATE_OUSTRING( "Stream closed" ), Reference< XInterface >() ); } } // namespace // ============================================================================ -TextInputStream::TextInputStream( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc ) : - mrInStrm( rInStrm ), - meTextEnc( eTextEnc ), - mcLastEolChar( 0 ) +TextInputStream::TextInputStream( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, rtl_TextEncoding eTextEnc ) +{ + init( rxContext, rxInStrm, eTextEnc ); +} + +TextInputStream::TextInputStream( const Reference< XComponentContext >& rxContext, BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc ) +{ + init( rxContext, new UnoBinaryInputStream( rInStrm ), eTextEnc ); +} + +TextInputStream::~TextInputStream() { } bool TextInputStream::isEof() const { - // do not return EOF, if last text line missed line-end character (see below) - return mrInStrm.isEof() && (mcLastEolChar == 0); + if( mxTextStrm.is() ) try + { + return mxTextStrm->isEOF(); + } + catch( Exception& ) + { + } + return true; } OUString TextInputStream::readLine() { - if( mrInStrm.isEof() ) + if( mxTextStrm.is() ) try + { + /* The function createFinalString() adds a character that may have + been buffered in the previous call of readToChar() (see below). */ + return createFinalString( mxTextStrm->readLine() ); + } + catch( Exception& ) { - mcLastEolChar = 0; - return OUString(); + mxTextStrm.clear(); } + return OUString(); +} - OUString aLine; - if( meTextEnc == RTL_TEXTENCODING_UCS2 ) +OUString TextInputStream::readToChar( sal_Unicode cChar, bool bIncludeChar ) +{ + if( mxTextStrm.is() ) try { - // read 16-bit characters for UCS2 encoding - OUStringBuffer aBuffer; - mcLastEolChar = lclReadLine< OUStringBuffer, sal_Unicode, sal_uInt16 >( aBuffer, mrInStrm, mcLastEolChar ); - aLine = aBuffer.makeStringAndClear(); + Sequence< sal_Unicode > aDelimiters( 1 ); + aDelimiters[ 0 ] = cChar; + /* Always get the delimiter character from the UNO text input stream. + In difference to this implementation, it will not return it in the + next call but silently skip it. If caller specifies to exclude the + character in this call, it will be returned in the next call of one + of the own member functions. The function createFinalString() adds + a character that has been buffered in the previous call. */ + OUString aString = createFinalString( mxTextStrm->readString( aDelimiters, sal_False ) ); + // remove last character from string and remember it for next call + if( !bIncludeChar && (aString.getLength() > 0) && (aString[ aString.getLength() - 1 ] == cChar) ) + { + mcPendingChar = cChar; + aString = aString.copy( 0, aString.getLength() - 1 ); + } + return aString; } - else + catch( Exception& ) { - // otherwise, read 8-bit characters and convert according to text encoding - OStringBuffer aBuffer; - mcLastEolChar = lclReadLine< OStringBuffer, sal_Char, sal_uInt8 >( aBuffer, mrInStrm, mcLastEolChar ); - aLine = OStringToOUString( aBuffer.makeStringAndClear(), meTextEnc ); + mxTextStrm.clear(); } + return OUString(); +} - // if last line is not empty but line-end character is missing, do not return EOF - if( mrInStrm.isEof() && (aLine.getLength() > 0) ) - mcLastEolChar = 10; +/*static*/ Reference< XTextInputStream > TextInputStream::createXTextInputStream( + const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, rtl_TextEncoding eTextEnc ) +{ + Reference< XTextInputStream > xTextStrm; + const char* pcCharset = rtl_getMimeCharsetFromTextEncoding( eTextEnc ); + OSL_ENSURE( pcCharset, "TextInputStream::createXTextInputStream - unsupported text encoding" ); + if( rxContext.is() && rxInStrm.is() && pcCharset ) try + { + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XActiveDataSink > xDataSink( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW ); + xDataSink->setInputStream( rxInStrm ); + xTextStrm.set( xDataSink, UNO_QUERY_THROW ); + xTextStrm->setEncoding( OUString::createFromAscii( pcCharset ) ); + } + catch( Exception& ) + { + } + return xTextStrm; +} - return aLine; +// private -------------------------------------------------------------------- + +OUString TextInputStream::createFinalString( const OUString& rString ) +{ + if( mcPendingChar == 0 ) + return rString; + + OUString aString = OUString( mcPendingChar ) + rString; + mcPendingChar = 0; + return aString; +} + +void TextInputStream::init( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, rtl_TextEncoding eTextEnc ) +{ + mcPendingChar = 0; + mxTextStrm = createXTextInputStream( rxContext, rxInStrm, eTextEnc ); } // ============================================================================ diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index 8145e7c4e5ce..fc976d8d7537 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "oox/helper/helper.hxx" @@ -50,14 +51,12 @@ using ::rtl::OUString; // ============================================================================ -ZipStorage::ZipStorage( - const Reference< XMultiServiceFactory >& rxFactory, - const Reference< XInputStream >& rxInStream ) : +ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStream ) : StorageBase( rxInStream, false ) { - OSL_ENSURE( rxFactory.is(), "ZipStorage::ZipStorage - missing service factory" ); + OSL_ENSURE( rxContext.is(), "ZipStorage::ZipStorage - missing component context" ); // create base storage object - try + if( rxContext.is() ) try { /* #i105325# ::comphelper::OStorageHelper::GetStorageFromInputStream() cannot be used here as it will open a storage with format type @@ -69,26 +68,26 @@ ZipStorage::ZipStorage( TODO: #i105410# switch to 'OFOPXMLFormat' and use its implementation of relations handling. */ + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( - ZIP_STORAGE_FORMAT_STRING, rxInStream, rxFactory, sal_True ); + ZIP_STORAGE_FORMAT_STRING, rxInStream, xFactory, sal_True ); } catch( Exception& ) { } } -ZipStorage::ZipStorage( - const Reference< XMultiServiceFactory >& rxFactory, - const Reference< XStream >& rxStream ) : +ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const Reference< XStream >& rxStream ) : StorageBase( rxStream, false ) { - OSL_ENSURE( rxFactory.is(), "ZipStorage::ZipStorage - missing service factory" ); + OSL_ENSURE( rxContext.is(), "ZipStorage::ZipStorage - missing component context" ); // create base storage object - try + if( rxContext.is() ) try { - using namespace ::com::sun::star::embed::ElementModes; + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + const sal_Int32 nOpenMode = ElementModes::READWRITE | ElementModes::TRUNCATE; mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( - OFOPXML_STORAGE_FORMAT_STRING, rxStream, READWRITE | TRUNCATE, rxFactory, sal_True ); + OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, xFactory, sal_True ); } catch( Exception& ) { diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx index 493d6b68c6ff..58610e419f32 100644 --- a/oox/source/ole/axbinaryreader.cxx +++ b/oox/source/ole/axbinaryreader.cxx @@ -48,14 +48,22 @@ const sal_uInt32 AX_STRING_COMPRESSED = 0x80000000; // ============================================================================ AxAlignedInputStream::AxAlignedInputStream( BinaryInputStream& rInStrm ) : - mrInStrm( rInStrm ), - mnStrmPos( 0 ) + BinaryStreamBase( false ), + mpInStrm( &rInStrm ), + mnStrmPos( 0 ), + mnStrmSize( rInStrm.getRemaining() ) { + mbEof = mbEof || rInStrm.isEof(); +} + +sal_Int64 AxAlignedInputStream::size() const +{ + return mpInStrm ? mnStrmSize : -1; } sal_Int64 AxAlignedInputStream::tell() const { - return mnStrmPos; + return mpInStrm ? mnStrmPos : -1; } void AxAlignedInputStream::seek( sal_Int64 nPos ) @@ -65,24 +73,44 @@ void AxAlignedInputStream::seek( sal_Int64 nPos ) skip( static_cast< sal_Int32 >( nPos - mnStrmPos ) ); } -sal_Int32 AxAlignedInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +void AxAlignedInputStream::close() +{ + mpInStrm = 0; + mbEof = true; +} + +sal_Int32 AxAlignedInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) { - sal_Int32 nReadSize = mrInStrm.readData( orData, nBytes ); - mnStrmPos += nReadSize; + sal_Int32 nReadSize = 0; + if( !mbEof ) + { + nReadSize = mpInStrm->readData( orData, nBytes, nAtomSize ); + mnStrmPos += nReadSize; + mbEof = mpInStrm->isEof(); + } return nReadSize; } -sal_Int32 AxAlignedInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 AxAlignedInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize ) { - sal_Int32 nReadSize = mrInStrm.readMemory( opMem, nBytes ); - mnStrmPos += nReadSize; + sal_Int32 nReadSize = 0; + if( !mbEof ) + { + nReadSize = mpInStrm->readMemory( opMem, nBytes, nAtomSize ); + mnStrmPos += nReadSize; + mbEof = mpInStrm->isEof(); + } return nReadSize; } -void AxAlignedInputStream::skip( sal_Int32 nBytes ) +void AxAlignedInputStream::skip( sal_Int32 nBytes, size_t nAtomSize ) { - mrInStrm.skip( nBytes ); - mnStrmPos += nBytes; + if( !mbEof ) + { + mpInStrm->skip( nBytes, nAtomSize ); + mnStrmPos += nBytes; + mbEof = mpInStrm->isEof(); + } } void AxAlignedInputStream::align( size_t nSize ) @@ -174,10 +202,7 @@ bool lclReadString( AxAlignedInputStream& rInStrm, OUString& rValue, sal_uInt32 OSL_ENSURE( bValidChars, "lclReadString - string too long" ); sal_Int64 nEndPos = rInStrm.tell() + nChars * (bCompressed ? 1 : 2); nChars = ::std::min< sal_Int32 >( nChars, 65536 ); - rValue = bCompressed ? - // ISO-8859-1 maps all byte values xx to the same Unicode code point U+00xx - rInStrm.readCharArrayUC( nChars, RTL_TEXTENCODING_ISO_8859_1 ) : - rInStrm.readUnicodeArray( nChars ); + rValue = rInStrm.readCompressedUnicodeArray( nChars, bCompressed ); rInStrm.seek( nEndPos ); return bValidChars; } diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 86cc55df3127..40dfdf1ca84e 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -226,11 +226,11 @@ void lclPrepareConverter( PropertySet& rConverter, const Reference< XModel >& rx { if( !rConverter.is() ) try { - Reference< XMultiServiceFactory > xFactory( rxDocModel, UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xModelFactory( rxDocModel, UNO_QUERY_THROW ); OUString aServiceName = bRange ? CREATE_OUSTRING( "com.sun.star.table.CellRangeAddressConversion" ) : CREATE_OUSTRING( "com.sun.star.table.CellAddressConversion" ); - rConverter.set( xFactory->createInstance( aServiceName ) ); + rConverter.set( xModelFactory->createInstance( aServiceName ) ); } catch( Exception& ) { @@ -344,8 +344,8 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo aArgs[ 0 ] <<= aValue; // create the CellValueBinding instance and set at the control model - Reference< XMultiServiceFactory > xFactory( mxDocModel, UNO_QUERY_THROW ); - Reference< XValueBinding > xBinding( xFactory->createInstanceWithArguments( + Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW ); + Reference< XValueBinding > xBinding( xModelFactory->createInstanceWithArguments( CREATE_OUSTRING( "com.sun.star.table.CellValueBinding" ), aArgs ), UNO_QUERY_THROW ); xBindable->setValueBinding( xBinding ); } @@ -376,8 +376,8 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo aArgs[ 0 ] <<= aValue; // create the EntrySource instance and set at the control model - Reference< XMultiServiceFactory > xFactory( mxDocModel, UNO_QUERY_THROW ); - Reference< XListEntrySource > xEntrySource( xFactory->createInstanceWithArguments( + Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW ); + Reference< XListEntrySource > xEntrySource( xModelFactory->createInstanceWithArguments( CREATE_OUSTRING( "com.sun.star.table.CellRangeListSource" ), aArgs ), UNO_QUERY_THROW ); xEntrySink->setListEntrySource( xEntrySource ); } diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx index f45e8e2590c9..a81ae99f0c11 100644 --- a/oox/source/ole/axcontrolfragment.cxx +++ b/oox/source/ole/axcontrolfragment.cxx @@ -140,7 +140,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath ); if( xStrgStrm.is() ) { - OleStorage aStorage( getFilter().getServiceFactory(), xStrgStrm, false ); + OleStorage aStorage( getFilter().getComponentContext(), xStrgStrm, false ); BinaryXInputStream aInStrm( aStorage.openInputStream( CREATE_OUSTRING( "f" ) ), true ); if( !aInStrm.isEof() ) if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModelFromGuid( aClassId ) ) ) diff --git a/oox/source/ole/oleobjecthelper.cxx b/oox/source/ole/oleobjecthelper.cxx index 396cd6b53874..5a38d9316a36 100644 --- a/oox/source/ole/oleobjecthelper.cxx +++ b/oox/source/ole/oleobjecthelper.cxx @@ -44,6 +44,7 @@ namespace ole { using namespace ::com::sun::star::awt; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::embed; using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -61,12 +62,17 @@ OleObjectInfo::OleObjectInfo() : // ============================================================================ -OleObjectHelper::OleObjectHelper( const Reference< XMultiServiceFactory >& rxFactory ) : +OleObjectHelper::OleObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) : maEmbeddedObjScheme( CREATE_OUSTRING( "vnd.sun.star.EmbeddedObject:" ) ), mnObjectId( 100 ) { - if( rxFactory.is() ) - mxResolver.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.ImportEmbeddedObjectResolver" ) ), UNO_QUERY ); + if( rxModelFactory.is() ) try + { + mxResolver.set( rxModelFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.ImportEmbeddedObjectResolver" ) ), UNO_QUERY ); + } + catch( Exception& ) + { + } } OleObjectHelper::~OleObjectHelper() @@ -122,11 +128,7 @@ bool OleObjectHelper::importOleObject( PropertyMap& rPropMap, const OleObjectInf if( bRet ) { - // aspect mode - using namespace ::com::sun::star::embed::Aspects; - sal_Int64 nAspect = rOleObject.mbShowAsIcon ? MSOLE_ICON : MSOLE_CONTENT; - rPropMap[ PROP_Aspect ] <<= nAspect; - // visual area + rPropMap[ PROP_Aspect ] <<= (rOleObject.mbShowAsIcon ? Aspects::MSOLE_ICON : Aspects::MSOLE_CONTENT); rPropMap[ PROP_VisualArea ] <<= Rectangle( 0, 0, rObjSize.Width, rObjSize.Height ); } return bRet; diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx index cf55d6463778..2db4aed76834 100644 --- a/oox/source/ole/olestorage.cxx +++ b/oox/source/ole/olestorage.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/binaryoutputstream.hxx" @@ -68,7 +69,7 @@ class OleOutputStream : public OleOutputStreamBase { public: explicit OleOutputStream( - const Reference< XMultiServiceFactory >& rxFactory, + const Reference< XComponentContext >& rxContext, const Reference< XNameContainer >& rxStorage, const OUString& rElementName ); virtual ~OleOutputStream(); @@ -95,14 +96,15 @@ private: // ---------------------------------------------------------------------------- -OleOutputStream::OleOutputStream( const Reference< XMultiServiceFactory >& rxFactory, +OleOutputStream::OleOutputStream( const Reference< XComponentContext >& rxContext, const Reference< XNameContainer >& rxStorage, const OUString& rElementName ) : mxStorage( rxStorage ), maElementName( rElementName ) { try { - mxTempFile.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); + mxTempFile.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); mxOutStrm = mxTempFile->getOutputStream(); mxSeekable.set( mxOutStrm, UNO_QUERY ); } @@ -179,49 +181,40 @@ void OleOutputStream::ensureConnected() const throw( NotConnectedException ) // ============================================================================ -OleStorage::OleStorage( - const Reference< XMultiServiceFactory >& rxFactory, - const Reference< XInputStream >& rxInStream, - bool bBaseStreamAccess ) : +OleStorage::OleStorage( const Reference< XComponentContext >& rxContext, + const Reference< XInputStream >& rxInStream, bool bBaseStreamAccess ) : StorageBase( rxInStream, bBaseStreamAccess ), - mxFactory( rxFactory ), + mxContext( rxContext ), mpParentStorage( 0 ) { - OSL_ENSURE( mxFactory.is(), "OleStorage::OleStorage - missing service factory" ); + OSL_ENSURE( mxContext.is(), "OleStorage::OleStorage - missing component context" ); initStorage( rxInStream ); } -OleStorage::OleStorage( - const Reference< XMultiServiceFactory >& rxFactory, - const Reference< XStream >& rxOutStream, - bool bBaseStreamAccess ) : +OleStorage::OleStorage( const Reference< XComponentContext >& rxContext, + const Reference< XStream >& rxOutStream, bool bBaseStreamAccess ) : StorageBase( rxOutStream, bBaseStreamAccess ), - mxFactory( rxFactory ), + mxContext( rxContext ), mpParentStorage( 0 ) { - OSL_ENSURE( mxFactory.is(), "OleStorage::OleStorage - missing service factory" ); + OSL_ENSURE( mxContext.is(), "OleStorage::OleStorage - missing component context" ); initStorage( rxOutStream ); } -OleStorage::OleStorage( - const OleStorage& rParentStorage, - const Reference< XNameContainer >& rxStorage, - const OUString& rElementName, - bool bReadOnly ) : +OleStorage::OleStorage( const OleStorage& rParentStorage, + const Reference< XNameContainer >& rxStorage, const OUString& rElementName, bool bReadOnly ) : StorageBase( rParentStorage, rElementName, bReadOnly ), - mxFactory( rParentStorage.mxFactory ), + mxContext( rParentStorage.mxContext ), mxStorage( rxStorage ), mpParentStorage( &rParentStorage ) { OSL_ENSURE( mxStorage.is(), "OleStorage::OleStorage - missing substorage elements" ); } -OleStorage::OleStorage( - const OleStorage& rParentStorage, - const Reference< XStream >& rxOutStream, - const OUString& rElementName ) : +OleStorage::OleStorage( const OleStorage& rParentStorage, + const Reference< XStream >& rxOutStream, const OUString& rElementName ) : StorageBase( rParentStorage, rElementName, false ), - mxFactory( rParentStorage.mxFactory ), + mxContext( rParentStorage.mxContext ), mpParentStorage( &rParentStorage ) { initStorage( rxOutStream ); @@ -239,7 +232,8 @@ void OleStorage::initStorage( const Reference< XInputStream >& rxInStream ) Reference< XInputStream > xInStrm = rxInStream; if( !Reference< XSeekable >( xInStrm, UNO_QUERY ).is() ) try { - Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); { Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW ); /* Pass false to both binary stream objects to keep the UNO @@ -259,10 +253,11 @@ void OleStorage::initStorage( const Reference< XInputStream >& rxInStream ) // create base storage object if( xInStrm.is() ) try { + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); Sequence< Any > aArgs( 2 ); aArgs[ 0 ] <<= xInStrm; aArgs[ 1 ] <<= true; // true = do not create a copy of the input stream - mxStorage.set( mxFactory->createInstanceWithArguments( + mxStorage.set( xFactory->createInstanceWithArguments( CREATE_OUSTRING( "com.sun.star.embed.OLESimpleStorage" ), aArgs ), UNO_QUERY_THROW ); } catch( Exception& ) @@ -275,10 +270,11 @@ void OleStorage::initStorage( const Reference< XStream >& rxOutStream ) // create base storage object if( rxOutStream.is() ) try { + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); Sequence< Any > aArgs( 2 ); aArgs[ 0 ] <<= rxOutStream; aArgs[ 1 ] <<= true; // true = do not create a copy of the stream - mxStorage.set( mxFactory->createInstanceWithArguments( + mxStorage.set( xFactory->createInstanceWithArguments( CREATE_OUSTRING( "com.sun.star.embed.OLESimpleStorage" ), aArgs ), UNO_QUERY_THROW ); } catch( Exception& ) @@ -347,7 +343,8 @@ StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bC if( !isReadOnly() && (bCreateMissing || xSubStorage.get()) ) try { // create new storage based on a temp file - Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); StorageRef xTempStorage( new OleStorage( *this, xTempFile, rElementName ) ); // copy existing substorage into temp storage if( xSubStorage.get() ) @@ -379,7 +376,7 @@ Reference< XOutputStream > OleStorage::implOpenOutputStream( const OUString& rEl { Reference< XOutputStream > xOutStream; if( mxStorage.is() && (rElementName.getLength() > 0) ) - xOutStream.set( new OleOutputStream( mxFactory, mxStorage, rElementName ) ); + xOutStream.set( new OleOutputStream( mxContext, mxStorage, rElementName ) ); return xOutStream; } diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 39deb77576d9..45a2b9c70ee3 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -756,11 +756,11 @@ bool lclEatKeyword( OUString& rCodeLine, const OUString& rKeyword ) VbaUserForm::VbaUserForm( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) : - mxCompContext( rxContext ), + mxContext( rxContext ), mxDocModel( rxDocModel ), maConverter( rxDocModel, rGraphicHelper, bDefaultColorBgr ) { - OSL_ENSURE( mxCompContext.is(), "VbaUserForm::VbaUserForm - missing component context" ); + OSL_ENSURE( mxContext.is(), "VbaUserForm::VbaUserForm - missing component context" ); OSL_ENSURE( mxDocModel.is(), "VbaUserForm::VbaUserForm - missing document model" ); } @@ -768,7 +768,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc ) { OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" ); - if( !mxCompContext.is() || !mxDocModel.is() || !rxDialogLib.is() ) + if( !mxContext.is() || !mxDocModel.is() || !rxDialogLib.is() ) return; // check that the '03VBFrame' stream exists, this is required for forms @@ -778,7 +778,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, return; // scan for the line 'Begin {GUID} ' - TextInputStream aFrameTextStrm( aInStrm, eTextEnc ); + TextInputStream aFrameTextStrm( mxContext, aInStrm, eTextEnc ); const OUString aBegin = CREATE_OUSTRING( "Begin" ); OUString aLine; bool bBeginFound = false; @@ -826,7 +826,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, { // create the dialog model OUString aServiceName = mxCtrlModel->getServiceName(); - Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); Reference< XControlModel > xDialogModel( xFactory->createInstance( aServiceName ), UNO_QUERY_THROW ); Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW ); @@ -834,7 +834,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, if( convertProperties( xDialogModel, maConverter, 0 ) ) { // export the dialog to XML and insert it into the dialog library - Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext ), UNO_SET_THROW ); + Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxContext ), UNO_SET_THROW ); OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" ); ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) ); } diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx index e56e8b5fbc89..7e2c88dc480f 100644 --- a/oox/source/ole/vbainputstream.cxx +++ b/oox/source/ole/vbainputstream.cxx @@ -47,17 +47,38 @@ const sal_uInt16 VBACHUNK_LENMASK = 0x0FFF; // ============================================================================ VbaInputStream::VbaInputStream( BinaryInputStream& rInStrm ) : - mrInStrm( rInStrm ), + BinaryStreamBase( false ), + mpInStrm( &rInStrm ), mnChunkPos( 0 ) { maChunk.reserve( 4096 ); - sal_uInt8 nSig = mrInStrm.readuInt8(); + sal_uInt8 nSig = rInStrm.readuInt8(); OSL_ENSURE( nSig == VBASTREAM_SIGNATURE, "VbaInputStream::VbaInputStream - wrong signature" ); - mbEof = nSig != VBASTREAM_SIGNATURE; + mbEof = mbEof || rInStrm.isEof() || (nSig != VBASTREAM_SIGNATURE); } -sal_Int32 VbaInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +sal_Int64 VbaInputStream::size() const +{ + return -1; +} + +sal_Int64 VbaInputStream::tell() const +{ + return -1; +} + +void VbaInputStream::seek( sal_Int64 ) +{ +} + +void VbaInputStream::close() +{ + mpInStrm = 0; + mbEof = true; +} + +sal_Int32 VbaInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nRet = 0; if( !mbEof ) @@ -65,7 +86,7 @@ sal_Int32 VbaInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes orData.realloc( ::std::max< sal_Int32 >( nBytes, 0 ) ); if( nBytes > 0 ) { - nRet = readMemory( orData.getArray(), nBytes ); + nRet = readMemory( orData.getArray(), nBytes, nAtomSize ); if( nRet < nBytes ) orData.realloc( nRet ); } @@ -73,7 +94,7 @@ sal_Int32 VbaInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes return nRet; } -sal_Int32 VbaInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 VbaInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t /*nAtomSize*/ ) { sal_Int32 nRet = 0; sal_uInt8* opnMem = reinterpret_cast< sal_uInt8* >( opMem ); @@ -90,7 +111,7 @@ sal_Int32 VbaInputStream::readMemory( void* opMem, sal_Int32 nBytes ) return nRet; } -void VbaInputStream::skip( sal_Int32 nBytes ) +void VbaInputStream::skip( sal_Int32 nBytes, size_t /*nAtomSize*/ ) { while( (nBytes > 0) && updateChunk() ) { @@ -108,8 +129,8 @@ bool VbaInputStream::updateChunk() if( mbEof || (mnChunkPos < maChunk.size()) ) return !mbEof; // try to read next chunk header, this may trigger EOF - sal_uInt16 nHeader = mrInStrm.readuInt16(); - mbEof = mrInStrm.isEof(); + sal_uInt16 nHeader = mpInStrm->readuInt16(); + mbEof = mpInStrm->isEof(); if( mbEof ) return false; // check header signature @@ -126,15 +147,15 @@ bool VbaInputStream::updateChunk() maChunk.clear(); sal_uInt8 nBitCount = 4; sal_uInt16 nChunkPos = 0; - while( !mbEof && !mrInStrm.isEof() && (nChunkPos < nChunkLen) ) + while( !mbEof && !mpInStrm->isEof() && (nChunkPos < nChunkLen) ) { - sal_uInt8 nTokenFlags = mrInStrm.readuInt8(); + sal_uInt8 nTokenFlags = mpInStrm->readuInt8(); ++nChunkPos; - for( int nBit = 0; !mbEof && !mrInStrm.isEof() && (nBit < 8) && (nChunkPos < nChunkLen); ++nBit, nTokenFlags >>= 1 ) + for( int nBit = 0; !mbEof && !mpInStrm->isEof() && (nBit < 8) && (nChunkPos < nChunkLen); ++nBit, nTokenFlags >>= 1 ) { if( nTokenFlags & 1 ) { - sal_uInt16 nCopyToken = mrInStrm.readuInt16(); + sal_uInt16 nCopyToken = mpInStrm->readuInt16(); nChunkPos = nChunkPos + 2; // update bit count used for offset/length in the token while( static_cast< size_t >( 1 << nBitCount ) < maChunk.size() ) ++nBitCount; @@ -164,7 +185,7 @@ bool VbaInputStream::updateChunk() else { maChunk.resize( maChunk.size() + 1 ); - mrInStrm >> maChunk.back(); + *mpInStrm >> maChunk.back(); ++nChunkPos; } } @@ -173,7 +194,7 @@ bool VbaInputStream::updateChunk() else { maChunk.resize( nChunkLen ); - mrInStrm.readMemory( &maChunk.front(), nChunkLen ); + mpInStrm->readMemory( &maChunk.front(), nChunkLen ); } mnChunkPos = 0; diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx index 2da92b935004..628c2abb8441 100644 --- a/oox/source/ole/vbamodule.cxx +++ b/oox/source/ole/vbamodule.cxx @@ -54,7 +54,9 @@ using ::rtl::OUStringBuffer; // ============================================================================ -VbaModule::VbaModule( const Reference< XModel >& rxDocModel, const OUString& rName, rtl_TextEncoding eTextEnc, bool bExecutable ) : +VbaModule::VbaModule( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxDocModel, + const OUString& rName, rtl_TextEncoding eTextEnc, bool bExecutable ) : + mxContext( rxContext ), mxDocModel( rxDocModel ), maName( rName ), meTextEnc( eTextEnc ), @@ -161,7 +163,7 @@ OUString VbaModule::readSourceCode( StorageBase& rVbaStrg ) const // decompression starts at current stream position of aInStrm VbaInputStream aVbaStrm( aInStrm ); // load the source code line-by-line, with some more processing - TextInputStream aVbaTextStrm( aVbaStrm, meTextEnc ); + TextInputStream aVbaTextStrm( mxContext, aVbaStrm, meTextEnc ); while( !aVbaTextStrm.isEof() ) { OUString aCodeLine = aVbaTextStrm.readLine(); diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 35e6b7911012..57979f6c72d4 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -155,11 +155,11 @@ void VbaMacroAttacherBase::resolveAndAttachMacro( const Reference< XVBAMacroReso VbaProject::VbaProject( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxDocModel, const OUString& rConfigCompName ) : VbaFilterConfig( rxContext, rConfigCompName ), - mxCompContext( rxContext ), + mxContext( rxContext ), mxDocModel( rxDocModel ), maPrjName( CREATE_OUSTRING( "Standard" ) ) { - OSL_ENSURE( mxCompContext.is(), "VbaProject::VbaProject - missing component context" ); + OSL_ENSURE( mxContext.is(), "VbaProject::VbaProject - missing component context" ); OSL_ENSURE( mxDocModel.is(), "VbaProject::VbaProject - missing document model" ); mxBasicLib = openLibrary( PROP_BasicLibraries, false ); mxDialogLib = openLibrary( PROP_DialogLibraries, false ); @@ -332,7 +332,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap OSL_ENSURE( aName.getLength() > 0, "VbaProject::importVba - invalid module name" ); OSL_ENSURE( !aModules.has( aName ), "VbaProject::importVba - multiple modules with the same name" ); VbaModuleMap::mapped_type& rxModule = aModules[ aName ]; - rxModule.reset( new VbaModule( mxDocModel, aName, eTextEnc, bExecutable ) ); + rxModule.reset( new VbaModule( mxContext, mxDocModel, aName, eTextEnc, bExecutable ) ); // read all remaining records until the MODULEEND record rxModule->importDirRecords( aDirStrm ); OSL_ENSURE( !aModulesByStrm.has( rxModule->getStreamName() ), "VbaProject::importVba - multiple modules with the same stream name" ); @@ -369,7 +369,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap // do not exit if this stream does not exist, but proceed to load the modules below if( !aPrjStrm.isEof() ) { - TextInputStream aPrjTextStrm( aPrjStrm, eTextEnc ); + TextInputStream aPrjTextStrm( mxContext, aPrjStrm, eTextEnc ); OUString aKey, aValue; bool bExitLoop = false; while( !bExitLoop && !aPrjTextStrm.isEof() ) @@ -413,7 +413,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap { OSL_ENSURE( !aModules.has( aIt->first ) && !aDummyModules.has( aIt->first ), "VbaProject::importVba - multiple modules with the same name" ); VbaModuleMap::mapped_type& rxModule = aDummyModules[ aIt->first ]; - rxModule.reset( new VbaModule( mxDocModel, aIt->first, eTextEnc, bExecutable ) ); + rxModule.reset( new VbaModule( mxContext, mxDocModel, aIt->first, eTextEnc, bExecutable ) ); rxModule->setType( aIt->second ); } @@ -489,7 +489,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap // create and import the form Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW ); - VbaUserForm aForm( mxCompContext, mxDocModel, rGraphicHelper, bDefaultColorBgr ); + VbaUserForm aForm( mxContext, mxDocModel, rGraphicHelper, bDefaultColorBgr ); aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc ); } catch( Exception& ) @@ -506,14 +506,14 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap void VbaProject::attachMacros() { - if( !maMacroAttachers.empty() && mxCompContext.is() ) try + if( !maMacroAttachers.empty() && mxContext.is() ) try { - Reference< XMultiComponentFactory > xFactory( mxCompContext->getServiceManager(), UNO_SET_THROW ); + Reference< XMultiComponentFactory > xFactory( mxContext->getServiceManager(), UNO_SET_THROW ); Sequence< Any > aArgs( 2 ); aArgs[ 0 ] <<= mxDocModel; aArgs[ 1 ] <<= maPrjName; Reference< XVBAMacroResolver > xResolver( xFactory->createInstanceWithArgumentsAndContext( - CREATE_OUSTRING( "com.sun.star.script.vba.VBAMacroResolver" ), aArgs, mxCompContext ), UNO_QUERY_THROW ); + CREATE_OUSTRING( "com.sun.star.script.vba.VBAMacroResolver" ), aArgs, mxContext ), UNO_QUERY_THROW ); maMacroAttachers.forEachMem( &VbaMacroAttacherBase::resolveAndAttachMacro, ::boost::cref( xResolver ) ); } catch( Exception& ) @@ -523,15 +523,14 @@ void VbaProject::attachMacros() void VbaProject::copyStorage( StorageBase& rVbaPrjStrg ) { - if( mxCompContext.is() ) try + if( mxContext.is() ) try { - Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW ); Reference< XStorageBasedDocument > xStorageBasedDoc( mxDocModel, UNO_QUERY_THROW ); Reference< XStorage > xDocStorage( xStorageBasedDoc->getDocumentStorage(), UNO_QUERY_THROW ); { - using namespace ::com::sun::star::embed::ElementModes; - Reference< XStream > xDocStream( xDocStorage->openStreamElement( CREATE_OUSTRING( "_MS_VBA_Macros" ), SEEKABLE | WRITE | TRUNCATE ), UNO_SET_THROW ); - OleStorage aDestStorage( xFactory, xDocStream, false ); + const sal_Int32 nOpenMode = ElementModes::SEEKABLE | ElementModes::WRITE | ElementModes::TRUNCATE; + Reference< XStream > xDocStream( xDocStorage->openStreamElement( CREATE_OUSTRING( "_MS_VBA_Macros" ), nOpenMode ), UNO_SET_THROW ); + OleStorage aDestStorage( mxContext, xDocStream, false ); rVbaPrjStrg.copyStorageToStorage( aDestStorage ); aDestStorage.commit(); } diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index ccf0fe567235..44eb8106ee8e 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -214,8 +214,8 @@ Reference< XShape > Drawing::createAndInsertXShape( const OUString& rService, Reference< XShape > xShape; if( (rService.getLength() > 0) && rxShapes.is() ) try { - Reference< XMultiServiceFactory > xFactory( mrFilter.getModelFactory(), UNO_SET_THROW ); - xShape.set( xFactory->createInstance( rService ), UNO_QUERY_THROW ); + Reference< XMultiServiceFactory > xModelFactory( mrFilter.getModelFactory(), UNO_SET_THROW ); + xShape.set( xModelFactory->createInstance( rService ), UNO_QUERY_THROW ); // insert shape into passed shape collection (maybe drawpage or group shape) rxShapes->add( xShape ); xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) ); diff --git a/oox/source/vml/vmldrawingfragment.cxx b/oox/source/vml/vmldrawingfragment.cxx index dc5c82515691..591e85482448 100644 --- a/oox/source/vml/vmldrawingfragment.cxx +++ b/oox/source/vml/vmldrawingfragment.cxx @@ -27,6 +27,7 @@ #include "oox/vml/vmldrawingfragment.hxx" +#include "oox/core/xmlfilterbase.hxx" #include "oox/vml/vmldrawing.hxx" #include "oox/vml/vmlinputstream.hxx" #include "oox/vml/vmlshapecontext.hxx" @@ -53,7 +54,7 @@ DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragm Reference< XInputStream > DrawingFragment::openFragmentStream() const { // #i104719# create an input stream that preprocesses the VML data - return new InputStream( FragmentHandler2::openFragmentStream() ); + return new InputStream( getFilter().getComponentContext(), FragmentHandler2::openFragmentStream() ); } ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx index fb2443aba4c4..ef2f408d79b0 100644 --- a/oox/source/vml/vmlinputstream.cxx +++ b/oox/source/vml/vmlinputstream.cxx @@ -27,10 +27,12 @@ #include "oox/vml/vmlinputstream.hxx" +#include #include -#include +#include #include #include "oox/helper/helper.hxx" +#include "oox/helper/textinputstream.hxx" namespace oox { namespace vml { @@ -55,7 +57,7 @@ inline const sal_Char* lclFindCharacter( const sal_Char* pcBeg, const sal_Char* inline bool lclIsWhiteSpace( sal_Char cChar ) { - return (cChar == ' ') || (cChar == '\t') || (cChar == '\n') || (cChar == '\r'); + return cChar < 32; } const sal_Char* lclFindWhiteSpace( const sal_Char* pcBeg, const sal_Char* pcEnd ) @@ -151,14 +153,78 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal lclAppendToBuffer( rBuffer, pcBeg, pcEnd ); } -void lclProcessContents( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal_Char* pcEnd ) +void lclProcessElement( OStringBuffer& rBuffer, const OString& rElement ) +{ + // check that passed string starts and ends with the brackets of an XML element + sal_Int32 nElementLen = rElement.getLength(); + if( nElementLen == 0 ) + return; + + const sal_Char* pcOpen = rElement.getStr(); + const sal_Char* pcClose = pcOpen + nElementLen - 1; + + // no complete element found + if( (pcOpen >= pcClose) || (*pcOpen != '<') || (*pcClose != '>') ) + { + // just append all passed characters + rBuffer.append( rElement ); + } + + // skip parser instructions: '' + else if( (nElementLen >= 5) && (pcOpen[ 1 ] == '!') && (pcOpen[ 2 ] == '[') && (pcClose[ -1 ] == ']') ) + { + // do nothing + } + + // replace '
' element with newline + else if( (nElementLen >= 4) && (pcOpen[ 1 ] == 'b') && (pcOpen[ 2 ] == 'r') && (lclFindNonWhiteSpace( pcOpen + 3, pcClose ) == pcClose) ) + { + rBuffer.append( '\n' ); + } + + // check start elements and simple elements for repeated attributes + else if( pcOpen[ 1 ] != '/' ) + { + // find positions of text content inside brackets, exclude '/' in '' + const sal_Char* pcContentBeg = pcOpen + 1; + bool bIsEmptyElement = pcClose[ -1 ] == '/'; + const sal_Char* pcContentEnd = bIsEmptyElement ? (pcClose - 1) : pcClose; + // append opening bracket and element name to buffer + const sal_Char* pcWhiteSpace = lclFindWhiteSpace( pcContentBeg, pcContentEnd ); + lclAppendToBuffer( rBuffer, pcOpen, pcWhiteSpace ); + // find begin of attributes, and process all attributes + const sal_Char* pcAttribBeg = lclFindNonWhiteSpace( pcWhiteSpace, pcContentEnd ); + if( pcAttribBeg < pcContentEnd ) + lclProcessAttribs( rBuffer, pcAttribBeg, pcContentEnd ); + // close the element + if( bIsEmptyElement ) + rBuffer.append( '/' ); + rBuffer.append( '>' ); + } + + // append end elements without further processing + else + { + rBuffer.append( rElement ); + } +} + +bool lclProcessCharacters( OStringBuffer& rBuffer, const OString& rChars ) { /* MSO has a very weird way to store and handle whitespaces. The stream may contain lots of spaces, tabs, and newlines which have to be handled as single space character. This will be done in this function. If the element text contains a literal line break, it will be stored as -
tag (without matching closing
element). +
tag (without matching
element). This input stream wrapper + will replace this element with a literal LF character (see below). + + A single space character for its own is stored as is. Example: The + element + + represents a single space character. The XML parser will ignore this + space character completely without issuing a 'characters' event. The + VML import filter implementation has to react on this case manually. A single space character following another character is stored literally and must not be stipped away here. Example: The element @@ -167,20 +233,23 @@ void lclProcessContents( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sa Consecutive space characters, or a leading single space character, are stored in a element. If there are N space characters (N > 1), - then the element contains exactly (N-1) NBSP characters - (non-breaking space), followed by a regular space character. Example: + then the element contains exactly (N-1) NBSP (non-breaking + space) characters, followed by a regular space character. Examples: The element \xA0\xA0\xA0 represents 4 consecutive space characters. Has to be handled by the - implementation. - - A single space character for its own is stored in an empty element. - Example: The element - - represents a single space character. Has to be handled by the - implementation. + implementation. The element + abc + represents a space characters followed by the letters a, b, c. These + strings have to be handled by the VML import filter implementation. */ + // passed string ends with the leading opening bracket of an XML element + const sal_Char* pcBeg = rChars.getStr(); + const sal_Char* pcEnd = pcBeg + rChars.getLength(); + bool bHasBracket = (pcBeg < pcEnd) && (pcEnd[ -1 ] == '<'); + if( bHasBracket ) --pcEnd; + // skip leading whitespace const sal_Char* pcContentsBeg = lclFindNonWhiteSpace( pcBeg, pcEnd ); while( pcContentsBeg < pcEnd ) @@ -191,132 +260,139 @@ void lclProcessContents( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sa rBuffer.append( ' ' ); pcContentsBeg = lclFindNonWhiteSpace( pcWhitespaceBeg, pcEnd ); } + + return bHasBracket; } } // namespace // ============================================================================ -StreamDataContainer::StreamDataContainer( const Reference< XInputStream >& rxInStrm ) +InputStream::InputStream( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) : + // use single-byte ISO-8859-1 encoding which maps all byte characters to the first 256 Unicode characters + mxTextStrm( TextInputStream::createXTextInputStream( rxContext, rxInStrm, RTL_TEXTENCODING_ISO_8859_1 ) ), + maOpeningBracket( 1 ), + maClosingBracket( 1 ), + maOpeningCData( CREATE_OSTRING( "" ) ), + mnBufferPos( 0 ) { - if( rxInStrm.is() ) try + maOpeningBracket[ 0 ] = '<'; + maClosingBracket[ 0 ] = '>'; +} + +InputStream::~InputStream() +{ +} + +sal_Int32 SAL_CALL InputStream::readBytes( Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + if( nBytesToRead < 0 ) + throw IOException(); + + rData.realloc( nBytesToRead ); + sal_Int8* pcDest = rData.getArray(); + sal_Int32 nRet = 0; + while( (nBytesToRead > 0) && !mxTextStrm->isEOF() ) { - // read all bytes we can read - rxInStrm->readBytes( maDataSeq, SAL_MAX_INT32 ); + updateBuffer(); + sal_Int32 nReadSize = ::std::min( nBytesToRead, maBuffer.getLength() - mnBufferPos ); + if( nReadSize > 0 ) + { + memcpy( pcDest + nRet, maBuffer.getStr() + mnBufferPos, static_cast< size_t >( nReadSize ) ); + mnBufferPos += nReadSize; + nBytesToRead -= nReadSize; + nRet += nReadSize; + } } - catch( Exception& ) + if( nRet < rData.getLength() ) + rData.realloc( nRet ); + return nRet; +} + +sal_Int32 SAL_CALL InputStream::readSomeBytes( Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + return readBytes( rData, nMaxBytesToRead ); +} + +void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip ) + throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +{ + if( nBytesToSkip < 0 ) + throw IOException(); + + while( (nBytesToSkip > 0) && !mxTextStrm->isEOF() ) { + updateBuffer(); + sal_Int32 nSkipSize = ::std::min( nBytesToSkip, maBuffer.getLength() - mnBufferPos ); + mnBufferPos += nSkipSize; + nBytesToSkip -= nSkipSize; } +} - if( maDataSeq.hasElements() ) - { - const OString aCDataOpen = CREATE_OSTRING( "" ); +sal_Int32 SAL_CALL InputStream::available() throw (NotConnectedException, IOException, RuntimeException) +{ + updateBuffer(); + return maBuffer.getLength() - mnBufferPos; +} - OStringBuffer aBuffer; - aBuffer.ensureCapacity( maDataSeq.getLength() + 256 ); - const sal_Char* pcCurr = reinterpret_cast< const sal_Char* >( maDataSeq.getConstArray() ); - const sal_Char* pcEnd = pcCurr + maDataSeq.getLength(); - while( pcCurr < pcEnd ) - { - // look for the next opening angle bracket - const sal_Char* pcOpen = lclFindCharacter( pcCurr, pcEnd, '<' ); +void SAL_CALL InputStream::closeInput() throw (NotConnectedException, IOException, RuntimeException) +{ + mxTextStrm->closeInput(); +} - // copy all characters from current position to opening bracket - lclProcessContents( aBuffer, pcCurr, pcOpen ); +// private -------------------------------------------------------------------- - // nothing to do if no opening bracket has been found - if( pcOpen < pcEnd ) - { - // string length from opening bracket to end - sal_Int32 nLengthToEnd = static_cast< sal_Int32 >( pcEnd - pcOpen ); +void InputStream::updateBuffer() throw (IOException, RuntimeException) +{ + while( (mnBufferPos >= maBuffer.getLength()) && !mxTextStrm->isEOF() ) + { + // collect new contents in a string buffer + OStringBuffer aBuffer; - // check for CDATA part, starting with '' - sal_Int32 nClosePos = rtl_str_indexOfStr_WithLength( pcOpen, nLengthToEnd, aCDataClose.getStr(), aCDataClose.getLength() ); - pcCurr = (nClosePos < 0) ? pcEnd : (pcOpen + nClosePos + aCDataClose.getLength()); - // copy the entire CDATA part - lclAppendToBuffer( aBuffer, pcOpen, pcCurr ); - } + // read and process characters until the opening bracket of the next XML element + OString aChars = readToElementBegin(); + bool bHasOpeningBracket = lclProcessCharacters( aBuffer, aChars ); - // no CDATA part - process the element starting at pcOpen - else - { - // look for the next closing angle bracket - const sal_Char* pcClose = lclFindCharacter( pcOpen + 1, pcEnd, '>' ); - // complete element found? - if( pcClose < pcEnd ) - { - // continue after closing bracket - pcCurr = pcClose + 1; - // length of entire element with angle brackets - sal_Int32 nElementLen = static_cast< sal_Int32 >( pcCurr - pcOpen ); - - // skip parser instructions: '' - if( (nElementLen >= 5) && (pcOpen[ 1 ] == '!') && (pcOpen[ 2 ] == '[') && (pcClose[ -1 ] == ']') ) - { - // do nothing - } - - // replace '
' element with newline - else if( (nElementLen >= 4) && (pcOpen[ 1 ] == 'b') && (pcOpen[ 2 ] == 'r') && (lclFindNonWhiteSpace( pcOpen + 3, pcClose ) == pcClose) ) - { - aBuffer.append( '\n' ); - } - - // check start elements and empty elements for repeated attributes - else if( pcOpen[ 1 ] != '/' ) - { - // find positions of text content inside brackets, exclude '/' in '' - const sal_Char* pcContentBeg = pcOpen + 1; - bool bIsEmptyElement = pcClose[ -1 ] == '/'; - const sal_Char* pcContentEnd = bIsEmptyElement ? (pcClose - 1) : pcClose; - // append element name to buffer - const sal_Char* pcWhiteSpace = lclFindWhiteSpace( pcContentBeg, pcContentEnd ); - lclAppendToBuffer( aBuffer, pcOpen, pcWhiteSpace ); - // find begin of attributes, and process all attributes - const sal_Char* pcAttribBeg = lclFindNonWhiteSpace( pcWhiteSpace, pcContentEnd ); - if( pcAttribBeg < pcContentEnd ) - lclProcessAttribs( aBuffer, pcAttribBeg, pcContentEnd ); - // close the element - if( bIsEmptyElement ) - aBuffer.append( '/' ); - aBuffer.append( '>' ); - } - - // append end elements without further processing - else - { - lclAppendToBuffer( aBuffer, pcOpen, pcCurr ); - } - } - else - { - // no complete element found, copy all from opening bracket to end - lclAppendToBuffer( aBuffer, pcOpen, pcEnd ); - pcCurr = pcEnd; - } - } + // read and process characters until (and including) closing bracket (an XML element) + OSL_ENSURE( bHasOpeningBracket || mxTextStrm->isEOF(), "InputStream::updateBuffer - missing opening bracket of XML element" ); + if( bHasOpeningBracket && !mxTextStrm->isEOF() ) + { + // read the element text (add the leading opening bracket manually) + OString aElement = OString( '<' ) + readToElementEnd(); + // check for CDATA part, starting with '' + while( ((aElement.getLength() < maClosingCData.getLength()) || !aElement.match( maClosingCData, aElement.getLength() - maClosingCData.getLength() )) && !mxTextStrm->isEOF() ) + aElement += readToElementEnd(); + // copy the entire CDATA part + aBuffer.append( aElement ); + } + else + { + // no CDATA part - process the contents of the element + lclProcessElement( aBuffer, aElement ); } } - // set the final data sequence - maDataSeq = ::comphelper::ByteSequence( reinterpret_cast< const sal_Int8* >( aBuffer.getStr() ), aBuffer.getLength() ); + maBuffer = aBuffer.makeStringAndClear(); + mnBufferPos = 0; } } -// ============================================================================ - -InputStream::InputStream( const Reference< XInputStream >& rxInStrm ) : - StreamDataContainer( rxInStrm ), - ::comphelper::SequenceInputStream( maDataSeq ) +OString InputStream::readToElementBegin() throw (IOException, RuntimeException) { + return OUStringToOString( mxTextStrm->readString( maOpeningBracket, sal_False ), RTL_TEXTENCODING_ISO_8859_1 ); } -InputStream::~InputStream() +OString InputStream::readToElementEnd() throw (IOException, RuntimeException) { + OString aText = OUStringToOString( mxTextStrm->readString( maClosingBracket, sal_False ), RTL_TEXTENCODING_ISO_8859_1 ); + OSL_ENSURE( (aText.getLength() > 0) && (aText[ aText.getLength() - 1 ] == '>'), "InputStream::readToElementEnd - missing closing bracket of XML element" ); + return aText; } // ============================================================================ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d266e054691f..5e1a9a8d3e1d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -274,9 +274,10 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS xShape = implConvertAndInsert( rxShapes, aShapeRect ); if( xShape.is() ) { - // set shape name (imported or generated) + // set imported or generated shape name (not supported by form controls) PropertySet aShapeProp( xShape ); - aShapeProp.setProperty( PROP_Name, getShapeName() ); + if( aShapeProp.hasProperty( PROP_Name ) ) + aShapeProp.setProperty( PROP_Name, getShapeName() ); /* Notify the drawing that a new shape has been inserted. For convenience, pass the rectangle that contains position and diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index 4b57656b4f78..6feae68127e7 100755 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -75,6 +75,8 @@ TextPortionContext::TextPortionContext( ContextHandler2Helper& rParent, OSL_ENSURE( !maFont.mobStrikeout, "TextPortionContext::TextPortionContext - nested elements" ); maFont.mobStrikeout = true; break; + case XML_span: + break; default: OSL_ENSURE( false, "TextPortionContext::TextPortionContext - unknown element" ); } @@ -92,7 +94,7 @@ void TextPortionContext::onCharacters( const OUString& rChars ) { case XML_span: // replace all NBSP characters with SP - mrTextBox.appendPortion( maFont, rChars.replace( 160, ' ' ) ); + mrTextBox.appendPortion( maFont, rChars.replace( 0xA0, ' ' ) ); break; default: mrTextBox.appendPortion( maFont, rChars ); @@ -101,19 +103,23 @@ void TextPortionContext::onCharacters( const OUString& rChars ) void TextPortionContext::onEndElement() { - /* An empty child element without own child elements represents a single - space character, for example: + /* A child element without own child elements may contain a single space + character, for example: - - abc - - def - +
+ abc + + def +
represents the italic text 'abc', an unformatted space character, and - the bold text 'def'. + the bold text 'def'. Unfortunately, the XML parser skips the space + character without issuing a 'characters' event. The class member + 'mnInitialPortions' contains the number of text portions existing when + this context has been constructed. If no text has been added in the + meantime, the space character has to be added manually. */ - if( (mnInitialPortions > 0) && (mrTextBox.getPortionCount() == mnInitialPortions) ) + if( mrTextBox.getPortionCount() == mnInitialPortions ) mrTextBox.appendPortion( maFont, OUString( sal_Unicode( ' ' ) ) ); } @@ -143,4 +149,3 @@ ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const Att } // namespace vml } // namespace oox - diff --git a/oox/source/xls/addressconverter.cxx b/oox/source/xls/addressconverter.cxx index 6d53be0c155b..ca216bb8a84f 100644 --- a/oox/source/xls/addressconverter.cxx +++ b/oox/source/xls/addressconverter.cxx @@ -98,12 +98,12 @@ const sal_Unicode BIFF_DCON_ENCODED = '\x01'; /// First character of an en const sal_Unicode BIFF_DCON_INTERN = '\x02'; /// First character of an encoded sheet name from DCON* records. -inline sal_uInt16 lclGetBiffAddressSize( bool bCol16Bit, bool bRow32Bit ) +inline sal_uInt8 lclGetBiffAddressSize( bool bCol16Bit, bool bRow32Bit ) { return (bCol16Bit ? 2 : 1) + (bRow32Bit ? 4 : 2); } -inline sal_uInt16 lclGetBiffRangeSize( bool bCol16Bit, bool bRow32Bit ) +inline sal_uInt8 lclGetBiffRangeSize( bool bCol16Bit, bool bRow32Bit ) { return 2 * lclGetBiffAddressSize( bCol16Bit, bRow32Bit ); } diff --git a/oox/source/xls/biffdetector.cxx b/oox/source/xls/biffdetector.cxx index 038d7d732425..9c8267f8d84d 100644 --- a/oox/source/xls/biffdetector.cxx +++ b/oox/source/xls/biffdetector.cxx @@ -82,14 +82,14 @@ BiffDetector::~BiffDetector() /*static*/ BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream ) { BiffType eBiff = BIFF_UNKNOWN; - if( !rInStream.isEof() && rInStream.isSeekable() && (rInStream.getLength() > 4) ) + if( !rInStream.isEof() && rInStream.isSeekable() && (rInStream.size() > 4) ) { sal_Int64 nOldPos = rInStream.tell(); rInStream.seekToStart(); sal_uInt16 nBofId, nBofSize; rInStream >> nBofId >> nBofSize; - if( (4 <= nBofSize) && (nBofSize <= 16) && (rInStream.tell() + nBofSize <= rInStream.getLength()) ) + if( (4 <= nBofSize) && (nBofSize <= 16) && (rInStream.tell() + nBofSize <= rInStream.size()) ) { switch( nBofId ) { @@ -207,9 +207,8 @@ OUString SAL_CALL BiffDetector::detect( Sequence< PropertyValue >& rDescriptor ) MediaDescriptor aDescriptor( rDescriptor ); aDescriptor.addInputStream(); - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); Reference< XInputStream > xInStrm( aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY_THROW ); - StorageRef xStorage( new ::oox::ole::OleStorage( xFactory, xInStrm, true ) ); + StorageRef xStorage( new ::oox::ole::OleStorage( mxContext, xInStrm, true ) ); OUString aWorkbookName; switch( detectStorageBiffVersion( aWorkbookName, xStorage ) ) diff --git a/oox/source/xls/biffhelper.cxx b/oox/source/xls/biffhelper.cxx index 55839043865e..b4a3a982b50c 100644 --- a/oox/source/xls/biffhelper.cxx +++ b/oox/source/xls/biffhelper.cxx @@ -269,7 +269,7 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, // BIFF12 import -------------------------------------------------------------- -/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen ) +/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen, bool bAllowNulChars ) { OUString aString; if( !rStrm.isEof() ) @@ -279,16 +279,9 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, OSL_ENSURE( !rStrm.isEof() && (nCharCount >= -1), "BiffHelper::readString - invalid string length" ); if( !rStrm.isEof() && (nCharCount > 0) ) { - ::std::vector< sal_Unicode > aBuffer; - aBuffer.reserve( getLimitedValue< size_t, sal_Int32 >( nCharCount + 1, 0, 0xFFFF ) ); - for( sal_Int32 nCharIdx = 0; !rStrm.isEof() && (nCharIdx < nCharCount); ++nCharIdx ) - { - sal_uInt16 nChar; - rStrm.readValue( nChar ); - aBuffer.push_back( static_cast< sal_Unicode >( nChar ) ); - } - aBuffer.push_back( 0 ); - aString = OUString( &aBuffer.front() ); + // SequenceInputStream always supports getRemaining() + nCharCount = ::std::min( nCharCount, static_cast< sal_Int32 >( rStrm.getRemaining() / 2 ) ); + aString = rStrm.readUnicodeArray( nCharCount, bAllowNulChars ); } } return aString; diff --git a/oox/source/xls/biffinputstream.cxx b/oox/source/xls/biffinputstream.cxx index 6dfa8f755c25..b11137aab6b9 100644 --- a/oox/source/xls/biffinputstream.cxx +++ b/oox/source/xls/biffinputstream.cxx @@ -87,7 +87,7 @@ void BiffInputRecordBuffer::enableDecoder( bool bEnable ) bool BiffInputRecordBuffer::startRecord( sal_Int64 nHeaderPos ) { - mbValidHeader = (0 <= nHeaderPos) && (nHeaderPos + 4 <= mrInStrm.getLength()); + mbValidHeader = (0 <= nHeaderPos) && (nHeaderPos + 4 <= mrInStrm.size()); if( mbValidHeader ) { mnHeaderPos = nHeaderPos; @@ -95,7 +95,7 @@ bool BiffInputRecordBuffer::startRecord( sal_Int64 nHeaderPos ) mrInStrm >> mnRecId >> mnRecSize; mnBodyPos = mrInStrm.tell(); mnNextHeaderPos = mnBodyPos + mnRecSize; - mbValidHeader = !mrInStrm.isEof() && (mnNextHeaderPos <= mrInStrm.getLength()); + mbValidHeader = !mrInStrm.isEof() && (mnNextHeaderPos <= mrInStrm.size()); } if( !mbValidHeader ) { @@ -116,7 +116,7 @@ bool BiffInputRecordBuffer::startNextRecord() sal_uInt16 BiffInputRecordBuffer::getNextRecId() { sal_uInt16 nRecId = BIFF_ID_UNKNOWN; - if( mbValidHeader && (mnNextHeaderPos + 4 <= mrInStrm.getLength()) ) + if( mbValidHeader && (mnNextHeaderPos + 4 <= mrInStrm.size()) ) { mrInStrm.seek( mnNextHeaderPos ); mrInStrm >> nRecId; @@ -169,6 +169,7 @@ void BiffInputRecordBuffer::updateDecoded() // ============================================================================ BiffInputStream::BiffInputStream( BinaryInputStream& rInStream, bool bContLookup ) : + BinaryStreamBase( true ), maRecBuffer( rInStream ), mnRecHandle( -1 ), mnRecId( BIFF_ID_UNKNOWN ), @@ -257,9 +258,11 @@ sal_uInt16 BiffInputStream::getNextRecId() // BinaryStreamBase interface (seeking) --------------------------------------- -bool BiffInputStream::isSeekable() const +sal_Int64 BiffInputStream::size() const { - return true; + if( !mbHasComplRec ) + const_cast< BiffInputStream* >( this )->calcRecordLength(); + return mnComplRecSize; } sal_Int64 BiffInputStream::tell() const @@ -267,13 +270,6 @@ sal_Int64 BiffInputStream::tell() const return mbEof ? -1 : (mnCurrRecSize - maRecBuffer.getRecLeft()); } -sal_Int64 BiffInputStream::getLength() const -{ - if( !mbHasComplRec ) - const_cast< BiffInputStream* >( this )->calcRecordLength(); - return mnComplRecSize; -} - void BiffInputStream::seek( sal_Int64 nRecPos ) { if( isInRecord() ) @@ -285,35 +281,35 @@ void BiffInputStream::seek( sal_Int64 nRecPos ) } } +void BiffInputStream::close() +{ +} + sal_Int64 BiffInputStream::tellBase() const { return maRecBuffer.getBaseStream().tell(); } -sal_Int64 BiffInputStream::getBaseLength() const +sal_Int64 BiffInputStream::sizeBase() const { - return maRecBuffer.getBaseStream().getLength(); + return maRecBuffer.getBaseStream().size(); } // BinaryInputStream interface (stream read access) --------------------------- -sal_Int32 BiffInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes ) +sal_Int32 BiffInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nRet = 0; if( !mbEof ) { orData.realloc( ::std::max< sal_Int32 >( nBytes, 0 ) ); if( nBytes > 0 ) - { - nRet = readMemory( orData.getArray(), nBytes ); - if( nRet < nBytes ) - orData.realloc( nRet ); - } + nRet = readMemory( orData.getArray(), nBytes, nAtomSize ); } return nRet; } -sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes ) +sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nRet = 0; if( !mbEof && opMem && (nBytes > 0) ) @@ -323,7 +319,7 @@ sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes ) while( !mbEof && (nBytesLeft > 0) ) { - sal_uInt16 nReadSize = getMaxRawReadSize( nBytesLeft ); + sal_uInt16 nReadSize = getMaxRawReadSize( nBytesLeft, nAtomSize ); // check nReadSize, stream may already be located at end of a raw record if( nReadSize > 0 ) { @@ -340,12 +336,12 @@ sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes ) return nRet; } -void BiffInputStream::skip( sal_Int32 nBytes ) +void BiffInputStream::skip( sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nBytesLeft = nBytes; while( !mbEof && (nBytesLeft > 0) ) { - sal_uInt16 nSkipSize = getMaxRawReadSize( nBytesLeft ); + sal_uInt16 nSkipSize = getMaxRawReadSize( nBytesLeft, nAtomSize ); // check nSkipSize, stream may already be located at end of a raw record if( nSkipSize > 0 ) { @@ -383,28 +379,22 @@ OUString BiffInputStream::readUniStringChars( sal_uInt16 nChars, bool b16BitChar OUStringBuffer aBuffer; aBuffer.ensureCapacity( nChars ); - /* This function has to react on CONTINUE records to read the repeated - flags field, so readUnicodeArray() cannot be used here. */ - sal_uInt16 nCharsLeft = nChars; + /* This function has to react on CONTINUE records which repeat the flags + field in their first byte and may change the 8bit/16bit character mode, + thus a plain call to readCompressedUnicodeArray() cannot be used here. */ + sal_Int32 nCharsLeft = nChars; while( !mbEof && (nCharsLeft > 0) ) { - sal_uInt16 nPortionCount = 0; - if( b16BitChars ) - { - nPortionCount = ::std::min< sal_uInt16 >( nCharsLeft, maRecBuffer.getRecLeft() / 2 ); - OSL_ENSURE( (nPortionCount <= nCharsLeft) || ((maRecBuffer.getRecLeft() & 1) == 0), - "BiffInputStream::readUniStringChars - missing a byte" ); - } - else - { - nPortionCount = getMaxRawReadSize( nCharsLeft ); - } - - // read the character array - appendUnicodeArray( aBuffer, nPortionCount, b16BitChars, bAllowNulChars ); - - // prepare for next CONTINUE record - nCharsLeft = nCharsLeft - nPortionCount; + /* Read the character array from the remaining part of the current raw + record. First, calculate the maximum number of characters that can + be read without triggering to start a following CONTINUE record. */ + sal_Int32 nRawChars = b16BitChars ? (getMaxRawReadSize( nCharsLeft * 2, 2 ) / 2) : getMaxRawReadSize( nCharsLeft, 1 ); + aBuffer.append( readCompressedUnicodeArray( nRawChars, !b16BitChars, bAllowNulChars ) ); + + /* Prepare for next CONTINUE record. Calling jumpToNextStringContinue() + reads the leading byte in the following CONTINUE record and updates + the b16BitChars flag. */ + nCharsLeft -= nRawChars; if( nCharsLeft > 0 ) jumpToNextStringContinue( b16BitChars ); } @@ -429,25 +419,15 @@ OUString BiffInputStream::readUniString( bool bAllowNulChars ) void BiffInputStream::skipUniStringChars( sal_uInt16 nChars, bool b16BitChars ) { - sal_uInt16 nCharsLeft = nChars; + sal_Int32 nCharsLeft = nChars; while( !mbEof && (nCharsLeft > 0) ) { - sal_uInt16 nPortionCount; - if( b16BitChars ) - { - nPortionCount = ::std::min< sal_uInt16 >( nCharsLeft, maRecBuffer.getRecLeft() / 2 ); - OSL_ENSURE( (nPortionCount <= nCharsLeft) || ((maRecBuffer.getRecLeft() & 1) == 0), - "BiffInputStream::skipUniStringChars - missing a byte" ); - skip( 2 * nPortionCount ); - } - else - { - nPortionCount = getMaxRawReadSize( nCharsLeft ); - skip( nPortionCount ); - } + // skip the character array + sal_Int32 nSkipSize = b16BitChars ? getMaxRawReadSize( 2 * nCharsLeft, 2 ) : getMaxRawReadSize( nCharsLeft, 1 ); + skip( nSkipSize ); // prepare for next CONTINUE record - nCharsLeft = nCharsLeft - nPortionCount; + nCharsLeft -= (b16BitChars ? (nSkipSize / 2) : nSkipSize); if( nCharsLeft > 0 ) jumpToNextStringContinue( b16BitChars ); } @@ -469,13 +449,6 @@ void BiffInputStream::skipUniString() // private -------------------------------------------------------------------- -void BiffInputStream::readAtom( void* opMem, sal_uInt8 nSize ) -{ - // byte swapping is done in calling BinaryInputStream::readValue() template function - if( ensureRawReadSize( nSize ) ) - maRecBuffer.read( opMem, nSize ); -} - void BiffInputStream::setupRecord() { // initialize class members @@ -529,7 +502,7 @@ bool BiffInputStream::jumpToNextContinue() bool BiffInputStream::jumpToNextStringContinue( bool& rb16BitChars ) { - OSL_ENSURE( maRecBuffer.getRecLeft() == 0, "BiffInputStream::jumpToNextStringContinue - unexpected garbage" ); + OSL_ENSURE( maRecBuffer.getRecLeft() == 0, "BiffInputStream::jumpToNextStringContinue - alignment error" ); if( mbCont && (getRemaining() > 0) ) { @@ -561,31 +534,17 @@ void BiffInputStream::calcRecordLength() seek( nCurrPos ); // restore position, seek() resets old mbValid state } -bool BiffInputStream::ensureRawReadSize( sal_uInt16 nBytes ) -{ - if( !mbEof && (nBytes > 0) ) - { - while( !mbEof && (maRecBuffer.getRecLeft() == 0) ) jumpToNextContinue(); - mbEof = mbEof || (nBytes > maRecBuffer.getRecLeft()); - OSL_ENSURE( !mbEof, "BiffInputStream::ensureRawReadSize - record overread" ); - } - return !mbEof; -} - -sal_uInt16 BiffInputStream::getMaxRawReadSize( sal_Int32 nBytes ) const -{ - return getLimitedValue< sal_uInt16, sal_Int32 >( nBytes, 0, maRecBuffer.getRecLeft() ); -} - -void BiffInputStream::appendUnicodeArray( OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16BitChars, bool bAllowNulChars ) +sal_uInt16 BiffInputStream::getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const { - orBuffer.ensureCapacity( orBuffer.getLength() + nChars ); - sal_uInt16 nChar; - for( sal_uInt16 nCharIdx = 0; !mbEof && (nCharIdx < nChars); ++nCharIdx ) + sal_uInt16 nMaxSize = getLimitedValue< sal_uInt16, sal_Int32 >( nBytes, 0, maRecBuffer.getRecLeft() ); + if( (0 < nMaxSize) && (nMaxSize < nBytes) && (nAtomSize > 1) ) { - if( b16BitChars ) readValue( nChar ); else nChar = readuInt8(); - orBuffer.append( static_cast< sal_Unicode >( (!bAllowNulChars && (nChar == 0)) ? '?' : nChar ) ); + // check that remaining data in record buffer is a multiple of the passed atom size + sal_uInt16 nPadding = static_cast< sal_uInt16 >( nMaxSize % nAtomSize ); + OSL_ENSURE( nPadding == 0, "BiffInputStream::getMaxRawReadSize - alignment error" ); + nMaxSize = nMaxSize - nPadding; } + return nMaxSize; } void BiffInputStream::readUniStringHeader( bool& orb16BitChars, sal_Int32& ornAddSize ) diff --git a/oox/source/xls/biffoutputstream.cxx b/oox/source/xls/biffoutputstream.cxx index ba59f50bea4d..14608414c91d 100644 --- a/oox/source/xls/biffoutputstream.cxx +++ b/oox/source/xls/biffoutputstream.cxx @@ -85,6 +85,7 @@ void BiffOutputRecordBuffer::fill( sal_uInt8 nValue, sal_uInt16 nBytes ) // ============================================================================ BiffOutputStream::BiffOutputStream( BinaryOutputStream& rOutStream, sal_uInt16 nMaxRecSize ) : + BinaryStreamBase( true ), maRecBuffer( rOutStream, nMaxRecSize ), mnPortionSize( 0 ), mnPortionPos( 0 ) @@ -96,19 +97,19 @@ BiffOutputStream::BiffOutputStream( BinaryOutputStream& rOutStream, sal_uInt16 n void BiffOutputStream::startRecord( sal_uInt16 nRecId ) { maRecBuffer.startRecord( nRecId ); - setPortionSize( 0 ); + setPortionSize( 1 ); } void BiffOutputStream::endRecord() { - setPortionSize( 0 ); + setPortionSize( 1 ); maRecBuffer.endRecord(); } -void BiffOutputStream::setPortionSize( sal_uInt16 nSize ) +void BiffOutputStream::setPortionSize( sal_uInt8 nSize ) { OSL_ENSURE( mnPortionPos == 0, "BiffOutputStream::setPortionSize - block operation inside portion" ); - mnPortionSize = nSize; + mnPortionSize = ::std::max< sal_uInt8 >( nSize, 1 ); mnPortionPos = 0; } @@ -119,20 +120,20 @@ sal_Int64 BiffOutputStream::tellBase() const return maRecBuffer.getBaseStream().tell(); } -sal_Int64 BiffOutputStream::getBaseLength() const +sal_Int64 BiffOutputStream::sizeBase() const { - return maRecBuffer.getBaseStream().getLength(); + return maRecBuffer.getBaseStream().size(); } // BinaryOutputStream interface (stream write access) ------------------------- -void BiffOutputStream::writeData( const StreamDataSequence& rData ) +void BiffOutputStream::writeData( const StreamDataSequence& rData, size_t nAtomSize ) { if( rData.hasElements() ) - writeMemory( rData.getConstArray(), rData.getLength() ); + writeMemory( rData.getConstArray(), rData.getLength(), nAtomSize ); } -void BiffOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes ) +void BiffOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize ) { if( pMem && (nBytes > 0) ) { @@ -140,7 +141,7 @@ void BiffOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes ) sal_Int32 nBytesLeft = nBytes; while( nBytesLeft > 0 ) { - sal_uInt16 nBlockSize = prepareRawBlock( nBytesLeft ); + sal_uInt16 nBlockSize = prepareWriteBlock( nBytesLeft, nAtomSize ); maRecBuffer.write( pnBuffer, nBlockSize ); pnBuffer += nBlockSize; nBytesLeft -= nBlockSize; @@ -148,59 +149,60 @@ void BiffOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes ) } } -void BiffOutputStream::fill( sal_uInt8 nValue, sal_Int32 nBytes ) +void BiffOutputStream::fill( sal_uInt8 nValue, sal_Int32 nBytes, size_t nAtomSize ) { sal_Int32 nBytesLeft = nBytes; while( nBytesLeft > 0 ) { - sal_uInt16 nBlockSize = prepareRawBlock( nBytesLeft ); + sal_uInt16 nBlockSize = prepareWriteBlock( nBytesLeft, nAtomSize ); maRecBuffer.fill( nValue, nBlockSize ); nBytesLeft -= nBlockSize; } } -void BiffOutputStream::writeBlock( const void* pMem, sal_uInt16 nBytes ) -{ - ensureRawBlock( nBytes ); - maRecBuffer.write( pMem, nBytes ); -} - // private -------------------------------------------------------------------- -void BiffOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize ) -{ - // byte swapping is done in calling BinaryOutputStream::writeValue() template function - writeBlock( pMem, nSize ); -} - -void BiffOutputStream::ensureRawBlock( sal_uInt16 nSize ) +sal_uInt16 BiffOutputStream::prepareWriteBlock( sal_Int32 nTotalSize, size_t nAtomSize ) { - if( (maRecBuffer.getRecLeft() < nSize) || - ((mnPortionSize > 0) && (mnPortionPos == 0) && (maRecBuffer.getRecLeft() < mnPortionSize)) ) + sal_uInt16 nRecLeft = maRecBuffer.getRecLeft(); + if( mnPortionSize <= 1 ) { - maRecBuffer.endRecord(); - maRecBuffer.startRecord( BIFF_ID_CONT ); + // no portions: restrict remaining record size to entire atoms + nRecLeft = static_cast< sal_uInt16 >( (nRecLeft / nAtomSize) * nAtomSize ); } - if( mnPortionSize > 0 ) + else { - OSL_ENSURE( mnPortionPos + nSize <= mnPortionSize, "BiffOutputStream::ensureRawBlock - portion overflow" ); - mnPortionPos = (mnPortionPos + nSize) % mnPortionSize; // prevent compiler warning, do not use operator+=, operator%= + sal_Int32 nPortionLeft = mnPortionSize - mnPortionPos; + if( nTotalSize <= nPortionLeft ) + { + // block fits into the current portion + OSL_ENSURE( nPortionLeft <= nRecLeft, "BiffOutputStream::prepareWriteBlock - portion exceeds record" ); + mnPortionPos = static_cast< sal_uInt8 >( (mnPortionPos + nTotalSize) % mnPortionSize ); + } + else + { + // restrict remaining record size to entire portions + OSL_ENSURE( mnPortionPos == 0, "BiffOutputStream::prepareWriteBlock - writing over multiple portions starts inside portion" ); + mnPortionPos = 0; + // check that atom size matches portion size + OSL_ENSURE( mnPortionSize % nAtomSize == 0, "BiffOutputStream::prepareWriteBlock - atom size does not match portion size" ); + sal_uInt8 nPortionSize = static_cast< sal_uInt8 >( (mnPortionSize / nAtomSize) * nAtomSize ); + // restrict remaining record size to entire portions + nRecLeft = (nRecLeft / nPortionSize) * nPortionSize; + } } -} -sal_uInt16 BiffOutputStream::prepareRawBlock( sal_Int32 nTotalSize ) -{ - sal_uInt16 nRecLeft = maRecBuffer.getRecLeft(); - if( mnPortionSize > 0 ) - { - OSL_ENSURE( mnPortionPos == 0, "BiffOutputStream::prepareRawBlock - block operation inside portion" ); - OSL_ENSURE( nTotalSize % mnPortionSize == 0, "BiffOutputStream::prepareRawBlock - portion size does not match block size" ); - nRecLeft = (nRecLeft / mnPortionSize) * mnPortionSize; - } - sal_uInt16 nSize = getLimitedValue< sal_uInt16, sal_Int32 >( nTotalSize, 0, nRecLeft ); - ensureRawBlock( nSize ); - return nSize; + // current record has space for some data: return size of available space + if( nRecLeft > 0 ) + return getLimitedValue< sal_uInt16, sal_Int32 >( nTotalSize, 0, nRecLeft ); + + // finish current record and start a new CONTINUE record + maRecBuffer.endRecord(); + maRecBuffer.startRecord( BIFF_ID_CONT ); + mnPortionPos = 0; + return prepareWriteBlock( nTotalSize, nAtomSize ); } + // ============================================================================ } // namespace xls diff --git a/oox/source/xls/drawingmanager.cxx b/oox/source/xls/drawingmanager.cxx index 3ee5c45a80b6..efba6824c8ac 100755 --- a/oox/source/xls/drawingmanager.cxx +++ b/oox/source/xls/drawingmanager.cxx @@ -1374,8 +1374,7 @@ Reference< XShape > BiffDrawingBase::createAndInsertXShape( const OUString& rSer Reference< XShape > xShape; if( (rService.getLength() > 0) && rxShapes.is() ) try { - Reference< XMultiServiceFactory > xFactory( getDocumentFactory(), UNO_SET_THROW ); - xShape.set( xFactory->createInstance( rService ), UNO_QUERY_THROW ); + xShape.set( getBaseFilter().getModelFactory()->createInstance( rService ), UNO_QUERY_THROW ); // insert shape into passed shape collection (maybe drawpage or group shape) rxShapes->add( xShape ); xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) ); diff --git a/oox/source/xls/excelchartconverter.cxx b/oox/source/xls/excelchartconverter.cxx index 53c0a3b83bf2..702a12fbde50 100644 --- a/oox/source/xls/excelchartconverter.cxx +++ b/oox/source/xls/excelchartconverter.cxx @@ -30,6 +30,7 @@ #include #include #include +#include "oox/core/filterbase.hxx" #include "oox/drawingml/chart/datasourcemodel.hxx" #include "oox/helper/containerhelper.hxx" #include "oox/xls/formulaparser.hxx" @@ -64,8 +65,7 @@ void ExcelChartConverter::createDataProvider( const Reference< XChartDocument >& try { Reference< XDataReceiver > xDataRec( rxChartDoc, UNO_QUERY_THROW ); - Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW ); - Reference< XDataProvider > xDataProv( xFactory->createInstance( + Reference< XDataProvider > xDataProv( getBaseFilter().getModelFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.chart2.data.DataProvider" ) ), UNO_QUERY_THROW ); xDataRec->attachDataProvider( xDataProv ); } diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index f097dec831d8..58049f4851d7 100755 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -1025,7 +1025,7 @@ struct OpCodeProviderImpl : public ApiOpCodes explicit OpCodeProviderImpl( const FunctionInfoVector& rFuncInfos, - const Reference< XMultiServiceFactory >& rxFactory ); + const Reference< XMultiServiceFactory >& rxModelFactory ); private: typedef ::std::map< OUString, ApiToken > ApiTokenMap; @@ -1047,11 +1047,11 @@ private: // ---------------------------------------------------------------------------- OpCodeProviderImpl::OpCodeProviderImpl( const FunctionInfoVector& rFuncInfos, - const Reference< XMultiServiceFactory >& rxFactory ) + const Reference< XMultiServiceFactory >& rxModelFactory ) { - if( rxFactory.is() ) try + if( rxModelFactory.is() ) try { - Reference< XFormulaOpCodeMapper > xMapper( rxFactory->createInstance( + Reference< XFormulaOpCodeMapper > xMapper( rxModelFactory->createInstance( CREATE_OUSTRING( "com.sun.star.sheet.FormulaOpCodeMapper" ) ), UNO_QUERY_THROW ); // op-codes provided as attributes @@ -1297,10 +1297,10 @@ bool OpCodeProviderImpl::initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, c // ---------------------------------------------------------------------------- -OpCodeProvider::OpCodeProvider( const Reference< XMultiServiceFactory >& rxFactory, +OpCodeProvider::OpCodeProvider( const Reference< XMultiServiceFactory >& rxModelFactory, FilterType eFilter, BiffType eBiff, bool bImportFilter ) : FunctionProvider( eFilter, eBiff, bImportFilter ), - mxOpCodeImpl( new OpCodeProviderImpl( getFuncs(), rxFactory ) ) + mxOpCodeImpl( new OpCodeProviderImpl( getFuncs(), rxModelFactory ) ) { } @@ -1335,12 +1335,12 @@ Sequence< FormulaOpCodeMapEntry > OpCodeProvider::getOoxParserMap() const // API formula parser wrapper ================================================= ApiParserWrapper::ApiParserWrapper( - const Reference< XMultiServiceFactory >& rxFactory, const OpCodeProvider& rOpCodeProv ) : + const Reference< XMultiServiceFactory >& rxModelFactory, const OpCodeProvider& rOpCodeProv ) : OpCodeProvider( rOpCodeProv ) { - if( rxFactory.is() ) try + if( rxModelFactory.is() ) try { - mxParser.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.sheet.FormulaParser" ) ), UNO_QUERY_THROW ); + mxParser.set( rxModelFactory->createInstance( CREATE_OUSTRING( "com.sun.star.sheet.FormulaParser" ) ), UNO_QUERY_THROW ); } catch( Exception& ) { @@ -1483,7 +1483,7 @@ TokenToRangeListState lclProcessClose( sal_Int32& ornParenLevel ) // ---------------------------------------------------------------------------- FormulaProcessorBase::FormulaProcessorBase( const WorkbookHelper& rHelper ) : - OpCodeProvider( rHelper.getDocumentFactory(), rHelper.getFilterType(), rHelper.getBiff(), rHelper.getBaseFilter().isImportFilter() ), + OpCodeProvider( rHelper.getBaseFilter().getModelFactory(), rHelper.getFilterType(), rHelper.getBiff(), rHelper.getBaseFilter().isImportFilter() ), ApiOpCodes( getOpCodes() ), WorkbookHelper( rHelper ) { diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index 26bf66986638..d7eb91a9c05c 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -1313,7 +1313,7 @@ private: OoxFormulaParserImpl::OoxFormulaParserImpl( const FormulaParser& rParent ) : FormulaParserImpl( rParent ), - maApiParser( rParent.getDocumentFactory(), rParent ), + maApiParser( rParent.getBaseFilter().getModelFactory(), rParent ), mnAddDataPos( 0 ), mbNeedExtRefs( true ) { diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx index c77381b2a1c8..782c138d43e2 100644 --- a/oox/source/xls/numberformatsbuffer.cxx +++ b/oox/source/xls/numberformatsbuffer.cxx @@ -1950,7 +1950,7 @@ NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper ) : // get the current locale try { - Reference< XMultiServiceFactory > xConfigProv( getGlobalFactory()->createInstance( + Reference< XMultiServiceFactory > xConfigProv( getBaseFilter().getServiceFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ), UNO_QUERY_THROW ); // try user-defined locale setting diff --git a/oox/source/xls/ooxformulaparser.cxx b/oox/source/xls/ooxformulaparser.cxx index efa69abcb750..a8860a8f2131 100644 --- a/oox/source/xls/ooxformulaparser.cxx +++ b/oox/source/xls/ooxformulaparser.cxx @@ -47,7 +47,7 @@ using ::rtl::OUString; class OOXMLFormulaParserImpl : private FormulaFinalizer { public: - explicit OOXMLFormulaParserImpl( const Reference< XMultiServiceFactory >& rxFactory ); + explicit OOXMLFormulaParserImpl( const Reference< XMultiServiceFactory >& rxModelFactory ); Sequence< FormulaToken > parseFormula( const OUString& rFormula, const CellAddress& rReferencePos ); @@ -60,9 +60,9 @@ private: // ---------------------------------------------------------------------------- -OOXMLFormulaParserImpl::OOXMLFormulaParserImpl( const Reference< XMultiServiceFactory >& rxFactory ) : - FormulaFinalizer( OpCodeProvider( rxFactory, FILTER_OOXML, BIFF_UNKNOWN, true ) ), - maApiParser( rxFactory, *this ) +OOXMLFormulaParserImpl::OOXMLFormulaParserImpl( const Reference< XMultiServiceFactory >& rxModelFactory ) : + FormulaFinalizer( OpCodeProvider( rxModelFactory, FILTER_OOXML, BIFF_UNKNOWN, true ) ), + maApiParser( rxModelFactory, *this ) { } @@ -115,7 +115,7 @@ const FunctionInfo* OOXMLFormulaParserImpl::resolveBadFuncName( const OUString& class OOXMLFormulaPrinterImpl : public OpCodeProvider { public: - explicit OOXMLFormulaPrinterImpl( const Reference< XMultiServiceFactory >& rxFactory ); + explicit OOXMLFormulaPrinterImpl( const Reference< XMultiServiceFactory >& rxModelFactory ); private: ApiParserWrapper maApiParser; @@ -123,9 +123,9 @@ private: // ---------------------------------------------------------------------------- -OOXMLFormulaPrinterImpl::OOXMLFormulaPrinterImpl( const Reference< XMultiServiceFactory >& rxFactory ) : - OpCodeProvider( rxFactory, FILTER_OOXML, BIFF_UNKNOWN, false ), - maApiParser( rxFactory, *this ) +OOXMLFormulaPrinterImpl::OOXMLFormulaPrinterImpl( const Reference< XMultiServiceFactory >& rxModelFactory ) : + OpCodeProvider( rxModelFactory, FILTER_OOXML, BIFF_UNKNOWN, false ), + maApiParser( rxModelFactory, *this ) { } @@ -202,8 +202,8 @@ Sequence< FormulaToken > SAL_CALL OOXMLFormulaParser::parseFormula( { if( !mxParserImpl ) { - Reference< XMultiServiceFactory > xFactory( mxComponent, UNO_QUERY_THROW ); - mxParserImpl.reset( new OOXMLFormulaParserImpl( xFactory ) ); + Reference< XMultiServiceFactory > xModelFactory( mxComponent, UNO_QUERY_THROW ); + mxParserImpl.reset( new OOXMLFormulaParserImpl( xModelFactory ) ); } return mxParserImpl->parseFormula( rFormula, rReferencePos ); } diff --git a/oox/source/xls/pagesettings.cxx b/oox/source/xls/pagesettings.cxx index 188bf78544ec..5c1770bd6463 100644 --- a/oox/source/xls/pagesettings.cxx +++ b/oox/source/xls/pagesettings.cxx @@ -903,8 +903,7 @@ Reference< XTextContent > HeaderFooterParser::createField( const OUString& rServ Reference< XTextContent > xContent; try { - Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW ); - xContent.set( xFactory->createInstance( rServiceName ), UNO_QUERY_THROW ); + xContent.set( getBaseFilter().getModelFactory()->createInstance( rServiceName ), UNO_QUERY_THROW ); } catch( Exception& ) { diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx index e8ca3539e167..5e5e5efef546 100644 --- a/oox/source/xls/pivotcachebuffer.cxx +++ b/oox/source/xls/pivotcachebuffer.cxx @@ -737,7 +737,7 @@ void PivotCacheField::importPCDFRangePr( BiffInputStream& rStrm ) void PivotCacheField::importPCDFDiscretePr( BiffInputStream& rStrm ) { - sal_Int32 nCount = static_cast< sal_Int32 >( rStrm.getLength() / 2 ); + sal_Int32 nCount = static_cast< sal_Int32 >( rStrm.size() / 2 ); for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex ) maDiscreteItems.push_back( rStrm.readuInt16() ); } diff --git a/oox/source/xls/viewsettings.cxx b/oox/source/xls/viewsettings.cxx index c9658dd41cf9..e23273b42b82 100644 --- a/oox/source/xls/viewsettings.cxx +++ b/oox/source/xls/viewsettings.cxx @@ -734,7 +734,7 @@ void ViewSettings::finalizeImport() sal_Int16 nShowMode = getWorkbookSettings().getApiShowObjectMode(); // view settings for all sheets - Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer( getGlobalFactory() ); + Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer( getBaseFilter().getComponentContext() ); if( !xSheetsNC.is() ) return; for( SheetPropertiesMap::const_iterator aIt = maSheetProps.begin(), aEnd = maSheetProps.end(); aIt != aEnd; ++aIt ) ContainerHelper::insertByName( xSheetsNC, rWorksheets.getCalcSheetName( aIt->first ), aIt->second ); @@ -746,7 +746,7 @@ void ViewSettings::finalizeImport() if( !rxActiveSheetView ) rxActiveSheetView.reset( new SheetViewModel ); - Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer( getGlobalFactory() ); + Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer( getBaseFilter().getComponentContext() ); if( xContainer.is() ) try { PropertyMap aPropMap; diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 69daca13812e..843bfd69fdfe 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -289,7 +289,7 @@ void WorkbookFragment::finalizeImport() { Reference< XInputStream > xInStrm = getBaseFilter().openInputStream( aVbaFragmentPath ); if( xInStrm.is() ) - setVbaProjectStorage( StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), xInStrm, false ) ) ); + setVbaProjectStorage( StorageRef( new ::oox::ole::OleStorage( getBaseFilter().getComponentContext(), xInStrm, false ) ) ); } // final conversions, e.g. calculation settings and view settings diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx index 8cd2748101d7..6adb7957d4b8 100644 --- a/oox/source/xls/workbookhelper.cxx +++ b/oox/source/xls/workbookhelper.cxx @@ -595,11 +595,6 @@ FilterBase& WorkbookHelper::getBaseFilter() const return mrBookData.getBaseFilter(); } -Reference< XMultiServiceFactory > WorkbookHelper::getGlobalFactory() const -{ - return mrBookData.getBaseFilter().getServiceFactory(); -} - FilterType WorkbookHelper::getFilterType() const { return mrBookData.getFilterType(); @@ -666,11 +661,6 @@ Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const return mrBookData.getDocument(); } -Reference< XMultiServiceFactory > WorkbookHelper::getDocumentFactory() const -{ - return mrBookData.getBaseFilter().getModelFactory(); -} - Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int16 nSheet ) const { Reference< XSpreadsheet > xSheet; diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx index 6889d42ed2f6..264555971ba0 100644 --- a/oox/source/xls/workbooksettings.cxx +++ b/oox/source/xls/workbooksettings.cxx @@ -299,7 +299,7 @@ void WorkbookSettings::finalizeImport() { getBaseFilter().getMediaDescriptor()[ CREATE_OUSTRING( "ReadOnly" ) ] <<= true; - Reference< XPropertySet > xDocumentSettings( getDocumentFactory()->createInstance( + Reference< XPropertySet > xDocumentSettings( getBaseFilter().getModelFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.document.Settings" ) ), UNO_QUERY_THROW ); PropertySet aSettingsProp( xDocumentSettings ); if( maFileSharing.mbRecommendReadOnly ) diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 124fdacd4431..00f65f90294f 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -681,7 +681,7 @@ Reference< XSheetCellRanges > WorksheetData::getCellRangeList( const ApiCellRang Reference< XSheetCellRanges > xRanges; if( mxSheet.is() && !rRanges.empty() ) try { - xRanges.set( getDocumentFactory()->createInstance( maSheetCellRanges ), UNO_QUERY_THROW ); + xRanges.set( getBaseFilter().getModelFactory()->createInstance( maSheetCellRanges ), UNO_QUERY_THROW ); Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW ); xRangeCont->addRangeAddresses( ContainerHelper::vectorToSequence( rRanges ), sal_False ); } @@ -1359,7 +1359,7 @@ void WorksheetData::insertHyperlink( const CellAddress& rAddress, const OUString if( xText.is() ) { // create a URL field object and set its properties - Reference< XTextContent > xUrlField( getDocumentFactory()->createInstance( maUrlTextField ), UNO_QUERY ); + Reference< XTextContent > xUrlField( getBaseFilter().getModelFactory()->createInstance( maUrlTextField ), UNO_QUERY ); OSL_ENSURE( xUrlField.is(), "WorksheetData::insertHyperlink - cannot create text field" ); if( xUrlField.is() ) { -- cgit From 76df3c1d4649e26dab420a03853fdcc16a7aee48 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 8 Feb 2011 10:57:27 +0100 Subject: native361: #i115269# rollback of installation, if unopkg fails --- .../setup/Controller/InstallationOngoingCtrl.java | 28 ++++++++--- .../org/openoffice/setup/InstallData.java | 9 ++++ .../openoffice/setup/Installer/LinuxInstaller.java | 9 ++++ .../source/packinfo/shellscripts_extensions.txt | 24 ++++++++++ .../shellextensions/registerextensions.cxx | 55 +++++++++++++--------- 5 files changed, 97 insertions(+), 28 deletions(-) diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java index b435b480eaea..f5ff37ad4d70 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java @@ -39,6 +39,7 @@ import org.openoffice.setup.Util.InfoDir; import org.openoffice.setup.Util.PackageCollector; import org.openoffice.setup.Util.SystemManager; import java.io.File; +import java.util.Collections; import java.util.Vector; public class InstallationOngoingCtrl extends PanelController { @@ -105,6 +106,7 @@ public class InstallationOngoingCtrl extends PanelController { private Vector installedPackages = new Vector(); public void run() { + boolean ignoreMajorUpgrade = false; LogManager.setCommandsHeaderLine("Installation"); Installer installer = InstallerFactory.getInstance(); String titleText = ResourceManager.getString("String_InstallationOngoing1"); @@ -131,32 +133,46 @@ public class InstallationOngoingCtrl extends PanelController { installer.installPackage(packageData); installedPackages.add(packageData); - if ( installData.isAbortedInstallation() ) { + if (( installData.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) { + ignoreMajorUpgrade = true; break; } } - if ( installData.isMajorUpgrade() ) { + if (( installData.isMajorUpgrade() ) && ( ! ignoreMajorUpgrade )) { for (int i = 0; i < removePackages.size(); i++) { PackageDescription packageData = (PackageDescription) removePackages.get(i); installer.uninstallPackage(packageData); } } - if ( installData.isAbortedInstallation() ) { + if (( installData.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) { // undoing the installation - LogManager.setCommandsHeaderLine("Installation aborted!"); - titleText = ResourceManager.getString("String_UninstallationOngoing1"); + if ( installData.isAbortedInstallation() ) { + LogManager.setCommandsHeaderLine("Installation aborted!"); + titleText = ResourceManager.getString("String_UninstallationOngoing1"); + } else { + LogManager.setCommandsHeaderLine("Error during installation!"); + titleText = ResourceManager.getString("String_UninstallationOngoing1"); + } panel.setTitle(titleText); panel.setStopButtonEnabled(false); LogManager.setCommandsHeaderLine("Uninstallation"); + // Inverting the package order for uninstallation + Collections.reverse(installedPackages); + for (int i = 0; i < installedPackages.size(); i++) { PackageDescription packageData = (PackageDescription) installedPackages.get(i); int progress = java.lang.Math.round(100/installedPackages.size()) * (i+1); panel.setProgressValue(progress); panel.setProgressText(packageData.getPackageName()); + if ( i == 0 ) { + installData.setIsFirstPackage(true); + } else { + installData.setIsFirstPackage(false); + } installer.uninstallPackage(packageData); } @@ -185,7 +201,7 @@ public class InstallationOngoingCtrl extends PanelController { getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_CANCEL); InstallData installData = InstallData.getInstance(); - if ( ! installData.isAbortedInstallation() ) { + if (( ! installData.isAbortedInstallation() ) && ( ! installData.isErrorInstallation() )) { InfoDir.prepareUninstallation(); } diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java index 358ebd489db4..71b1f702f2e8 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java @@ -78,6 +78,7 @@ public class InstallData static private boolean isDebianSystem = false; static private boolean useForceDebian = false; /* --force-debian */ static private boolean debianInvestigated = false; + static private boolean isFirstPackage = false; static private String installType; /* custom or typical installation */ static private String osType; /* Linux, SunOS, ... */ static private String installDir = null; @@ -668,6 +669,14 @@ public class InstallData isDebianSystem = value; } + public boolean isFirstPackage() { + return isFirstPackage; + } + + public void setIsFirstPackage(boolean value) { + isFirstPackage = value; + } + public boolean useForceDebian() { return useForceDebian; } diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java index 4383904569c0..c13f32f68339 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java @@ -346,6 +346,7 @@ public class LinuxInstaller extends Installer { String forceDebianString = ""; String nodepsString = ""; + String noscriptsString = ""; if ( ! data.debianInvestigated() ) { helper.investigateDebian(data); @@ -360,6 +361,10 @@ public class LinuxInstaller extends Installer { } } + if (( data.isErrorInstallation() ) && ( data.isFirstPackage() )) { + noscriptsString = "--noscripts"; + } + // Defining a Vector that contains the full rpm command. Then the string array can be // created dynamically. Otherwise there would be too many different scenarios. @@ -375,6 +380,10 @@ public class LinuxInstaller extends Installer { rpmVector.add(nodepsString); } + if ( ! noscriptsString.equals("") ) { + rpmVector.add(noscriptsString); + } + rpmVector.add("-ev"); if ( useLocalDatabase ) { diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt index 0be870990b71..3ab47f925802 100755 --- a/setup_native/source/packinfo/shellscripts_extensions.txt +++ b/setup_native/source/packinfo/shellscripts_extensions.txt @@ -76,6 +76,12 @@ END if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -87,6 +93,12 @@ END if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -99,6 +111,12 @@ END if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then "PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -111,6 +129,12 @@ END if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ] then "PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx index 9a748e9f2008..4a44b360fdba 100644 --- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -317,14 +317,13 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + // std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") ); std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe"); std::_tstring mystr; WIN32_FIND_DATA aFindFileData; - - mystr = "unopkg file: " + sUnoPkgFile; - //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + bool registrationError = false; // Find unopkg.exe HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData ); @@ -333,32 +332,44 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) { // unopkg.exe exists in program directory std::_tstring sCommand = sUnoPkgFile + " sync"; - mystr = "Command: " + sCommand; - //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); DWORD exitCode = 0; bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); -// if ( fSuccess ) -// { -// mystr = "Executed successfully!"; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } -// else -// { -// mystr = "An error occured during execution!"; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } +// if ( fSuccess ) +// { +// mystr = "Executed successfully!"; +// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); +// } +// else +// { +// mystr = "An error occured during execution!"; +// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); +// } + + if ( ! fSuccess ) + { + mystr = "ERROR: An error occured during registration of extensions!"; + MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK); + registrationError = true; + } FindClose( hFindUnopkg ); } -// else -// { -// mystr = "Error: Did not find " + sUnoPkgFile; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } + // else + // { + // mystr = "Error: Did not find " + sUnoPkgFile; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + // } - return ERROR_SUCCESS; + if ( registrationError ) + { + return 1; + } + else + { + return ERROR_SUCCESS; + } } -- cgit From c166cef2038926bfec05861d0d77c6061f1416ea Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 8 Feb 2011 10:57:27 +0100 Subject: native361: #i115269# rollback of installation, if unopkg fails --- .../inc_openoffice/windows/msi_templates/AdminExe.idt | 1 + .../inc_openoffice/windows/msi_templates/CustomAc.idt | 1 + .../inc_openoffice/windows/msi_templates/InstallE.idt | 1 + scp2/source/ooo/windowscustomaction_ooo.scp | 10 +++++----- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt index ede3f7cb4f42..18b3ca47bdf2 100644 --- a/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt +++ b/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt @@ -11,3 +11,4 @@ InstallFinalize 400 InstallInitialize 250 InstallValidate 200 ScheduleReboot ISSCHEDULEREBOOT 375 +SetInstalllocation 390 diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt index 17a47e8e9889..8708803f2cc9 100644 --- a/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt +++ b/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt @@ -122,6 +122,7 @@ setAllUsersProfile2K 51 ALLUSERSPROFILE [%ALLUSERSPROFILE] SetAllUsersProfileNT 51 ALLUSERSPROFILE [%SystemRoot]\Profiles\All Users setUserProfileNT 51 USERPROFILE [%USERPROFILE] SetARPInstallLocation 51 ARPINSTALLLOCATION [INSTALLLOCATION] +SetInstalllocation 51 RegisterExtensions [INSTALLLOCATION] NewProductFound 19 OOO_CUSTOMACTION_1 SameProductFound 19 OOO_CUSTOMACTION_2 SetLanguageSelected 51 LANG_SELECTED 1 diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt index defde2299409..13ac5a5aaf55 100644 --- a/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt +++ b/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt @@ -173,6 +173,7 @@ ScheduleReboot ISSCHEDULEREBOOT 3125 SelfRegModules 2850 SelfUnregModules 1100 SetARPInstallLocation 990 +SetInstalllocation 3140 SetODBCFolders 550 StartServices VersionNT 2800 StopServices VersionNT 950 diff --git a/scp2/source/ooo/windowscustomaction_ooo.scp b/scp2/source/ooo/windowscustomaction_ooo.scp index 7bd6c18fae99..4db0032367bc 100755 --- a/scp2/source/ooo/windowscustomaction_ooo.scp +++ b/scp2/source/ooo/windowscustomaction_ooo.scp @@ -201,12 +201,12 @@ End WindowsCustomAction gid_Customaction_Register_Extensions Name = "RegisterExtensions"; - Typ = "65"; + Typ = "1025"; Source = "shlxtmsi.dll"; Target = "RegisterExtensions"; Inbinarytable = 1; - Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\"", "end"); - Assignment2 = ("AdminExecuteSequence", "Not REMOVE=\"ALL\"", "end"); + Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\"", "behind_SetInstalllocation"); + Assignment2 = ("AdminExecuteSequence", "Not REMOVE=\"ALL\"", "behind_SetInstalllocation"); End WindowsCustomAction gid_Customaction_Remove_Extensions @@ -264,8 +264,8 @@ WindowsCustomAction gid_Customaction_CopyExtensionData Source = "shlxtmsi.dll"; Target = "copyExtensionData"; Inbinarytable = 1; - Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\"", "RegisterExtensions"); - Assignment2 = ("AdminExecuteSequence", "", "RegisterExtensions"); + Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\"", "end"); + Assignment2 = ("AdminExecuteSequence", "", "end"); End WindowsCustomAction gid_Customaction_RegCleanOld -- cgit From 350256300673540e25c7ba00add00531d646d8d4 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 8 Feb 2011 12:57:37 +0100 Subject: dr78: typos --- oox/inc/oox/helper/binaryinputstream.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx index 052c7920b05d..8bb554a2b57d 100644 --- a/oox/inc/oox/helper/binaryinputstream.hxx +++ b/oox/inc/oox/helper/binaryinputstream.hxx @@ -281,8 +281,8 @@ sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int template< typename Type > void BinaryInputStream::skipArray( sal_Int32 nElemCount ) { - sal_Int32 nSkipSize = getLimitedValue< sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type ); - implSkip( nSkipSize, sizeof( Type ) ); + sal_Int32 nSkipSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type ); + skip( nSkipSize, sizeof( Type ) ); } // ============================================================================ -- cgit From 424dd3898cd2de9b21d9631c7e36716a9536f94d Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Tue, 8 Feb 2011 19:07:49 +0100 Subject: dr78: #i116881# correct handling of cached page breaks for user-defined cell range, remove unused parameter in DoPrint --- sc/source/core/data/table5.cxx | 2 +- sc/source/ui/inc/printfun.hxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 4 ++-- sc/source/ui/view/pfuncache.cxx | 4 +--- sc/source/ui/view/preview.cxx | 2 +- sc/source/ui/view/printfun.cxx | 23 +---------------------- 6 files changed, 7 insertions(+), 30 deletions(-) diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 7c13756aab38..d2b868f8349e 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -308,7 +308,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) if (nEndRow+2 <= MAXROW) RemoveRowPageBreaks(nEndRow+2, MAXROW); } - mbPageBreaksValid = true; + mbPageBreaksValid = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case } void ScTable::RemoveManualBreaks() diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index fccee3812bba..8df620af023a 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -269,7 +269,7 @@ public: void ApplyPrintSettings(); // aus DoPrint() schon gerufen long DoPrint( const MultiSelection& rPageRanges, long nStartPage, long nDisplayStart, BOOL bDoPrint, - SfxProgress* pProgress, ScPreviewLocationData* pLocationData ); + ScPreviewLocationData* pLocationData ); // Werte abfragen - sofort diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index edd8c6f62e5d..f53d2e52a09e 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1063,7 +1063,7 @@ uno::Sequence SAL_CALL ScModelObj::getRenderer( sal_Int32 long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); - (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, FALSE, NULL, NULL ); + (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, FALSE, NULL ); ScRange aCellRange; BOOL bWasCellRange = aFunc.GetLastSourceRange( aCellRange ); @@ -1192,7 +1192,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec //<---i56629 } - (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, TRUE, NULL, NULL ); + (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, TRUE, NULL ); // resolve the hyperlinks for PDF export diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index 97061b365da6..2533e95919a2 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -77,8 +77,6 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, long nThisTab = 0; if ( rMark.GetTableSelect( nTab ) ) { - pDoc->InvalidatePageBreaks( nTab ); // user print area (selection) may be different - ScPrintFunc aFunc( pDocSh, pPrinter, nTab, nAttrPage, 0, pSelRange, &aSelection.GetOptions() ); nThisTab = aFunc.GetTotalPages(); nFirstAttr[nTab] = aFunc.GetFirstPageNo(); // from page style or previous sheet @@ -130,7 +128,7 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe aPage.Select( aPageRange ); ScPreviewLocationData aLocData( pDoc, pDev ); - aFunc.DoPrint( aPage, nTabStart, nDisplayStart, FALSE, NULL, &aLocData ); + aFunc.DoPrint( aPage, nTabStart, nDisplayStart, FALSE, &aLocData ); ScRange aCellRange; Rectangle aPixRect; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index bbea547831c6..4ca72de01e8e 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -406,7 +406,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) aPage.SetTotalRange( Range(0,RANGE_MAX) ); aPage.Select( aPageRange ); - long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, bDoPrint, NULL, pFillLocation ); + long nPrinted = pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, bDoPrint, pFillLocation ); DBG_ASSERT(nPrinted<=1, "was'n nu los?"); SetMapMode(aMMMode); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 9f5a3da6966c..4b758139a0a9 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -2667,7 +2666,7 @@ void ScPrintFunc::ApplyPrintSettings() long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, long nStartPage, long nDisplayStart, BOOL bDoPrint, - SfxProgress* pProgress, ScPreviewLocationData* pLocationData ) + ScPreviewLocationData* pLocationData ) { DBG_ASSERT(pDev,"Device == NULL"); if (!pParamSet) @@ -2687,9 +2686,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, MakeTableString(); - if ( pProgress ) - pProgress->SetText( String( ScResId( SCSTR_STAT_PRINT ) ) ); - //-------------------------------------------------------------------- long nPageNo = 0; @@ -2730,12 +2726,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, { PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2, bDoPrint, pLocationData ); - - if ( pProgress ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } ++nPrinted; } ++nPageNo; @@ -2760,12 +2750,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, { PrintPage( nPageNo+nDisplayStart, nX1, nY1, nX2, nY2, bDoPrint, pLocationData ); - - if ( pProgress ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } ++nPrinted; } ++nPageNo; @@ -2790,11 +2774,6 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, if ( nNoteAdd ) { nNoteNr += nNoteAdd; - if ( pProgress && bPageSelected ) - { - pProgress->SetState( nPageNo+nStartPage+1, nEndPage ); - pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? - } if (bPageSelected) { ++nPrinted; -- cgit From aec1b58b2f959770f072778ec187ae89f6053b76 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 10 Feb 2011 17:12:02 +0100 Subject: dr78: #164376# oox import performance: step 1 - encapsulate all code related to cell contents and cell formatting import into class SheetDataBuffer (including shared formulas, array formulas, table operations), remove FormulaContext concept to gain full control over formula import --- oox/inc/oox/xls/chartsheetfragment.hxx | 11 +- oox/inc/oox/xls/condformatbuffer.hxx | 4 +- oox/inc/oox/xls/defnamesbuffer.hxx | 23 +- oox/inc/oox/xls/excelfilter.hxx | 10 +- oox/inc/oox/xls/excelhandlers.hxx | 71 +-- oox/inc/oox/xls/formulabase.hxx | 122 ++--- oox/inc/oox/xls/formulaparser.hxx | 34 +- oox/inc/oox/xls/pivotcachefragment.hxx | 4 +- oox/inc/oox/xls/sharedformulabuffer.hxx | 111 ---- oox/inc/oox/xls/sheetdatabuffer.hxx | 224 ++++++++ oox/inc/oox/xls/sheetdatacontext.hxx | 12 +- oox/inc/oox/xls/workbookhelper.hxx | 62 +-- oox/inc/oox/xls/worksheetfragment.hxx | 13 +- oox/inc/oox/xls/worksheethelper.hxx | 158 ++---- oox/source/dump/xlsbdumper.ini | 1 + oox/source/xls/chartsheetfragment.cxx | 10 +- oox/source/xls/condformatbuffer.cxx | 46 +- oox/source/xls/defnamesbuffer.cxx | 182 +++---- oox/source/xls/excelchartconverter.cxx | 7 +- oox/source/xls/excelfilter.cxx | 51 +- oox/source/xls/excelhandlers.cxx | 27 +- oox/source/xls/externallinkbuffer.cxx | 11 +- oox/source/xls/formulabase.cxx | 52 +- oox/source/xls/formulaparser.cxx | 277 +++++----- oox/source/xls/makefile.mk | 2 +- oox/source/xls/pivotcachebuffer.cxx | 20 +- oox/source/xls/pivotcachefragment.cxx | 23 +- oox/source/xls/sharedformulabuffer.cxx | 212 -------- oox/source/xls/sheetdatabuffer.cxx | 689 +++++++++++++++++++++++ oox/source/xls/sheetdatacontext.cxx | 424 +++++++-------- oox/source/xls/workbookfragment.cxx | 80 ++- oox/source/xls/workbookhelper.cxx | 235 ++++---- oox/source/xls/worksheetfragment.cxx | 49 +- oox/source/xls/worksheethelper.cxx | 930 ++++++-------------------------- 34 files changed, 1942 insertions(+), 2245 deletions(-) delete mode 100644 oox/inc/oox/xls/sharedformulabuffer.hxx create mode 100755 oox/inc/oox/xls/sheetdatabuffer.hxx delete mode 100644 oox/source/xls/sharedformulabuffer.cxx create mode 100755 oox/source/xls/sheetdatabuffer.cxx diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx index 8dfedc5ba48e..2ff482ccd960 100644 --- a/oox/inc/oox/xls/chartsheetfragment.hxx +++ b/oox/inc/oox/xls/chartsheetfragment.hxx @@ -39,10 +39,8 @@ class ChartsheetFragment : public WorksheetFragmentBase { public: explicit ChartsheetFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - const ISegmentProgressBarRef& rxProgressBar, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const ::rtl::OUString& rFragmentPath ); protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -67,9 +65,8 @@ class BiffChartsheetFragment : public BiffWorksheetFragmentBase { public: explicit BiffChartsheetFragment( - const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const BiffWorkbookFragmentBase& rParent ); /** Imports the entire sheet fragment, returns true, if EOF record has been reached. */ virtual bool importFragment(); diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx index fae6381f6402..7b651856036d 100644 --- a/oox/inc/oox/xls/condformatbuffer.hxx +++ b/oox/inc/oox/xls/condformatbuffer.hxx @@ -44,9 +44,9 @@ namespace xls { /** Model for a single rule in a conditional formatting. */ struct CondFormatRuleModel { - typedef ::std::vector< TokensFormulaContext > ContextVector; + typedef ::std::vector< ApiTokenSequence > ApiTokenSequenceVector; - ContextVector maFormulas; /// Formulas for rule conditions. + ApiTokenSequenceVector maFormulas; /// Formulas for rule conditions. ::rtl::OUString maText; /// Text for 'contains' rules. sal_Int32 mnPriority; /// Priority of this rule. sal_Int32 mnType; /// Type of the rule. diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx index 5374c47f6a07..27f9f13f6e87 100644 --- a/oox/inc/oox/xls/defnamesbuffer.hxx +++ b/oox/inc/oox/xls/defnamesbuffer.hxx @@ -37,7 +37,6 @@ namespace com { namespace sun { namespace star { namespace oox { namespace xls { -class FormulaContext; class BiffInputStreamPos; // ============================================================================ @@ -91,15 +90,15 @@ public: /** Returns the original name as imported from or exported to the file. */ const ::rtl::OUString& getUpcaseModelName() const; /** Returns an Any with a SingleReference or ComplexReference, or an empty Any. */ - ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const; + ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddr ) const; protected: - /** Imports the OOXML formula string, using the passed formula context. */ - void importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet ); - /** Imports the BIFF12 formula, using the passed formula context. */ - void importBiff12Formula( FormulaContext& rContext, sal_Int16 nBaseSheet, SequenceInputStream& rStrm ); - /** Imports the BIFF formula, using the passed formula context. */ - void importBiffFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); + /** Converts the OOXML formula string stored in the own model. */ + ApiTokenSequence importOoxFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ); + /** Imports the BIFF12 formula from the passed stream. */ + ApiTokenSequence importBiff12Formula( const ::com::sun::star::table::CellAddress& rBaseAddr, SequenceInputStream& rStrm ); + /** Imports the BIFF formula from the passed stream. */ + ApiTokenSequence importBiffFormula( const ::com::sun::star::table::CellAddress& rBaseAddr, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); /** Tries to convert the passed token sequence to a SingleReference or ComplexReference. */ void extractReference( const ApiTokenSequence& rTokens ); @@ -151,10 +150,10 @@ public: bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const; private: - /** Imports the OOXML or BIFF12 formula, using the passed formula context. */ - void implImportOoxFormula( FormulaContext& rContext ); - /** Imports the BIFF formula, using the passed formula context. */ - void implImportBiffFormula( FormulaContext& rContext ); + /** Imports the OOXML or BIFF12 definition of the name. */ + void implImportOoxFormula(); + /** Imports the BIFF definition of the name. */ + void implImportBiffFormula(); private: typedef ::std::auto_ptr< StreamDataSequence > StreamDataSeqPtr; diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx index 789cbc99cb07..1e10a91e25c2 100644 --- a/oox/inc/oox/xls/excelfilter.hxx +++ b/oox/inc/oox/xls/excelfilter.hxx @@ -34,23 +34,23 @@ namespace oox { namespace xls { -class WorkbookData; +class WorkbookGlobals; // ============================================================================ class ExcelFilterBase { public: - void registerWorkbookData( WorkbookData& rData ); - WorkbookData& getWorkbookData() const; - void unregisterWorkbookData(); + void registerWorkbookGlobals( WorkbookGlobals& rBookGlob ); + WorkbookGlobals& getWorkbookGlobals() const; + void unregisterWorkbookGlobals(); protected: explicit ExcelFilterBase(); virtual ~ExcelFilterBase(); private: - WorkbookData* mpData; + WorkbookGlobals* mpBookGlob; }; // ============================================================================ diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx index 39088204d24d..deaa5244b0d0 100644 --- a/oox/inc/oox/xls/excelhandlers.hxx +++ b/oox/inc/oox/xls/excelhandlers.hxx @@ -45,55 +45,24 @@ class WorkbookContextBase : public ::oox::core::ContextHandler2, public Workbook { public: template< typename ParentType > - explicit WorkbookContextBase( ParentType& rParent ); + inline explicit WorkbookContextBase( ParentType& rParent ) : + ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) {} }; -// ---------------------------------------------------------------------------- - -template< typename ParentType > -WorkbookContextBase::WorkbookContextBase( ParentType& rParent ) : - ::oox::core::ContextHandler2( rParent ), - WorkbookHelper( rParent ) -{ -} - // ============================================================================ /** Context handler derived from the WorksheetHelper helper class. Used to import contexts in sheet fragments. */ -class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot +class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelper { public: template< typename ParentType > - explicit WorksheetContextBase( - ParentType& rParent, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); - - template< typename ParentType > - explicit WorksheetContextBase( ParentType& rParent ); + inline explicit WorksheetContextBase( ParentType& rParent ) : + ::oox::core::ContextHandler2( rParent ), WorksheetHelper( rParent ) {} }; -// ---------------------------------------------------------------------------- - -template< typename ParentType > -WorksheetContextBase::WorksheetContextBase( ParentType& rParent, - const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - ::oox::core::ContextHandler2( rParent ), - WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet ) -{ -} - -template< typename ParentType > -WorksheetContextBase::WorksheetContextBase( ParentType& rParent ) : - ::oox::core::ContextHandler2( rParent ), - WorksheetHelperRoot( rParent ) -{ -} - // ============================================================================ /** Fragment handler derived from the WorkbookHelper helper class. @@ -114,16 +83,9 @@ public: Used to import sheet fragments. */ -class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot +class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelper { public: - explicit WorksheetFragmentBase( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); - explicit WorksheetFragmentBase( const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath ); @@ -164,15 +126,9 @@ protected: Used to import contexts in sheet fragments. */ -class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelperRoot +class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelper { protected: - explicit BiffWorksheetContextBase( - const WorkbookHelper& rHelper, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); - explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper ); }; @@ -262,14 +218,12 @@ protected: Used to import sheet fragments. */ -class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelperRoot +class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelper { protected: explicit BiffWorksheetFragmentBase( - const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const BiffWorkbookFragmentBase& rParent ); }; // ---------------------------------------------------------------------------- @@ -280,9 +234,8 @@ class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase { public: explicit BiffSkipWorksheetFragment( - const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const BiffWorkbookFragmentBase& rParent ); virtual bool importFragment(); }; diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx index 47dac1aaf114..f7891c0ba940 100644 --- a/oox/inc/oox/xls/formulabase.hxx +++ b/oox/inc/oox/xls/formulabase.hxx @@ -28,6 +28,7 @@ #ifndef OOX_XLS_FORMULABASE_HXX #define OOX_XLS_FORMULABASE_HXX +#include #include #include #include @@ -40,7 +41,6 @@ namespace com { namespace sun { namespace star { namespace sheet { class XFormulaOpCodeMapper; } namespace sheet { class XFormulaParser; } - namespace sheet { class XFormulaTokens; } } } } namespace oox { template< typename Type > class Matrix; } @@ -216,7 +216,20 @@ const sal_uInt16 BIFF_FUNC_CEILING = 288; /// Function identif const sal_uInt16 BIFF_FUNC_HYPERLINK = 359; /// Function identifier of the HYPERLINK function. const sal_uInt16 BIFF_FUNC_WEEKNUM = 465; /// Function identifier of the WEEKNUM function. -// reference helpers ========================================================== +// Formula type =============================================================== + +/** Enumerates all possible types of a formula. */ +enum FormulaType +{ + FORMULATYPE_CELL, /// Simple cell formula, or reference to a shared formula name. + FORMULATYPE_ARRAY, /// Array (matrix) formula. + FORMULATYPE_SHAREDFORMULA, /// Shared formula definition. + FORMULATYPE_CONDFORMAT, /// Condition of a conditional format rule. + FORMULATYPE_VALIDATION, /// Condition of a data validation. + FORMULATYPE_DEFINEDNAME /// Definition of a defined name. +}; + +// Reference helpers ========================================================== /** A 2D formula cell reference struct with relative flags. */ struct BinSingleRef2d @@ -250,11 +263,15 @@ struct BinComplexRef2d void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset ); }; -// token vector, sequence ===================================================== +// Token vector, token sequence =============================================== typedef ::com::sun::star::sheet::FormulaToken ApiToken; typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence; +/** Contains the base address and type of a special token representing an array + formula or a shared formula (sal_False), or a table operation (sal_True). */ +typedef ::com::sun::star::beans::Pair< ::com::sun::star::table::CellAddress, sal_Bool > ApiSpecialTokenInfo; + /** A vector of formula tokens with additional convenience functions. */ class ApiTokenVector : public ::std::vector< ApiToken > { @@ -270,7 +287,7 @@ public: inline void append( sal_Int32 nOpCode, const Type& rData ) { append( nOpCode ) <<= rData; } }; -// token sequence iterator ==================================================== +// Token sequence iterator ==================================================== /** Token sequence iterator that is able to skip space tokens. */ class ApiTokenIterator @@ -297,7 +314,7 @@ private: const bool mbSkipSpaces; /// true = Skip whitespace tokens. }; -// list of API op-codes ======================================================= +// List of API op-codes ======================================================= /** Contains all API op-codes needed to build formulas with tokens. */ struct ApiOpCodes @@ -456,7 +473,7 @@ struct FunctionParamInfo bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE). }; -// function data ============================================================== +// Function data ============================================================== /** This enumeration contains constants for all known external libraries containing supported sheet functions. */ @@ -499,7 +516,7 @@ struct FunctionInfo typedef RefVector< FunctionInfo > FunctionInfoVector; -// function info parameter class iterator ===================================== +// Function info parameter class iterator ===================================== /** Iterator working on the mpParamInfos member of the FunctionInfo struct. @@ -525,7 +542,7 @@ private: bool mbParamPairs; }; -// base function provider ===================================================== +// Base function provider ===================================================== struct FunctionProviderImpl; @@ -566,7 +583,7 @@ private: FunctionProviderImplRef mxFuncImpl; /// Shared implementation between all copies of the provider. }; -// op-code and function provider ============================================== +// Op-code and function provider ============================================== struct OpCodeProviderImpl; @@ -621,74 +638,7 @@ private: PropertySet maParserProps; }; -// formula contexts =========================================================== - -class FormulaContext -{ -public: - inline void setBaseAddress( const ::com::sun::star::table::CellAddress& rBaseAddress ) - { maBaseAddress = rBaseAddress; } - - inline const ::com::sun::star::table::CellAddress& getBaseAddress() const { return maBaseAddress; } - inline bool isRelativeAsOffset() const { return mbRelativeAsOffset; } - inline bool is2dRefsAs3dRefs() const { return mb2dRefsAs3dRefs; } - inline bool isNulCharsAllowed() const { return mbAllowNulChars; } - - virtual void setTokens( const ApiTokenSequence& rTokens ) = 0; - virtual void setSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ); - -protected: - explicit FormulaContext( - bool bRelativeAsOffset, - bool b2dRefsAs3dRefs, - bool bAllowNulChars = false ); - virtual ~FormulaContext(); - -private: - ::com::sun::star::table::CellAddress maBaseAddress; - bool mbRelativeAsOffset; - bool mb2dRefsAs3dRefs; - bool mbAllowNulChars; -}; - -// ---------------------------------------------------------------------------- - -/** Stores the converted formula token sequence in a class member. */ -class TokensFormulaContext : public FormulaContext -{ -public: - explicit TokensFormulaContext( - bool bRelativeAsOffset, - bool b2dRefsAs3dRefs, - bool bAllowNulChars = false ); - - inline const ApiTokenSequence& getTokens() const { return maTokens; } - - virtual void setTokens( const ApiTokenSequence& rTokens ); - -private: - ApiTokenSequence maTokens; -}; - -// ---------------------------------------------------------------------------- - -/** Uses the com.sun.star.sheet.XFormulaTokens interface to set a token sequence. */ -class SimpleFormulaContext : public FormulaContext -{ -public: - explicit SimpleFormulaContext( - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens >& rxTokens, - bool bRelativeAsOffset, - bool b2dRefsAs3dRefs, - bool bAllowNulChars = false ); - - virtual void setTokens( const ApiTokenSequence& rTokens ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens > mxTokens; -}; - -// formula parser/printer base class for filters ============================== +// Formula parser/printer base class for filters ============================== /** Base class for import formula parsers and export formula compilers. */ class FormulaProcessorBase : public OpCodeProvider, protected ApiOpCodes, public WorkbookHelper @@ -896,6 +846,24 @@ public: ::rtl::OUString& orString, const ApiTokenSequence& rTokens ) const; + /** Tries to extract information about a special token used for array + formulas, shared formulas, or table operations. + + @param orTokenInfo (output parameter) The extracted information about + the token. Contains the base address and the token type (sal_False + for array or shared formulas, sal_True for table operations). + + @param rTokens The token sequence to be parsed. If it contains exactly + one OPCODE_BAD token with special token information, this + information will be extracted. + + @return True = token sequence is valid, output parameter orTokenInfo + contains the token information extracted from the token sequence. + */ + bool extractSpecialTokenInfo( + ApiSpecialTokenInfo& orTokenInfo, + const ApiTokenSequence& rTokens ) const; + /** Converts a single string with separators in the passed formula token sequence to a list of string tokens. diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx index faf1da3328f8..26752951abe4 100644 --- a/oox/inc/oox/xls/formulaparser.hxx +++ b/oox/inc/oox/xls/formulaparser.hxx @@ -114,38 +114,36 @@ public: virtual ~FormulaParser(); /** Converts an OOXML formula string. */ - void importFormula( - FormulaContext& rContext, + ApiTokenSequence importFormula( + const ::com::sun::star::table::CellAddress& rBaseAddr, const ::rtl::OUString& rFormulaString ) const; /** Imports and converts a BIFF12 token array from the passed stream. */ - void importFormula( - FormulaContext& rContext, + ApiTokenSequence importFormula( + const ::com::sun::star::table::CellAddress& rBaseAddr, + FormulaType eType, SequenceInputStream& rStrm ) const; /** Imports and converts a BIFF2-BIFF8 token array from the passed stream. @param pnFmlaSize Size of the token array. If null is passed, reads it from stream (1 byte in BIFF2, 2 bytes otherwise) first. */ - void importFormula( - FormulaContext& rContext, + ApiTokenSequence importFormula( + const ::com::sun::star::table::CellAddress& rBaseAddr, + FormulaType eType, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ) const; + /** Converts the passed Boolean value to a similar formula. */ + ApiTokenSequence convertBoolToFormula( bool bValue ) const; + /** Converts the passed BIFF error code to a similar formula. */ - void convertErrorToFormula( - FormulaContext& rContext, - sal_uInt8 nErrorCode ) const; + ApiTokenSequence convertErrorToFormula( sal_uInt8 nErrorCode ) const; /** Converts the passed token index of a defined name to a formula calling that name. */ - void convertNameToFormula( - FormulaContext& rContext, - sal_Int32 nTokenIndex ) const; + ApiTokenSequence convertNameToFormula( sal_Int32 nTokenIndex ) const; /** Converts the passed number into a HYPERLINK formula with the passed URL. */ - void convertNumberToHyperlink( - FormulaContext& rContext, - const ::rtl::OUString& rUrl, - double fValue ) const; + ApiTokenSequence convertNumberToHyperlink( const ::rtl::OUString& rUrl, double fValue ) const; /** Converts the passed XML formula to an OLE link target. */ ::rtl::OUString importOleTargetLink( const ::rtl::OUString& rFormulaString ); @@ -154,9 +152,7 @@ public: ::rtl::OUString importOleTargetLink( SequenceInputStream& rStrm ); /** Imports and converts an OLE link target from the passed stream. */ - ::rtl::OUString importOleTargetLink( - BiffInputStream& rStrm, - const sal_uInt16* pnFmlaSize = 0 ) const; + ::rtl::OUString importOleTargetLink( BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ) const; /** Converts the passed formula to a macro name for a drawing shape. */ ::rtl::OUString importMacroName( const ::rtl::OUString& rFormulaString ); diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx index 34a833e26525..f82c1f5cfe29 100644 --- a/oox/inc/oox/xls/pivotcachefragment.hxx +++ b/oox/inc/oox/xls/pivotcachefragment.hxx @@ -81,7 +81,7 @@ class PivotCacheRecordsFragment : public WorksheetFragmentBase { public: explicit PivotCacheRecordsFragment( - const WorkbookHelper& rHelper, + const WorksheetHelper& rHelper, const ::rtl::OUString& rFragmentPath, const PivotCache& rPivotCache ); @@ -126,7 +126,7 @@ class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase { public: explicit BiffPivotCacheRecordsContext( - const WorkbookHelper& rHelper, + const WorksheetHelper& rHelper, const PivotCache& rPivotCache ); /** Reads the current record from stream and tries to insert a cell into diff --git a/oox/inc/oox/xls/sharedformulabuffer.hxx b/oox/inc/oox/xls/sharedformulabuffer.hxx deleted file mode 100644 index 94b7572dcfd9..000000000000 --- a/oox/inc/oox/xls/sharedformulabuffer.hxx +++ /dev/null @@ -1,111 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef OOX_XLS_SHAREDFORMULABUFFER_HXX -#define OOX_XLS_SHAREDFORMULABUFFER_HXX - -#include -#include -#include "oox/xls/worksheethelper.hxx" - -namespace com { namespace sun { namespace star { - namespace sheet { class XFormulaTokens; } - namespace sheet { class XNamedRange; } -} } } - -namespace oox { -namespace xls { - -// ============================================================================ - -/** Formula context that supports shared formulas. */ -class ExtCellFormulaContext : public SimpleFormulaContext, public WorksheetHelper -{ -public: - explicit ExtCellFormulaContext( - const WorksheetHelper& rHelper, - const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens >& rxTokens, - const ::com::sun::star::table::CellAddress& rCellPos ); - - virtual void setSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ); -}; - -// ============================================================================ - -class SharedFormulaBuffer : public WorksheetHelper -{ -public: - explicit SharedFormulaBuffer( const WorksheetHelper& rHelper ); - - /** Imports a shared formula from a OOXML formula string. */ - void importSharedFmla( const ::rtl::OUString& rFormula, - const ::rtl::OUString& rSharedRange, sal_Int32 nId, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Imports a shared formula from a SHAREDFORMULA record in the passed stream */ - void importSharedFmla( SequenceInputStream& rStrm, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Imports a shared formula from a SHAREDFMLA record in the passed stream. */ - void importSharedFmla( BiffInputStream& rStrm, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - - /** Inserts a shared formula with the passed base address into a cell - described by the passed formula context. */ - void setSharedFormulaCell( - ExtCellFormulaContext& rContext, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Inserts a shared formula with the passed base address into a cell - described by the passed formula context. */ - void setSharedFormulaCell( - ExtCellFormulaContext& rContext, - sal_Int32 nSharedId ); - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > - createDefinedName( const BinAddress& rMapKey ); - - bool implSetSharedFormulaCell( - ExtCellFormulaContext& rContext, - const BinAddress& rMapKey ); - - void updateCachedCell( - const ::com::sun::star::table::CellAddress& rBaseAddr, - const BinAddress& rMapKey ); - -private: - typedef ::std::map< BinAddress, sal_Int32 > TokenIndexMap; - typedef ::std::auto_ptr< ExtCellFormulaContext > ContextPtr; - - TokenIndexMap maIndexMap; /// Maps shared formula base address to defined name identifier. - ContextPtr mxLastContext; /// Cached formula context for leading formula cell. -}; - -// ============================================================================ - -} // namespace xls -} // namespace oox - -#endif diff --git a/oox/inc/oox/xls/sheetdatabuffer.hxx b/oox/inc/oox/xls/sheetdatabuffer.hxx new file mode 100755 index 000000000000..52b71b4f0ef9 --- /dev/null +++ b/oox/inc/oox/xls/sheetdatabuffer.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef OOX_XLS_SHEETDATABUFFER_HXX +#define OOX_XLS_SHEETDATABUFFER_HXX + +#include +#include +#include "oox/xls/worksheethelper.hxx" + +namespace com { namespace sun { namespace star { + namespace sheet { class XNamedRange; } + namespace util { struct DateTime; } +} } } + +namespace oox { +namespace xls { + +// ============================================================================ + +/** Manages the cell contents and cell formatting of a sheet. + */ +class SheetDataBuffer : public WorksheetHelper +{ +public: + explicit SheetDataBuffer( const WorksheetHelper& rHelper ); + + /** Imports a shared formula from a OOXML formula string. */ + void importSharedFmla( const ::rtl::OUString& rFormula, + const ::rtl::OUString& rSharedRange, sal_Int32 nSharedId, + const ::com::sun::star::table::CellAddress& rBaseAddr ); + /** Imports a shared formula from a SHAREDFORMULA record in the passed stream */ + void importSharedFmla( SequenceInputStream& rStrm, + const ::com::sun::star::table::CellAddress& rBaseAddr ); + /** Imports a shared formula from a SHAREDFMLA record in the passed stream. */ + void importSharedFmla( BiffInputStream& rStrm, + const ::com::sun::star::table::CellAddress& rBaseAddr ); + + /** Sets the passed value to the cell. */ + void setValueCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + double fValue ); + /** Sets the passed string to the cell. */ + void setStringCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + const ::rtl::OUString& rText ); + /** Sets the passed rich-string to the cell. */ + void setStringCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + const RichString& rString, sal_Int32 nXfId ); + /** Sets the shared string with the passed identifier to the cell. */ + void setStringCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + sal_Int32 nStringId, sal_Int32 nXfId ); + /** Sets the passed date/time value to the cell and adjusts number format. */ + void setDateTimeCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + const ::com::sun::star::util::DateTime& rDateTime ); + /** Sets the passed boolean value to the cell and adjusts number format. */ + void setBooleanCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + bool bValue ); + /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ + void setErrorCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + const ::rtl::OUString& rErrorCode ); + /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ + void setErrorCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + sal_uInt8 nErrorCode ); + /** Sets the passed formula token sequence to the cell. */ + void setFormulaCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + const ApiTokenSequence& rTokens ); + /** Sets the shared formula with the passed identifier to the cell (OOXML only). */ + void setFormulaCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, + const ::com::sun::star::table::CellAddress& rCellAddr, + sal_Int32 nSharedId ); + + /** Inserts the passed token array as array formula. */ + void setArrayFormula( + const ::com::sun::star::table::CellRangeAddress& rRange, + const ApiTokenSequence& rTokens ); + /** Sets a multiple table operation to the passed range. */ + void setTableOperation( + const ::com::sun::star::table::CellRangeAddress& rRange, + const DataTableModel& rModel ); + + /** Sets default cell formatting for the specified range of rows. */ + void setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ); + /** Processes the cell formatting data of the passed cell. */ + void setCellFormat( const CellModel& rModel ); + /** Merges the cells in the passed cell range. */ + void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); + /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the specified cell. */ + void setStandardNumFmt( + const ::com::sun::star::table::CellAddress& rCellAddr, + sal_Int16 nStdNumFmt ); + + /** Final processing after the sheet has been imported. */ + void finalizeImport(); + +private: + struct XfIdRowRange; + struct XfIdRange; + + /** Creates and returns an empty named range with a special name for a + shared formula with the specified base position. */ + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > + createSharedFormulaName( const BinAddress& rMapKey ); + + /** Creates a formula token array representing the shared formula with the + passed identifier (OOXML only). */ + ApiTokenSequence resolveSharedFormula( sal_Int32 nSharedId ) const; + /** Creates a formula token array representing the shared formula at the + passed base address. */ + ApiTokenSequence resolveSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ) const; + + /** Retries to insert a shared formula that has not been set in the last + call to setFormulaCell() due to the missing formula definition. */ + void retryPendingSharedFormulaCell(); + + /** Writes all cell formatting attributes to the passed row range. */ + void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const; + /** Writes all cell formatting attributes to the passed cell range. */ + void writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const; + /** Tries to merge the ranges last inserted in maXfIdRanges with existing ranges. */ + void mergeXfIdRanges(); + + /** Merges the passed merged range and updates right/bottom cell borders. */ + void finalizeMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); + +private: + struct XfIdRowRange + { + sal_Int32 mnFirstRow; /// Index of first row. + sal_Int32 mnLastRow; /// Index of last row. + sal_Int32 mnXfId; /// XF identifier for the row range. + + explicit XfIdRowRange(); + bool intersects( const ::com::sun::star::table::CellRangeAddress& rRange ) const; + void set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); + bool tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); + }; + + struct XfIdRange + { + ::com::sun::star::table::CellRangeAddress + maRange; /// The formatted cell range. + sal_Int32 mnXfId; /// XF identifier for the range. + sal_Int32 mnNumFmtId; /// Number format id overriding the XF. + + void set( const CellModel& rModel ); + bool tryExpand( const CellModel& rModel ); + bool tryMerge( const XfIdRange& rXfIdRange ); + }; + + struct MergedRange + { + ::com::sun::star::table::CellRangeAddress + maRange; /// The formatted cell range. + sal_Int32 mnHorAlign; /// Horizontal alignment in the range. + + explicit MergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); + explicit MergedRange( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); + bool tryExpand( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); + }; + + typedef ::std::map< BinAddress, sal_Int32 > TokenIndexMap; + typedef ::std::map< BinAddress, XfIdRange > XfIdRangeMap; + typedef ::std::list< MergedRange > MergedRangeList; + + TokenIndexMap maTokenIndexes; /// Maps shared formula base address to defined name token index. + ::com::sun::star::table::CellAddress + maSharedFmlaAddr; /// Address of a cell containing a pending shared formula. + ::com::sun::star::table::CellAddress + maSharedBaseAddr; /// Base address of the pending shared formula. + XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows. + XfIdRangeMap maXfIdRanges; /// Collected XF identifiers for cell ranges. + MergedRangeList maMergedRanges; /// Merged cell ranges. + MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment. + bool mbPendingSharedFmla; /// True = maSharedFmlaAddr and maSharedBaseAddr are valid. +}; + +// ============================================================================ + +} // namespace xls +} // namespace oox + +#endif diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index fbf750cdcd72..c01106228c72 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -100,6 +100,7 @@ private: void importDataTable( SequenceInputStream& rStrm ); private: + SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. CellModel maCurrCell; /// Position and formatting of current imported cell. DataTableModel maTableData; /// Additional data for table operation ranges. BinAddress maCurrPos; /// Current position for binary import. @@ -158,11 +159,12 @@ private: void importDataTable( BiffInputStream& rStrm ); private: - CellModel maCurrCell; /// Position and formatting of current imported cell. - sal_uInt32 mnFormulaIgnoreSize; /// Number of bytes to be ignored in FORMULA record. - sal_uInt32 mnArrayIgnoreSize; /// Number of bytes to be ignored in ARRAY record. - sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. - OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. + SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. + CellModel maCurrCell; /// Position and formatting of current imported cell. + sal_uInt32 mnFormulaSkipSize; /// Number of bytes to be ignored in FORMULA record. + sal_uInt32 mnArraySkipSize; /// Number of bytes to be ignored in ARRAY record. + sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. + OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2. }; // ============================================================================ diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx index a67d1477b11a..049120aaaf40 100644 --- a/oox/inc/oox/xls/workbookhelper.hxx +++ b/oox/inc/oox/xls/workbookhelper.hxx @@ -108,27 +108,32 @@ class TableBuffer; class ThemeBuffer; class UnitConverter; class ViewSettings; -class WorkbookData; class WorkbookSettings; class WorksheetBuffer; +class WorkbookGlobals; +typedef ::boost::shared_ptr< WorkbookGlobals > WorkbookGlobalsRef; + /** Helper class to provice access to global workbook data. All classes derived from this helper class will have access to a singleton - object of type WorkbookData containing global workbook settings, buffers, - converters, etc. Nearly all classes in this filter implementation are - derived directly or indirectly from this class. + object of type WorkbookGlobals containing global workbook settings, + buffers, converters, etc. Nearly all classes in this filter implementation + are derived directly or indirectly from this class. - This class contains just a simple reference to the WorkbookData object to - prevent circular references, as the WorkbookData object contains a lot of - objects derived from this class. + This class contains just a simple reference to the WorkbookGlobals object + to prevent circular references, as the WorkbookGlobals object contains a + lot of objects derived from this class. */ class WorkbookHelper { public: - inline /*implicit*/ WorkbookHelper( WorkbookData& rBookData ) : mrBookData( rBookData ) {} + inline /*implicit*/ WorkbookHelper( WorkbookGlobals& rBookGlob ) : mrBookGlob( rBookGlob ) {} virtual ~WorkbookHelper(); + static WorkbookGlobalsRef constructGlobals( ExcelFilter& rFilter ); + static WorkbookGlobalsRef constructGlobals( ExcelBiffFilter& rFilter, BiffType eBiff ); + // filter ----------------------------------------------------------------- /** Returns the base filter object (base class of all filters). */ @@ -139,13 +144,13 @@ public: SegmentProgressBar& getProgressBar() const; /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */ bool isWorkbookFile() const; - /** Returns the index of the current sheet in the Calc document. */ + /** Returns the index of the current Calc sheet, if filter currently processes a sheet. */ sal_Int16 getCurrentSheetIndex() const; - /** Sets the index of the current sheet in the Calc document. */ - void setCurrentSheetIndex( sal_Int16 nSheet ); - /** Sets the VBA project storage. */ + /** Sets the VBA project storage used to import VBA source code and forms. */ void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ); + /** Sets the index of the current Calc sheet, if filter currently processes a sheet. */ + void setCurrentSheetIndex( sal_Int16 nSheet ); /** Final conversion after importing the workbook. */ void finalizeWorkbookImport(); @@ -277,38 +282,7 @@ public: BiffCodecHelper& getCodecHelper() const; private: - WorkbookData& mrBookData; -}; - -// ============================================================================ - -namespace prv { - -typedef ::boost::shared_ptr< WorkbookData > WorkbookDataRef; - -struct WorkbookDataOwner -{ - explicit WorkbookDataOwner( WorkbookDataRef xBookData ); - virtual ~WorkbookDataOwner(); - WorkbookDataRef mxBookData; -}; - -} // namespace prv - -// ---------------------------------------------------------------------------- - -class WorkbookHelperRoot : private prv::WorkbookDataOwner, public WorkbookHelper -{ -public: - explicit WorkbookHelperRoot( ExcelFilter& rFilter ); - explicit WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff ); - - /** Returns true, if this helper refers to a valid document. */ - bool isValid() const; - -private: - WorkbookHelperRoot( const WorkbookHelperRoot& ); - WorkbookHelperRoot& operator=( const WorkbookHelperRoot& ); + WorkbookGlobals& mrBookGlob; }; // ============================================================================ diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx index 5dca396c8908..d9cedee7b5e6 100644 --- a/oox/inc/oox/xls/worksheetfragment.hxx +++ b/oox/inc/oox/xls/worksheetfragment.hxx @@ -63,11 +63,8 @@ class WorksheetFragment : public WorksheetFragmentBase { public: explicit WorksheetFragment( - const WorkbookHelper& rHelper, - const ::rtl::OUString& rFragmentPath, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const ::rtl::OUString& rFragmentPath ); protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); @@ -134,10 +131,8 @@ class BiffWorksheetFragment : public BiffWorksheetFragmentBase { public: explicit BiffWorksheetFragment( - const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); + const WorksheetHelper& rHelper, + const BiffWorkbookFragmentBase& rParent ); virtual ~BiffWorksheetFragment(); /** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */ diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index b566289f5fec..fe788be852cb 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -44,7 +44,6 @@ namespace com { namespace sun { namespace star { namespace table { class XCellRange; } namespace table { class XTableColumns; } namespace table { class XTableRows; } - namespace util { struct DateTime; } } } } namespace oox { @@ -59,7 +58,8 @@ class CommentsBuffer; class CondFormatBuffer; class PageSettings; class QueryTableBuffer; -class SharedFormulaBuffer; +class RichString; +class SheetDataBuffer; class SheetViewSettings; class VmlDrawing; class WorksheetSettings; @@ -85,14 +85,14 @@ struct CellModel { ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > mxCell; ::com::sun::star::table::CellAddress maAddress; - ::rtl::OUString maValueStr; /// String containing cell value data. + ::rtl::OUString maValue; /// String containing cell value data. + ::rtl::OUString maFormula; /// String containing the formula definition. ::rtl::OUString maFormulaRef; /// String containing formula range for array/shared formulas. - sal_Int32 mnCellType; /// Data type of the cell. - sal_Int32 mnFormulaType; /// Type of the imported formula. - sal_Int32 mnSharedId; /// Shared formula identifier for current cell. - sal_Int32 mnXfId; /// XF identifier for the cell. - sal_Int32 mnNumFmtId; /// Forced number format for the cell. - bool mbHasValueStr; /// True = contents of maValueStr are valid. + sal_Int32 mnCellType; /// Data type of the cell value. + sal_Int32 mnFormulaType; /// Type of the formula (regular, array, shared, table). + sal_Int32 mnSharedId; /// Shared formula identifier. + sal_Int32 mnXfId; /// XF (cell formatting) identifier. + sal_Int32 mnNumFmtId; /// Forced number format (overrides XF if set). bool mbShowPhonetic; /// True = show phonetic text. inline explicit CellModel() { reset(); } @@ -216,12 +216,21 @@ struct ValidationModel // ============================================================================ // ============================================================================ -class WorksheetData; +class WorksheetGlobals; +typedef ::boost::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef; class WorksheetHelper : public WorkbookHelper { public: - /*implicit*/ WorksheetHelper( WorksheetData& rSheetData ); + /*implicit*/ WorksheetHelper( WorksheetGlobals& rSheetGlob ); + + static WorksheetGlobalsRef constructGlobals( + const WorkbookHelper& rHelper, + const ISegmentProgressBarRef& rxProgressBar, + WorksheetType eSheetType, + sal_Int16 nSheet ); + + // ------------------------------------------------------------------------ /** Returns the type of this sheet. */ WorksheetType getSheetType() const; @@ -233,8 +242,7 @@ public: /** Returns the XCell interface for the passed cell address. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > - getCell( - const ::com::sun::star::table::CellAddress& rAddress ) const; + getCell( const ::com::sun::star::table::CellAddress& rAddress ) const; /** Returns the XCell interface for the passed cell address string. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > getCell( @@ -248,32 +256,10 @@ public: /** Returns the XCellRange interface for the passed cell range address. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > - getCellRange( - const ::com::sun::star::table::CellRangeAddress& rRange ) const; - /** Returns the XCellRange interface for the passed range address string. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > - getCellRange( - const ::rtl::OUString& rRangeStr, - ::com::sun::star::table::CellRangeAddress* opRange = 0 ) const; - /** Returns the XCellRange interface for the passed range address. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > - getCellRange( - const BinRange& rBinRange, - ::com::sun::star::table::CellRangeAddress* opRange = 0 ) const; - + getCellRange( const ::com::sun::star::table::CellRangeAddress& rRange ) const; /** Returns the XSheetCellRanges interface for the passed cell range addresses. */ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > getCellRangeList( const ApiCellRangeList& rRanges ) const; - /** Returns the XSheetCellRanges interface for the passed space-separated range list. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > - getCellRangeList( - const ::rtl::OUString& rRangesStr, - ApiCellRangeList* opRanges = 0 ) const; - /** Returns the XSheetCellRanges interface for the passed range list. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > - getCellRangeList( - const BinRangeList& rBinRanges, - ApiCellRangeList* opRanges = 0 ) const; /** Returns the address of the passed cell. The cell reference must be valid. */ static ::com::sun::star::table::CellAddress @@ -309,10 +295,8 @@ public: /** Returns the size of the entire drawing page in 1/100 mm. */ ::com::sun::star::awt::Size getDrawPageSize() const; - /** Returns the worksheet settings object. */ - WorksheetSettings& getWorksheetSettings() const; - /** Returns the buffer containing all shared formulas in this sheet. */ - SharedFormulaBuffer& getSharedFormulas() const; + /** Returns the buffer for cell contents and cell formatting. */ + SheetDataBuffer& getSheetData() const; /** Returns the conditional formattings in this sheet. */ CondFormatBuffer& getCondFormats() const; /** Returns the buffer for all cell comments in this sheet. */ @@ -321,6 +305,8 @@ public: AutoFilterBuffer& getAutoFilters() const; /** Returns the buffer for all web query tables in this sheet. */ QueryTableBuffer& getQueryTables() const; + /** Returns the worksheet settings object. */ + WorksheetSettings& getWorksheetSettings() const; /** Returns the page/print settings for this sheet. */ PageSettings& getPageSettings() const; /** Returns the view settings for this sheet. */ @@ -330,59 +316,16 @@ public: /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */ BiffSheetDrawing& getBiffDrawing() const; - /** Sets the passed string to the cell. */ - void setStringCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - const ::rtl::OUString& rText ) const; - /** Sets the shared string with the passed identifier to the cell. */ - void setSharedStringCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - sal_Int32 nStringId, - sal_Int32 nXfId ) const; - /** Sets the passed date/time value to the cell and adjusts number format. */ - void setDateTimeCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - const ::com::sun::star::util::DateTime& rDateTime ) const; - /** Sets the passed boolean value to the cell and adjusts number format. */ - void setBooleanCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - bool bValue ) const; - /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ - void setErrorCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - const ::rtl::OUString& rErrorCode ) const; - /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ - void setErrorCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - sal_uInt8 nErrorCode ) const; - /** Sets cell contents to the cell specified in the passed cell model. */ - void setCell( CellModel& orModel ) const; - - /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the passed cell. */ - void setStandardNumFmt( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, - sal_Int16 nStdNumFmt ) const; - /** Changes the current sheet type. */ void setSheetType( WorksheetType eSheetType ); - /** Stores the cell formatting data of the current cell. */ - void setCellFormat( const CellModel& rModel ); - /** Merges the cells in the passed cell range. */ - void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); /** Sets a column or row page break described in the passed struct. */ void setPageBreak( const PageBreakModel& rModel, bool bRowBreak ); /** Inserts the hyperlink URL into the spreadsheet. */ void setHyperlink( const HyperlinkModel& rModel ); /** Inserts the data validation settings into the spreadsheet. */ void setValidation( const ValidationModel& rModel ); - /** Sets a multiple table operation to the passed range. */ - void setTableOperation( - const ::com::sun::star::table::CellRangeAddress& rRange, - const DataTableModel& rModel ) const; /** Sets the passed label ranges to the current sheet. */ - void setLabelRanges( - const ApiCellRangeList& rColRanges, - const ApiCellRangeList& rRowRanges ); + void setLabelRanges( const ApiCellRangeList& rColRanges, const ApiCellRangeList& rRowRanges ); /** Sets the path to the DrawingML fragment of this sheet. */ void setDrawingPath( const ::rtl::OUString& rDrawingPath ); /** Sets the path to the legacy VML drawing fragment of this sheet. */ @@ -416,6 +359,8 @@ public: @descr Row default formatting is converted directly, other settings are cached and converted in the finalizeWorksheetImport() call. */ void setRowModel( const RowModel& rModel ); + /** Specifies that the passed row needs to set its height manually. */ + void setManualRowHeight( sal_Int32 nRow ); /** Initial conversion before importing the worksheet. */ void initializeWorksheetImport(); @@ -423,50 +368,7 @@ public: void finalizeWorksheetImport(); private: - WorksheetData& mrSheetData; -}; - -// ============================================================================ - -namespace prv { - -typedef ::boost::shared_ptr< WorksheetData > WorksheetDataRef; - -struct WorksheetDataOwner -{ - explicit WorksheetDataOwner( WorksheetDataRef xSheetData ); - virtual ~WorksheetDataOwner(); - WorksheetDataRef mxSheetData; -}; - -} // namespace prv - -// ---------------------------------------------------------------------------- - -class WorksheetHelperRoot : private prv::WorksheetDataOwner, public WorksheetHelper -{ -public: - /** Returns true, if this helper refers to an existing Calc sheet. */ - bool isValidSheet() const; - -protected: - /** Constructs from the passed data, creates and owns a new data object. */ - explicit WorksheetHelperRoot( - const WorkbookHelper& rHelper, - const ISegmentProgressBarRef& rxProgressBar, - WorksheetType eSheetType, - sal_Int16 nSheet ); - - /** Constructs from another sheet helper, does not create a data object. */ - explicit WorksheetHelperRoot( - const WorksheetHelper& rHelper ); - - /** Constructs from another sheet helper, shares ownership of the passed helper. */ - explicit WorksheetHelperRoot( - const WorksheetHelperRoot& rHelper ); - -private: - WorksheetHelperRoot& operator=( const WorksheetHelperRoot& ); + WorksheetGlobals& mrSheetGlob; }; // ============================================================================ diff --git a/oox/source/dump/xlsbdumper.ini b/oox/source/dump/xlsbdumper.ini index 3490111c4ba5..16b97172d5c8 100644 --- a/oox/source/dump/xlsbdumper.ini +++ b/oox/source/dump/xlsbdumper.ini @@ -278,6 +278,7 @@ end # ARRAY ---------------------------------------------------------------------- flagslist=ARRAY-FLAGS + ignore=0xFE 0x01=recalc-always end diff --git a/oox/source/xls/chartsheetfragment.cxx b/oox/source/xls/chartsheetfragment.cxx index c67768ef2f22..c7a74c155a3c 100644 --- a/oox/source/xls/chartsheetfragment.cxx +++ b/oox/source/xls/chartsheetfragment.cxx @@ -45,9 +45,8 @@ using ::rtl::OUString; // ============================================================================ -ChartsheetFragment::ChartsheetFragment( const WorkbookHelper& rHelper, - const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) : - WorksheetFragmentBase( rHelper, rFragmentPath, rxProgressBar, SHEETTYPE_CHARTSHEET, nSheet ) +ChartsheetFragment::ChartsheetFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : + WorksheetFragmentBase( rHelper, rFragmentPath ) { } @@ -179,9 +178,8 @@ void ChartsheetFragment::importDrawing( SequenceInputStream& rStrm ) // ============================================================================ -BiffChartsheetFragment::BiffChartsheetFragment( const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) : - BiffWorksheetFragmentBase( rParent, rxProgressBar, SHEETTYPE_CHARTSHEET, nSheet ) +BiffChartsheetFragment::BiffChartsheetFragment( const WorksheetHelper& rHelper, const BiffWorkbookFragmentBase& rParent ) : + BiffWorksheetFragmentBase( rHelper, rParent ) { } diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx index 51d9170e1794..1914ed233f46 100644 --- a/oox/source/xls/condformatbuffer.cxx +++ b/oox/source/xls/condformatbuffer.cxx @@ -193,10 +193,9 @@ void CondFormatRule::importCfRule( const AttributeList& rAttribs ) void CondFormatRule::appendFormula( const OUString& rFormula ) { - TokensFormulaContext aContext( true, false ); - aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() ); - getFormulaParser().importFormula( aContext, rFormula ); - maModel.maFormulas.push_back( aContext ); + CellAddress aBaseAddr = mrCondFormat.getRanges().getBaseAddress(); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, rFormula ); + maModel.maFormulas.push_back( aTokens ); } void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) @@ -216,25 +215,24 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) OSL_ENSURE( (nFmla1Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" ); if( rStrm.getRemaining() >= 8 ) { - TokensFormulaContext aContext( true, false ); - aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() ); - getFormulaParser().importFormula( aContext, rStrm ); - maModel.maFormulas.push_back( aContext ); + CellAddress aBaseAddr = mrCondFormat.getRanges().getBaseAddress(); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + maModel.maFormulas.push_back( aTokens ); // second formula OSL_ENSURE( (nFmla2Size >= 0) || (nFmla3Size == 0), "CondFormatRule::importCfRule - missing second formula" ); OSL_ENSURE( (nFmla2Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" ); if( rStrm.getRemaining() >= 8 ) { - getFormulaParser().importFormula( aContext, rStrm ); - maModel.maFormulas.push_back( aContext ); + aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + maModel.maFormulas.push_back( aTokens ); // third formula OSL_ENSURE( (nFmla3Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" ); if( rStrm.getRemaining() >= 8 ) { - getFormulaParser().importFormula( aContext, rStrm ); - maModel.maFormulas.push_back( aContext ); + aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm ); + maModel.maFormulas.push_back( aTokens ); } } } @@ -419,21 +417,20 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority ) OSL_ENSURE( (nFmla1Size > 0) || (nFmla2Size == 0), "CondFormatRule::importCfRule - missing first formula" ); if( nFmla1Size > 0 ) { - TokensFormulaContext aContext( true, false ); - aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() ); - getFormulaParser().importFormula( aContext, rStrm, &nFmla1Size ); - maModel.maFormulas.push_back( aContext ); + CellAddress aBaseAddr = mrCondFormat.getRanges().getBaseAddress(); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm, &nFmla1Size ); + maModel.maFormulas.push_back( aTokens ); if( nFmla2Size > 0 ) { - getFormulaParser().importFormula( aContext, rStrm, &nFmla2Size ); - maModel.maFormulas.push_back( aContext ); + aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_CONDFORMAT, rStrm, &nFmla2Size ); + maModel.maFormulas.push_back( aTokens ); } } } void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >& rxEntries ) { - ConditionOperator eOperator = ::com::sun::star::sheet::ConditionOperator_NONE; + ConditionOperator eOperator = ConditionOperator_NONE; /* Replacement formula for unsupported rule types (text comparison rules, time period rules, cell type rules). The replacement formulas below may @@ -460,7 +457,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > eOperator = CondFormatBuffer::convertToApiOperator( maModel.mnOperator ); break; case XML_expression: - eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA; + eOperator = ConditionOperator_FORMULA; break; case XML_containsText: OSL_ENSURE( maModel.mnOperator == XML_containsText, "CondFormatRule::finalizeImport - unexpected operator" ); @@ -591,17 +588,17 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries > // set the replacement formula maModel.maFormulas.clear(); appendFormula( aReplaceFormula ); - eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA; + eOperator = ConditionOperator_FORMULA; } - if( rxEntries.is() && (eOperator != ::com::sun::star::sheet::ConditionOperator_NONE) && !maModel.maFormulas.empty() ) + if( rxEntries.is() && (eOperator != ConditionOperator_NONE) && !maModel.maFormulas.empty() ) { ::std::vector< PropertyValue > aProps; // create condition properties lclAppendProperty( aProps, CREATE_OUSTRING( "Operator" ), eOperator ); - lclAppendProperty( aProps, CREATE_OUSTRING( "Formula1" ), maModel.maFormulas[ 0 ].getTokens() ); + lclAppendProperty( aProps, CREATE_OUSTRING( "Formula1" ), maModel.maFormulas[ 0 ] ); if( maModel.maFormulas.size() >= 2 ) - lclAppendProperty( aProps, CREATE_OUSTRING( "Formula2" ), maModel.maFormulas[ 1 ].getTokens() ); + lclAppendProperty( aProps, CREATE_OUSTRING( "Formula2" ), maModel.maFormulas[ 1 ] ); // style name for the formatting attributes OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); @@ -744,7 +741,6 @@ void CondFormatBuffer::finalizeImport() ConditionOperator CondFormatBuffer::convertToApiOperator( sal_Int32 nToken ) { - using namespace ::com::sun::star::sheet; switch( nToken ) { case XML_between: return ConditionOperator_BETWEEN; diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx index 1fda43065fde..335aae5273af 100644 --- a/oox/source/xls/defnamesbuffer.cxx +++ b/oox/source/xls/defnamesbuffer.cxx @@ -189,32 +189,32 @@ void lclConvertRefFlags( sal_Int32& ornFlags, sal_Int32& ornAbsPos, sal_Int32& o } } -void lclConvertSingleRefFlags( SingleReference& orApiRef, const CellAddress& rBaseAddress, bool bColRel, bool bRowRel ) +void lclConvertSingleRefFlags( SingleReference& orApiRef, const CellAddress& rBaseAddr, bool bColRel, bool bRowRel ) { using namespace ::com::sun::star::sheet::ReferenceFlags; lclConvertRefFlags( orApiRef.Flags, orApiRef.Column, orApiRef.RelativeColumn, - rBaseAddress.Column, COLUMN_RELATIVE, bColRel ); + rBaseAddr.Column, COLUMN_RELATIVE, bColRel ); lclConvertRefFlags( orApiRef.Flags, orApiRef.Row, orApiRef.RelativeRow, - rBaseAddress.Row, ROW_RELATIVE, bRowRel ); + rBaseAddr.Row, ROW_RELATIVE, bRowRel ); } -Any lclConvertReference( const Any& rRefAny, const CellAddress& rBaseAddress, sal_uInt16 nRelFlags ) +Any lclConvertReference( const Any& rRefAny, const CellAddress& rBaseAddr, sal_uInt16 nRelFlags ) { if( rRefAny.has< SingleReference >() && !getFlag( nRelFlags, BIFF_REFFLAG_COL2REL ) && !getFlag( nRelFlags, BIFF_REFFLAG_ROW2REL ) ) { SingleReference aApiRef; rRefAny >>= aApiRef; - lclConvertSingleRefFlags( aApiRef, rBaseAddress, getFlag( nRelFlags, BIFF_REFFLAG_COL1REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW1REL ) ); + lclConvertSingleRefFlags( aApiRef, rBaseAddr, getFlag( nRelFlags, BIFF_REFFLAG_COL1REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW1REL ) ); return Any( aApiRef ); } if( rRefAny.has< ComplexReference >() ) { ComplexReference aApiRef; rRefAny >>= aApiRef; - lclConvertSingleRefFlags( aApiRef.Reference1, rBaseAddress, getFlag( nRelFlags, BIFF_REFFLAG_COL1REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW1REL ) ); - lclConvertSingleRefFlags( aApiRef.Reference2, rBaseAddress, getFlag( nRelFlags, BIFF_REFFLAG_COL2REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW2REL ) ); + lclConvertSingleRefFlags( aApiRef.Reference1, rBaseAddr, getFlag( nRelFlags, BIFF_REFFLAG_COL1REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW1REL ) ); + lclConvertSingleRefFlags( aApiRef.Reference2, rBaseAddr, getFlag( nRelFlags, BIFF_REFFLAG_COL2REL ), getFlag( nRelFlags, BIFF_REFFLAG_ROW2REL ) ); return Any( aApiRef ); } return Any(); @@ -248,7 +248,7 @@ const OUString& DefinedNameBase::getUpcaseModelName() const return maUpModelName; } -Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const +Any DefinedNameBase::getReference( const CellAddress& rBaseAddr ) const { if( maRefAny.hasValue() && (maModel.maName.getLength() >= 2) && (maModel.maName[ 0 ] == '\x01') ) { @@ -260,7 +260,7 @@ Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const { ExternalReference aApiExtRef; maRefAny >>= aApiExtRef; - Any aRefAny = lclConvertReference( aApiExtRef.Reference, rBaseAddress, nRelFlags ); + Any aRefAny = lclConvertReference( aApiExtRef.Reference, rBaseAddr, nRelFlags ); if( aRefAny.hasValue() ) { aApiExtRef.Reference <<= aRefAny; @@ -269,37 +269,30 @@ Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const } else { - return lclConvertReference( maRefAny, rBaseAddress, nRelFlags ); + return lclConvertReference( maRefAny, rBaseAddr, nRelFlags ); } } } return Any(); } -void DefinedNameBase::importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet ) +ApiTokenSequence DefinedNameBase::importOoxFormula( const CellAddress& rBaseAddr ) { - if( maModel.maFormula.getLength() > 0 ) - { - rContext.setBaseAddress( CellAddress( nBaseSheet, 0, 0 ) ); - getFormulaParser().importFormula( rContext, maModel.maFormula ); - } - else - getFormulaParser().convertErrorToFormula( rContext, BIFF_ERR_NAME ); + return (maModel.maFormula.getLength() > 0) ? + getFormulaParser().importFormula( rBaseAddr, maModel.maFormula ) : + getFormulaParser().convertErrorToFormula( BIFF_ERR_NAME ); } -void DefinedNameBase::importBiff12Formula( FormulaContext& rContext, sal_Int16 nBaseSheet, SequenceInputStream& rStrm ) +ApiTokenSequence DefinedNameBase::importBiff12Formula( const CellAddress& rBaseAddr, SequenceInputStream& rStrm ) { - rContext.setBaseAddress( CellAddress( nBaseSheet, 0, 0 ) ); - getFormulaParser().importFormula( rContext, rStrm ); + return getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_DEFINEDNAME, rStrm ); } -void DefinedNameBase::importBiffFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) +ApiTokenSequence DefinedNameBase::importBiffFormula( const CellAddress& rBaseAddr, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) { - rContext.setBaseAddress( CellAddress( nBaseSheet, 0, 0 ) ); - if( !pnFmlaSize || (*pnFmlaSize > 0) ) - getFormulaParser().importFormula( rContext, rStrm, pnFmlaSize ); - else - getFormulaParser().convertErrorToFormula( rContext, BIFF_ERR_NAME ); + return (!pnFmlaSize || (*pnFmlaSize > 0)) ? + getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_DEFINEDNAME, rStrm, pnFmlaSize ) : + getFormulaParser().convertErrorToFormula( BIFF_ERR_NAME ); } void DefinedNameBase::extractReference( const ApiTokenSequence& rTokens ) @@ -467,9 +460,9 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcShee these names contain a simple cell reference or range reference. Other regular defined names and external names rely on existence of this reference. */ - TokensFormulaContext aContext( true, true ); - importBiffFormula( aContext, mnCalcSheet, rStrm, &mnFmlaSize ); - extractReference( aContext.getTokens() ); + CellAddress aBaseAddr( mnCalcSheet, 0, 0 ); + ApiTokenSequence aTokens = importBiffFormula( aBaseAddr, rStrm, &mnFmlaSize ); + extractReference( aTokens ); } else { @@ -523,69 +516,84 @@ void DefinedName::createNameObject() void DefinedName::convertFormula() { Reference< XFormulaTokens > xTokens( mxNamedRange, UNO_QUERY ); - if( xTokens.is() ) + if( !xTokens.is() ) + return; + + // convert and set formula of the defined name + ApiTokenSequence aTokens; + CellAddress aBaseAddr( mnCalcSheet, 0, 0 ); + switch( getFilterType() ) { - // convert and set formula of the defined name - switch( getFilterType() ) + case FILTER_OOXML: { - case FILTER_OOXML: + if( mxFormula.get() ) { - SimpleFormulaContext aContext( xTokens, true, false ); - implImportOoxFormula( aContext ); + SequenceInputStream aStrm( *mxFormula ); + aTokens = importBiff12Formula( aBaseAddr, aStrm ); } - break; - case FILTER_BIFF: + else + aTokens = importOoxFormula( aBaseAddr ); + } + break; + case FILTER_BIFF: + { + OSL_ENSURE( mxBiffStrm.get(), "DefinedName::convertFormula - missing BIFF stream" ); + if( mxBiffStrm.get() ) { - SimpleFormulaContext aContext( xTokens, true, getBiff() <= BIFF4 ); - implImportBiffFormula( aContext ); + BiffInputStream& rStrm = mxBiffStrm->getStream(); + BiffInputStreamPosGuard aStrmGuard( rStrm ); + if( mxBiffStrm->restorePosition() ) + aTokens = importBiffFormula( aBaseAddr, rStrm, &mnFmlaSize ); } - break; - case FILTER_UNKNOWN: break; } + break; + case FILTER_UNKNOWN: + break; + } + xTokens->setTokens( aTokens ); - // set built-in names (print ranges, repeated titles, filter ranges) - if( !isGlobalName() ) switch( mcBuiltinId ) + // set built-in names (print ranges, repeated titles, filter ranges) + if( !isGlobalName() ) switch( mcBuiltinId ) + { + case BIFF_DEFNAME_PRINTAREA: { - case BIFF_DEFNAME_PRINTAREA: - { - Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY ); - ApiCellRangeList aPrintRanges; - getFormulaParser().extractCellRangeList( aPrintRanges, xTokens->getTokens(), false, mnCalcSheet ); - if( xPrintAreas.is() && !aPrintRanges.empty() ) - xPrintAreas->setPrintAreas( ContainerHelper::vectorToSequence( aPrintRanges ) ); - } - break; - case BIFF_DEFNAME_PRINTTITLES: + Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY ); + ApiCellRangeList aPrintRanges; + getFormulaParser().extractCellRangeList( aPrintRanges, xTokens->getTokens(), false, mnCalcSheet ); + if( xPrintAreas.is() && !aPrintRanges.empty() ) + xPrintAreas->setPrintAreas( ContainerHelper::vectorToSequence( aPrintRanges ) ); + } + break; + case BIFF_DEFNAME_PRINTTITLES: + { + Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY ); + ApiCellRangeList aTitleRanges; + getFormulaParser().extractCellRangeList( aTitleRanges, xTokens->getTokens(), false, mnCalcSheet ); + if( xPrintAreas.is() && !aTitleRanges.empty() ) { - Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY ); - ApiCellRangeList aTitleRanges; - getFormulaParser().extractCellRangeList( aTitleRanges, xTokens->getTokens(), false, mnCalcSheet ); - if( xPrintAreas.is() && !aTitleRanges.empty() ) + bool bHasRowTitles = false; + bool bHasColTitles = false; + const CellAddress& rMaxPos = getAddressConverter().getMaxAddress(); + for( ApiCellRangeList::const_iterator aIt = aTitleRanges.begin(), aEnd = aTitleRanges.end(); (aIt != aEnd) && (!bHasRowTitles || !bHasColTitles); ++aIt ) { - bool bHasRowTitles = false; - bool bHasColTitles = false; - const CellAddress& rMaxPos = getAddressConverter().getMaxAddress(); - for( ApiCellRangeList::const_iterator aIt = aTitleRanges.begin(), aEnd = aTitleRanges.end(); (aIt != aEnd) && (!bHasRowTitles || !bHasColTitles); ++aIt ) + bool bFullRow = (aIt->StartColumn == 0) && (aIt->EndColumn >= rMaxPos.Column); + bool bFullCol = (aIt->StartRow == 0) && (aIt->EndRow >= rMaxPos.Row); + if( !bHasRowTitles && bFullRow && !bFullCol ) { - bool bFullRow = (aIt->StartColumn == 0) && (aIt->EndColumn >= rMaxPos.Column); - bool bFullCol = (aIt->StartRow == 0) && (aIt->EndRow >= rMaxPos.Row); - if( !bHasRowTitles && bFullRow && !bFullCol ) - { - xPrintAreas->setTitleRows( *aIt ); - xPrintAreas->setPrintTitleRows( sal_True ); - bHasRowTitles = true; - } - else if( !bHasColTitles && bFullCol && !bFullRow ) - { - xPrintAreas->setTitleColumns( *aIt ); - xPrintAreas->setPrintTitleColumns( sal_True ); - bHasColTitles = true; - } + xPrintAreas->setTitleRows( *aIt ); + xPrintAreas->setPrintTitleRows( sal_True ); + bHasRowTitles = true; + } + else if( !bHasColTitles && bFullCol && !bFullRow ) + { + xPrintAreas->setTitleColumns( *aIt ); + xPrintAreas->setPrintTitleColumns( sal_True ); + bHasColTitles = true; } } } - break; } + break; } } @@ -597,26 +605,6 @@ bool DefinedName::getAbsoluteRange( CellRangeAddress& orRange ) const return xTokens.is() && getFormulaParser().extractCellRange( orRange, xTokens->getTokens(), false ); } -void DefinedName::implImportOoxFormula( FormulaContext& rContext ) -{ - if( mxFormula.get() ) - { - SequenceInputStream aStrm( *mxFormula ); - importBiff12Formula( rContext, mnCalcSheet, aStrm ); - } - else - importOoxFormula( rContext, mnCalcSheet ); -} - -void DefinedName::implImportBiffFormula( FormulaContext& rContext ) -{ - OSL_ENSURE( mxBiffStrm.get(), "DefinedName::implImportBiffFormula - missing BIFF stream" ); - BiffInputStream& rStrm = mxBiffStrm->getStream(); - BiffInputStreamPosGuard aStrmGuard( rStrm ); - if( mxBiffStrm->restorePosition() ) - importBiffFormula( rContext, mnCalcSheet, rStrm, &mnFmlaSize ); -} - // ============================================================================ DefinedNamesBuffer::DefinedNamesBuffer( const WorkbookHelper& rHelper ) : diff --git a/oox/source/xls/excelchartconverter.cxx b/oox/source/xls/excelchartconverter.cxx index 702a12fbde50..e2538cbc3ebc 100644 --- a/oox/source/xls/excelchartconverter.cxx +++ b/oox/source/xls/excelchartconverter.cxx @@ -85,13 +85,12 @@ Reference< XDataSequence > ExcelChartConverter::createDataSequence( { // parse the formula string, create a token sequence FormulaParser& rParser = getFormulaParser(); - TokensFormulaContext aContext( true, true ); - aContext.setBaseAddress( CellAddress( getCurrentSheetIndex(), 0, 0 ) ); - rParser.importFormula( aContext, rDataSeq.maFormula ); + CellAddress aBaseAddr( getCurrentSheetIndex(), 0, 0 ); + ApiTokenSequence aTokens = rParser.importFormula( aBaseAddr, rDataSeq.maFormula ); // create a range list from the token sequence ApiCellRangeList aRanges; - rParser.extractCellRangeList( aRanges, aContext.getTokens(), false ); + rParser.extractCellRangeList( aRanges, aTokens, false ); aRangeRep = rParser.generateApiRangeListString( aRanges ); } else if( !rDataSeq.maData.empty() ) diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx index aeac1494c338..eb5183a4dd80 100644 --- a/oox/source/xls/excelfilter.cxx +++ b/oox/source/xls/excelfilter.cxx @@ -56,29 +56,29 @@ using ::oox::drawingml::table::TableStyleListPtr; // ============================================================================ ExcelFilterBase::ExcelFilterBase() : - mpData( 0 ) + mpBookGlob( 0 ) { } ExcelFilterBase::~ExcelFilterBase() { - OSL_ENSURE( !mpData, "ExcelFilterBase::~ExcelFilterBase - workbook data not cleared" ); + OSL_ENSURE( !mpBookGlob, "ExcelFilterBase::~ExcelFilterBase - workbook data not cleared" ); } -void ExcelFilterBase::registerWorkbookData( WorkbookData& rData ) +void ExcelFilterBase::registerWorkbookGlobals( WorkbookGlobals& rBookGlob ) { - mpData = &rData; + mpBookGlob = &rBookGlob; } -WorkbookData& ExcelFilterBase::getWorkbookData() const +WorkbookGlobals& ExcelFilterBase::getWorkbookGlobals() const { - OSL_ENSURE( mpData, "ExcelFilterBase::getWorkbookData - missing workbook data" ); - return *mpData; + OSL_ENSURE( mpBookGlob, "ExcelFilterBase::getWorkbookGlobals - missing workbook data" ); + return *mpBookGlob; } -void ExcelFilterBase::unregisterWorkbookData() +void ExcelFilterBase::unregisterWorkbookGlobals() { - mpData = 0; + mpBookGlob = 0; } // ============================================================================ @@ -125,8 +125,11 @@ bool ExcelFilter::importDocument() throw() if( aWorkbookPath.getLength() == 0 ) return false; - WorkbookHelperRoot aHelper( *this ); - return aHelper.isValid() && importFragment( new WorkbookFragment( aHelper, aWorkbookPath ) ); + /* Construct the WorkbookGlobals object referred to by every instance of + the class WorkbookHelper, and execute the import filter by constructing + an instance of WorkbookFragment and loading the file. */ + WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals( *this ); + return xBookGlob.get() && importFragment( new WorkbookFragment( *xBookGlob, aWorkbookPath ) ); } bool ExcelFilter::exportDocument() throw() @@ -136,7 +139,7 @@ bool ExcelFilter::exportDocument() throw() const ::oox::drawingml::Theme* ExcelFilter::getCurrentTheme() const { - return &WorkbookHelper( getWorkbookData() ).getTheme(); + return &WorkbookHelper( getWorkbookGlobals() ).getTheme(); } ::oox::vml::Drawing* ExcelFilter::getVmlDrawing() @@ -151,12 +154,12 @@ const TableStyleListPtr ExcelFilter::getTableStyles() ::oox::drawingml::chart::ChartConverter& ExcelFilter::getChartConverter() { - return WorkbookHelper( getWorkbookData() ).getChartConverter(); + return WorkbookHelper( getWorkbookGlobals() ).getChartConverter(); } GraphicHelper* ExcelFilter::implCreateGraphicHelper() const { - return new ExcelGraphicHelper( getWorkbookData() ); + return new ExcelGraphicHelper( getWorkbookGlobals() ); } ::oox::ole::VbaProject* ExcelFilter::implCreateVbaProject() const @@ -225,8 +228,11 @@ bool ExcelBiffFilter::importDocument() throw() if( eBiff == BIFF_UNKNOWN ) return false; - WorkbookHelperRoot aHelper( *this, eBiff ); - return aHelper.isValid() && BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment(); + /* Construct the WorkbookGlobals object referred to by every instance of + the class WorkbookHelper, and execute the import filter by constructing + an instance of BiffWorkbookFragment and loading the file. */ + WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals( *this, eBiff ); + return xBookGlob.get() && BiffWorkbookFragment( *xBookGlob, aWorkbookName ).importFragment(); } bool ExcelBiffFilter::exportDocument() throw() @@ -236,7 +242,7 @@ bool ExcelBiffFilter::exportDocument() throw() GraphicHelper* ExcelBiffFilter::implCreateGraphicHelper() const { - return new ExcelGraphicHelper( getWorkbookData() ); + return new ExcelGraphicHelper( getWorkbookGlobals() ); } ::oox::ole::VbaProject* ExcelBiffFilter::implCreateVbaProject() const @@ -289,11 +295,16 @@ bool ExcelVbaProjectFilter::importDocument() throw() if( !xVbaPrjStrg || !xVbaPrjStrg->isStorage() ) return false; - WorkbookHelperRoot aHelper( *this, eBiff ); + /* Construct the WorkbookGlobals object referred to by every instance of + the class WorkbookHelper. */ + WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals( *this, eBiff ); + if( !xBookGlob.get() ) + return false; + // set palette colors passed in service constructor Any aPalette = getArgument( CREATE_OUSTRING( "ColorPalette" ) ); - aHelper.getStyles().importPalette( aPalette ); - // import the VBA project + WorkbookHelper( *xBookGlob ).getStyles().importPalette( aPalette ); + // import the VBA project (getVbaProject() implemented in base class) getVbaProject().importVbaProject( *xVbaPrjStrg, getGraphicHelper() ); return true; } diff --git a/oox/source/xls/excelhandlers.cxx b/oox/source/xls/excelhandlers.cxx index ba2fdd3a03d0..15f9d8297032 100644 --- a/oox/source/xls/excelhandlers.cxx +++ b/oox/source/xls/excelhandlers.cxx @@ -51,17 +51,10 @@ WorkbookFragmentBase::WorkbookFragmentBase( // ============================================================================ -WorksheetFragmentBase::WorksheetFragmentBase( const WorkbookHelper& rHelper, - const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ), - WorksheetHelperRoot( rHelper, rxProgressBar, eSheetType, nSheet ) -{ -} - WorksheetFragmentBase::WorksheetFragmentBase( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ), - WorksheetHelperRoot( rHelper ) + WorksheetHelper( rHelper ) { } @@ -81,14 +74,8 @@ BiffWorkbookContextBase::BiffWorkbookContextBase( const WorkbookHelper& rHelper // ---------------------------------------------------------------------------- -BiffWorksheetContextBase::BiffWorksheetContextBase( const WorkbookHelper& rHelper, - const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - WorksheetHelperRoot( rHelper, rxProgressBar, eSheetType, nSheet ) -{ -} - BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) : - WorksheetHelperRoot( rHelper ) + WorksheetHelper( rHelper ) { } @@ -202,18 +189,16 @@ BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelpe // ---------------------------------------------------------------------------- -BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : +BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorksheetHelper& rHelper, const BiffWorkbookFragmentBase& rParent ) : BiffFragmentHandler( rParent ), - WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet ) + WorksheetHelper( rHelper ) { } // ---------------------------------------------------------------------------- -BiffSkipWorksheetFragment::BiffSkipWorksheetFragment( const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) : - BiffWorksheetFragmentBase( rParent, rxProgressBar, SHEETTYPE_EMPTYSHEET, nSheet ) +BiffSkipWorksheetFragment::BiffSkipWorksheetFragment( const WorksheetHelper& rHelper, const BiffWorkbookFragmentBase& rParent ) : + BiffWorksheetFragmentBase( rHelper, rParent ) { } diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index 683ac3582071..fe527f35f634 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -242,9 +242,9 @@ void ExternalName::importExternalName( BiffInputStream& rStrm ) // cell references to other internal sheets are stored in hidden external names if( bHiddenRef && (getBiff() == BIFF4) && isWorkbookFile() ) { - TokensFormulaContext aContext( true, true ); - importBiffFormula( aContext, mrParentLink.getCalcSheetIndex(), rStrm ); - extractReference( aContext.getTokens() ); + CellAddress aBaseAddr( mrParentLink.getCalcSheetIndex(), 0, 0 ); + ApiTokenSequence aTokens = importBiffFormula( aBaseAddr, rStrm ); + extractReference( aTokens ); } break; @@ -252,9 +252,8 @@ void ExternalName::importExternalName( BiffInputStream& rStrm ) // cell references to other documents are stored in hidden external names if( bHiddenRef ) { - TokensFormulaContext aContext( true, true ); - importBiffFormula( aContext, 0, rStrm ); - extractExternalReference( aContext.getTokens() ); + ApiTokenSequence aTokens = importBiffFormula( CellAddress(), rStrm ); + extractExternalReference( aTokens ); } break; diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index 58049f4851d7..25398f9aa133 100755 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include "oox/core/filterbase.hxx" @@ -1366,51 +1365,6 @@ ApiTokenSequence ApiParserWrapper::parseFormula( const OUString& rFormula, const return aTokenSeq; } -// formula contexts =========================================================== - -FormulaContext::FormulaContext( bool bRelativeAsOffset, bool b2dRefsAs3dRefs, bool bAllowNulChars ) : - maBaseAddress( 0, 0, 0 ), - mbRelativeAsOffset( bRelativeAsOffset ), - mb2dRefsAs3dRefs( b2dRefsAs3dRefs ), - mbAllowNulChars( bAllowNulChars ) -{ -} - -FormulaContext::~FormulaContext() -{ -} - -void FormulaContext::setSharedFormula( const CellAddress& ) -{ -} - -// ---------------------------------------------------------------------------- - -TokensFormulaContext::TokensFormulaContext( bool bRelativeAsOffset, bool b2dRefsAs3dRefs, bool bAllowNulChars ) : - FormulaContext( bRelativeAsOffset, b2dRefsAs3dRefs, bAllowNulChars ) -{ -} - -void TokensFormulaContext::setTokens( const ApiTokenSequence& rTokens ) -{ - maTokens = rTokens; -} - -// ---------------------------------------------------------------------------- - -SimpleFormulaContext::SimpleFormulaContext( const Reference< XFormulaTokens >& rxTokens, - bool bRelativeAsOffset, bool b2dRefsAs3dRefs, bool bAllowNulChars ) : - FormulaContext( bRelativeAsOffset, b2dRefsAs3dRefs, bAllowNulChars ), - mxTokens( rxTokens ) -{ - OSL_ENSURE( mxTokens.is(), "SimpleFormulaContext::SimpleFormulaContext - missing XFormulaTokens interface" ); -} - -void SimpleFormulaContext::setTokens( const ApiTokenSequence& rTokens ) -{ - mxTokens->setTokens( rTokens ); -} - // formula parser/printer base class for filters ============================== namespace { @@ -1708,6 +1662,12 @@ bool FormulaProcessorBase::extractString( OUString& orString, const ApiTokenSequ return aTokenIt.is() && (aTokenIt->OpCode == OPCODE_PUSH) && (aTokenIt->Data >>= orString) && !(++aTokenIt).is(); } +bool FormulaProcessorBase::extractSpecialTokenInfo( ApiSpecialTokenInfo& orTokenInfo, const ApiTokenSequence& rTokens ) const +{ + ApiTokenIterator aTokenIt( rTokens, OPCODE_SPACES, true ); + return aTokenIt.is() && (aTokenIt->OpCode == OPCODE_BAD) && (aTokenIt->Data >>= orTokenInfo); +} + void FormulaProcessorBase::convertStringToStringList( ApiTokenSequence& orTokens, sal_Unicode cStringSep, bool bTrimLeadingSpaces ) const { diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index d7eb91a9c05c..674f9a8e6320 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -440,27 +440,23 @@ class FormulaParserImpl : public FormulaFinalizer, public WorkbookHelper public: explicit FormulaParserImpl( const FormulaParser& rParent ); - /** Converts an XML formula string. */ - virtual void importOoxFormula( - FormulaContext& rContext, + /** Converts an OOXML formula string. */ + virtual ApiTokenSequence importOoxFormula( + const CellAddress& rBaseAddress, const OUString& rFormulaString ); /** Imports and converts a BIFF12 token array from the passed stream. */ - virtual void importBiff12Formula( - FormulaContext& rContext, + virtual ApiTokenSequence importBiff12Formula( + const CellAddress& rBaseAddress, + FormulaType eType, SequenceInputStream& rStrm ); /** Imports and converts a BIFF2-BIFF8 token array from the passed stream. */ - virtual void importBiffFormula( - FormulaContext& rContext, + virtual ApiTokenSequence importBiffFormula( + const CellAddress& rBaseAddress, + FormulaType eType, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ); - /** Finalizes the passed token array after import (e.g. adjusts function - parameters) and sets the formula using the passed context. */ - void setFormula( - FormulaContext& rContext, - const ApiTokenSequence& rTokens ); - /** Tries to resolve the passed ref-id to an OLE target URL. */ OUString resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const; @@ -468,18 +464,10 @@ protected: typedef ::std::pair< sal_Int32, bool > WhiteSpace; typedef ::std::vector< WhiteSpace > WhiteSpaceVec; - /** Sets the current formula context used for import. */ - inline FormulaContext& getFormulaContext() const { return *mpContext; } - - /** Sets the current formula context used for import. */ - void initializeImport( FormulaContext& rContext ); - /** Finalizes the passed token array after import. */ - void finalizeImport( const ApiTokenSequence& rTokens ); + /** Initializes the formula parser before importing a formula. */ + void initializeImport( const CellAddress& rBaseAddress, FormulaType eType ); /** Finalizes the internal token storage after import. */ - void finalizeImport(); - - /** Inserts a shared formula using the current formula context and passed base address. */ - void setSharedFormula( const BinAddress& rBaseAddr ); + ApiTokenSequence finalizeImport(); // token array ------------------------------------------------------------ @@ -542,6 +530,7 @@ protected: bool pushExternalFuncOperand( const FunctionInfo& rFuncInfo ); bool pushDdeLinkOperand( const OUString& rDdeServer, const OUString& rDdeTopic, const OUString& rDdeItem ); bool pushExternalNameOperand( const ExternalNameRef& rxExtName, const ExternalLink& rExtLink ); + bool pushSpecialTokenOperand( const BinAddress& rBaseAddr, bool bTable ); bool pushUnaryPreOperator( sal_Int32 nOpCode ); bool pushUnaryPostOperator( sal_Int32 nOpCode ); @@ -575,6 +564,12 @@ protected: const sal_Int32 mnMaxXlsCol; /// Maximum column index in imported document. const sal_Int32 mnMaxXlsRow; /// Maximum row index in imported document. + CellAddress maBaseAddr; /// Base address for relative references. + bool mbRelativeAsOffset; /// True = relative row/column index is (signed) offset, false = explicit index. + bool mb2dRefsAs3dRefs; /// True = convert all 2D references to 3D references in sheet specified by base address. + bool mbSpecialTokens; /// True = special handling for tExp and tTbl tokens, false = exit with error. + bool mbAllowNulChars; /// True = keep NUL characters in string tokens. + private: typedef ::std::vector< size_t > SizeTypeVector; @@ -584,7 +579,6 @@ private: WhiteSpaceVec maLeadingSpaces; /// List of whitespaces before next token. WhiteSpaceVec maOpeningSpaces; /// List of whitespaces before opening parenthesis. WhiteSpaceVec maClosingSpaces; /// List of whitespaces before closing parenthesis. - FormulaContext* mpContext; /// Current formula context. }; // ---------------------------------------------------------------------------- @@ -596,7 +590,9 @@ FormulaParserImpl::FormulaParserImpl( const FormulaParser& rParent ) : mnMaxApiRow( rParent.getAddressConverter().getMaxApiAddress().Row ), mnMaxXlsCol( rParent.getAddressConverter().getMaxXlsAddress().Column ), mnMaxXlsRow( rParent.getAddressConverter().getMaxXlsAddress().Row ), - mpContext( 0 ) + mbRelativeAsOffset( false ), + mb2dRefsAs3dRefs( false ), + mbAllowNulChars( false ) { // reserve enough space to make resize(), push_back() etc. cheap maTokenStorage.reserve( 0x2000 ); @@ -607,25 +603,22 @@ FormulaParserImpl::FormulaParserImpl( const FormulaParser& rParent ) : maClosingSpaces.reserve( 256 ); } -void FormulaParserImpl::importOoxFormula( FormulaContext&, const OUString& ) +ApiTokenSequence FormulaParserImpl::importOoxFormula( const CellAddress&, const OUString& ) { OSL_ENSURE( false, "FormulaParserImpl::importOoxFormula - not implemented" ); + return ApiTokenSequence(); } -void FormulaParserImpl::importBiff12Formula( FormulaContext&, SequenceInputStream& ) +ApiTokenSequence FormulaParserImpl::importBiff12Formula( const CellAddress&, FormulaType, SequenceInputStream& ) { OSL_ENSURE( false, "FormulaParserImpl::importBiff12Formula - not implemented" ); + return ApiTokenSequence(); } -void FormulaParserImpl::importBiffFormula( FormulaContext&, BiffInputStream&, const sal_uInt16* ) +ApiTokenSequence FormulaParserImpl::importBiffFormula( const CellAddress&, FormulaType, BiffInputStream&, const sal_uInt16* ) { OSL_ENSURE( false, "FormulaParserImpl::importBiffFormula - not implemented" ); -} - -void FormulaParserImpl::setFormula( FormulaContext& rContext, const ApiTokenSequence& rTokens ) -{ - initializeImport( rContext ); - finalizeImport( rTokens ); + return ApiTokenSequence(); } OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const @@ -637,22 +630,41 @@ OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId, bool bUseRefShee return OUString(); } -void FormulaParserImpl::initializeImport( FormulaContext& rContext ) +void FormulaParserImpl::initializeImport( const CellAddress& rBaseAddr, FormulaType eType ) { + maBaseAddr = rBaseAddr; + mbRelativeAsOffset = mb2dRefsAs3dRefs = mbSpecialTokens = mbAllowNulChars = false; + switch( eType ) + { + case FORMULATYPE_CELL: + mbSpecialTokens = true; + break; + case FORMULATYPE_ARRAY: + break; + case FORMULATYPE_SHAREDFORMULA: + mbRelativeAsOffset = true; + break; + case FORMULATYPE_CONDFORMAT: + mbRelativeAsOffset = true; + break; + case FORMULATYPE_VALIDATION: + mbRelativeAsOffset = true; + // enable NUL characters in BIFF import, string list is single tStr token with NUL separators + mbAllowNulChars = getFilterType() == FILTER_BIFF; + break; + case FORMULATYPE_DEFINEDNAME: + mbRelativeAsOffset = true; + // BIFF2-BIFF4: convert 2D referebces to absolute 3D references + mb2dRefsAs3dRefs = (getFilterType() == FILTER_BIFF) && (getBiff() <= BIFF4); + break; + } + maTokenStorage.clear(); maTokenIndexes.clear(); maOperandSizeStack.clear(); - mpContext = &rContext; } -void FormulaParserImpl::finalizeImport( const ApiTokenSequence& rTokens ) -{ - ApiTokenSequence aFinalTokens = finalizeTokenArray( rTokens ); - if( aFinalTokens.hasElements() ) - mpContext->setTokens( aFinalTokens ); -} - -void FormulaParserImpl::finalizeImport() +ApiTokenSequence FormulaParserImpl::finalizeImport() { ApiTokenSequence aTokens( static_cast< sal_Int32 >( maTokenIndexes.size() ) ); if( aTokens.hasElements() ) @@ -661,14 +673,7 @@ void FormulaParserImpl::finalizeImport() for( SizeTypeVector::const_iterator aIt = maTokenIndexes.begin(), aEnd = maTokenIndexes.end(); aIt != aEnd; ++aIt, ++pToken ) *pToken = maTokenStorage[ *aIt ]; } - finalizeImport( aTokens ); -} - -void FormulaParserImpl::setSharedFormula( const BinAddress& rBaseAddr ) -{ - CellAddress aApiBaseAddr; - if( getAddressConverter().convertToCellAddress( aApiBaseAddr, rBaseAddr, mpContext->getBaseAddress().Sheet, false ) ) - mpContext->setSharedFormula( aApiBaseAddr ); + return finalizeTokenArray( aTokens ); } // token array ---------------------------------------------------------------- @@ -1018,7 +1023,7 @@ bool FormulaParserImpl::pushNlrOperand( const BinSingleRef2d& rRef ) bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName, bool bPushBadToken ) { - Any aRefAny = rName.getReference( mpContext->getBaseAddress() ); + Any aRefAny = rName.getReference( maBaseAddr ); if( aRefAny.hasValue() ) return pushAnyOperand( aRefAny, OPCODE_PUSH ); if( bPushBadToken && (rName.getModelName().getLength() > 0) && (rName.getModelName()[ 0 ] >= ' ') ) @@ -1088,6 +1093,13 @@ bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtNam return pushBiffErrorOperand( BIFF_ERR_NAME ); } +bool FormulaParserImpl::pushSpecialTokenOperand( const BinAddress& rBaseAddr, bool bTable ) +{ + CellAddress aBaseAddr( maBaseAddr.Sheet, rBaseAddr.mnCol, rBaseAddr.mnRow ); + ApiSpecialTokenInfo aTokenInfo( aBaseAddr, bTable ); + return mbSpecialTokens && (getFormulaSize() == 0) && pushValueOperand( aTokenInfo, OPCODE_BAD ); +} + bool FormulaParserImpl::pushUnaryPreOperator( sal_Int32 nOpCode ) { return pushUnaryPreOperatorToken( nOpCode, &maLeadingSpaces ) && resetSpaces(); @@ -1122,15 +1134,15 @@ bool FormulaParserImpl::pushFunctionOperator( const FunctionInfo& rFuncInfo, siz void FormulaParserImpl::initReference2d( SingleReference& orApiRef ) const { - if( mpContext->is2dRefsAs3dRefs() ) + if( mb2dRefsAs3dRefs ) { - initReference3d( orApiRef, mpContext->getBaseAddress().Sheet, false ); + initReference3d( orApiRef, maBaseAddr.Sheet, false ); } else { orApiRef.Flags = SHEET_RELATIVE; // #i10184# absolute sheet index needed for relative references in shared formulas - orApiRef.Sheet = mpContext->getBaseAddress().Sheet; + orApiRef.Sheet = maBaseAddr.Sheet; orApiRef.RelativeSheet = 0; } } @@ -1175,9 +1187,9 @@ void FormulaParserImpl::convertReference( SingleReference& orApiRef, const BinSi if( !bRelativeAsOffset ) { if( rRef.mbColRel ) - orApiRef.RelativeColumn -= mpContext->getBaseAddress().Column; + orApiRef.RelativeColumn -= maBaseAddr.Column; if( rRef.mbRowRel ) - orApiRef.RelativeRow -= mpContext->getBaseAddress().Row; + orApiRef.RelativeRow -= maBaseAddr.Row; } } } @@ -1264,12 +1276,13 @@ class OoxFormulaParserImpl : public FormulaParserImpl public: explicit OoxFormulaParserImpl( const FormulaParser& rParent ); - virtual void importOoxFormula( - FormulaContext& rContext, + virtual ApiTokenSequence importOoxFormula( + const CellAddress& rBaseAddr, const OUString& rFormulaString ); - virtual void importBiff12Formula( - FormulaContext& rContext, + virtual ApiTokenSequence importBiff12Formula( + const CellAddress& rBaseAddr, + FormulaType eType, SequenceInputStream& rStrm ); private: @@ -1319,20 +1332,19 @@ OoxFormulaParserImpl::OoxFormulaParserImpl( const FormulaParser& rParent ) : { } -void OoxFormulaParserImpl::importOoxFormula( FormulaContext& rContext, const OUString& rFormulaString ) +ApiTokenSequence OoxFormulaParserImpl::importOoxFormula( const CellAddress& rBaseAddr, const OUString& rFormulaString ) { if( mbNeedExtRefs ) { maApiParser.getParserProperties().setProperty( PROP_ExternalLinks, getExternalLinks().getLinkInfos() ); mbNeedExtRefs = false; } - initializeImport( rContext ); - finalizeImport( maApiParser.parseFormula( rFormulaString, rContext.getBaseAddress() ) ); + return finalizeTokenArray( maApiParser.parseFormula( rFormulaString, rBaseAddr ) ); } -void OoxFormulaParserImpl::importBiff12Formula( FormulaContext& rContext, SequenceInputStream& rStrm ) +ApiTokenSequence OoxFormulaParserImpl::importBiff12Formula( const CellAddress& rBaseAddr, FormulaType eType, SequenceInputStream& rStrm ) { - initializeImport( rContext ); + initializeImport( rBaseAddr, eType ); sal_Int32 nFmlaSize = rStrm.readInt32(); sal_Int64 nFmlaPos = rStrm.tell(); @@ -1345,7 +1357,7 @@ void OoxFormulaParserImpl::importBiff12Formula( FormulaContext& rContext, Sequen rStrm.seek( nFmlaPos ); bool bOk = (nFmlaSize >= 0) && (nAddDataSize >= 0); - bool bRelativeAsOffset = getFormulaContext().isRelativeAsOffset(); + bool bRelativeAsOffset = mbRelativeAsOffset; while( bOk && !rStrm.isEof() && (rStrm.tell() < nFmlaEndPos) ) { @@ -1422,12 +1434,16 @@ void OoxFormulaParserImpl::importBiff12Formula( FormulaContext& rContext, Sequen } // build and finalize the token sequence + ApiTokenSequence aFinalTokens; if( bOk && (rStrm.tell() == nFmlaEndPos) && (mnAddDataPos == nAddDataEndPos) ) - finalizeImport(); + aFinalTokens = finalizeImport(); // seek behind token array if( (nFmlaSize >= 0) && (nAddDataSize >= 0) ) rStrm.seek( nAddDataEndPos ); + + // return the final token sequence + return aFinalTokens; } // import token contents and create API formula token ------------------------- @@ -1571,7 +1587,7 @@ bool OoxFormulaParserImpl::importTableToken( SequenceInputStream& rStrm ) } else if( bThisRow ) { - nStartRow = nEndRow = getFormulaContext().getBaseAddress().Row - xTable->getRange().StartRow; + nStartRow = nEndRow = maBaseAddr.Row - xTable->getRange().StartRow; bFixedHeight = true; } else @@ -1750,9 +1766,7 @@ bool OoxFormulaParserImpl::importExpToken( SequenceInputStream& rStrm ) swapStreamPosition( rStrm ); rStrm >> aBaseAddr.mnCol; swapStreamPosition( rStrm ); - setSharedFormula( aBaseAddr ); - // formula has been set, exit parser by returning false - return false; + return pushSpecialTokenOperand( aBaseAddr, false ); } LinkSheetRange OoxFormulaParserImpl::readSheetRange( SequenceInputStream& rStrm ) @@ -1867,8 +1881,9 @@ class BiffFormulaParserImpl : public FormulaParserImpl public: explicit BiffFormulaParserImpl( const FormulaParser& rParent ); - virtual void importBiffFormula( - FormulaContext& rContext, + virtual ApiTokenSequence importBiffFormula( + const CellAddress& rBaseAddr, + FormulaType eType, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ); private: @@ -1904,7 +1919,8 @@ private: bool importFuncVarToken2( BiffInputStream& rStrm ); bool importFuncVarToken4( BiffInputStream& rStrm ); bool importFuncCEToken( BiffInputStream& rStrm ); - bool importExpToken5( BiffInputStream& rStrm ); + bool importExpToken( BiffInputStream& rStrm ); + bool importTblToken( BiffInputStream& rStrm ); bool importNlrAddrToken( BiffInputStream& rStrm, bool bRow ); bool importNlrRangeToken( BiffInputStream& rStrm ); @@ -1953,7 +1969,6 @@ private: ImportTokenFunc mpImportFuncToken; /// Pointer to tFunc import function (function with fixed parameter count). ImportTokenFunc mpImportFuncVarToken; /// Pointer to tFuncVar import function (function with variable parameter count). ImportTokenFunc mpImportFuncCEToken; /// Pointer to tFuncCE import function (command macro call). - ImportTokenFunc mpImportExpToken; /// Pointer to tExp import function (array/shared formula). sal_Int64 mnAddDataPos; /// Current stream position for additional data (tArray, tMemArea, tNlr). sal_Int32 mnCurrRefId; /// Current ref-id from tSheet token (BIFF2-BIFF4 only). sal_uInt16 mnAttrDataSize; /// Size of one tAttr data element. @@ -1987,7 +2002,6 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken2; mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken2; mpImportFuncCEToken = &BiffFormulaParserImpl::importFuncCEToken; - mpImportExpToken = &BiffFormulaParserImpl::importTokenNotAvailable; mnAttrDataSize = 1; mnArraySize = 6; mnNameSize = 5; @@ -2009,7 +2023,6 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken2; mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken2; mpImportFuncCEToken = &BiffFormulaParserImpl::importFuncCEToken; - mpImportExpToken = &BiffFormulaParserImpl::importTokenNotAvailable; mnAttrDataSize = 2; mnArraySize = 7; mnNameSize = 8; @@ -2031,7 +2044,6 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4; mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4; mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable; - mpImportExpToken = &BiffFormulaParserImpl::importTokenNotAvailable; mnAttrDataSize = 2; mnArraySize = 7; mnNameSize = 8; @@ -2053,7 +2065,6 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4; mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4; mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable; - mpImportExpToken = &BiffFormulaParserImpl::importExpToken5; mnAttrDataSize = 2; mnArraySize = 7; mnNameSize = 12; @@ -2075,7 +2086,6 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4; mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4; mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable; - mpImportExpToken = &BiffFormulaParserImpl::importExpToken5; mnAttrDataSize = 2; mnArraySize = 7; mnNameSize = 2; @@ -2087,15 +2097,14 @@ BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) : } } -void BiffFormulaParserImpl::importBiffFormula( FormulaContext& rContext, - BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) +ApiTokenSequence BiffFormulaParserImpl::importBiffFormula( const CellAddress& rBaseAddr, + FormulaType eType, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) { - initializeImport( rContext ); + initializeImport( rBaseAddr, eType ); mnCurrRefId = 0; sal_uInt16 nFmlaSize = lclReadFmlaSize( rStrm, getBiff(), pnFmlaSize ); sal_Int64 nEndPos = mnAddDataPos = rStrm.tell() + nFmlaSize; - bool bRelativeAsOffset = getFormulaContext().isRelativeAsOffset(); bool bOk = true; while( bOk && !rStrm.isEof() && (rStrm.tell() < nEndPos) ) @@ -2113,8 +2122,8 @@ void BiffFormulaParserImpl::importBiffFormula( FormulaContext& rContext, // base tokens switch( nBaseId ) { - case BIFF_TOKID_EXP: bOk = (this->*mpImportExpToken)( rStrm ); break; - case BIFF_TOKID_TBL: bOk = false; /* multiple op. will be set externally */ break; + case BIFF_TOKID_EXP: bOk = importExpToken( rStrm ); break; + case BIFF_TOKID_TBL: bOk = importTblToken( rStrm ); break; case BIFF_TOKID_ADD: bOk = pushBinaryOperator( OPCODE_ADD ); break; case BIFF_TOKID_SUB: bOk = pushBinaryOperator( OPCODE_SUB ); break; case BIFF_TOKID_MUL: bOk = pushBinaryOperator( OPCODE_MULT ); break; @@ -2170,10 +2179,10 @@ void BiffFormulaParserImpl::importBiffFormula( FormulaContext& rContext, case BIFF_TOKID_MEMNOMEMN: bOk = importMemFuncToken( rStrm ); break; case BIFF_TOKID_FUNCCE: bOk = (this->*mpImportFuncCEToken)( rStrm ); break; case BIFF_TOKID_NAMEX: bOk = (this->*mpImportNameXToken)( rStrm ); break; - case BIFF_TOKID_REF3D: bOk = (this->*mpImportRef3dToken)( rStrm, false, bRelativeAsOffset ); break; - case BIFF_TOKID_AREA3D: bOk = (this->*mpImportArea3dToken)( rStrm, false, bRelativeAsOffset ); break; - case BIFF_TOKID_REFERR3D: bOk = (this->*mpImportRef3dToken)( rStrm, true, bRelativeAsOffset ); break; - case BIFF_TOKID_AREAERR3D: bOk = (this->*mpImportArea3dToken)( rStrm, true, bRelativeAsOffset ); break; + case BIFF_TOKID_REF3D: bOk = (this->*mpImportRef3dToken)( rStrm, false, mbRelativeAsOffset ); break; + case BIFF_TOKID_AREA3D: bOk = (this->*mpImportArea3dToken)( rStrm, false, mbRelativeAsOffset ); break; + case BIFF_TOKID_REFERR3D: bOk = (this->*mpImportRef3dToken)( rStrm, true, mbRelativeAsOffset ); break; + case BIFF_TOKID_AREAERR3D: bOk = (this->*mpImportArea3dToken)( rStrm, true, mbRelativeAsOffset ); break; default: bOk = false; } } @@ -2181,11 +2190,15 @@ void BiffFormulaParserImpl::importBiffFormula( FormulaContext& rContext, } // build and finalize the token sequence + ApiTokenSequence aFinalTokens; if( bOk && (rStrm.tell() == nEndPos) ) - finalizeImport(); + aFinalTokens = finalizeImport(); // seek behind additional token data of tArray, tMemArea, tNlr tokens rStrm.seek( mnAddDataPos ); + + // return the final token sequence + return aFinalTokens; } // import token contents and create API formula token ------------------------- @@ -2204,13 +2217,13 @@ bool BiffFormulaParserImpl::importRefTokenNotAvailable( BiffInputStream&, bool, bool BiffFormulaParserImpl::importStrToken2( BiffInputStream& rStrm ) { - return pushValueOperand( rStrm.readByteStringUC( false, getTextEncoding(), getFormulaContext().isNulCharsAllowed() ) ); + return pushValueOperand( rStrm.readByteStringUC( false, getTextEncoding(), mbAllowNulChars ) ); } bool BiffFormulaParserImpl::importStrToken8( BiffInputStream& rStrm ) { // read flags field for empty strings also - return pushValueOperand( rStrm.readUniStringBody( rStrm.readuInt8(), getFormulaContext().isNulCharsAllowed() ) ); + return pushValueOperand( rStrm.readUniStringBody( rStrm.readuInt8(), mbAllowNulChars ) ); } bool BiffFormulaParserImpl::importAttrToken( BiffInputStream& rStrm ) @@ -2340,7 +2353,6 @@ bool BiffFormulaParserImpl::importArrayToken( BiffInputStream& rStrm ) size_t nOpSize = popOperandSize(); size_t nOldArraySize = getFormulaSize(); bool bBiff8 = getBiff() == BIFF8; - bool bNulChars = getFormulaContext().isNulCharsAllowed(); // read array size swapStreamPosition( rStrm ); @@ -2369,8 +2381,8 @@ bool BiffFormulaParserImpl::importArrayToken( BiffInputStream& rStrm ) break; case BIFF_DATATYPE_STRING: appendRawToken( OPCODE_PUSH ) <<= bBiff8 ? - rStrm.readUniString( bNulChars ) : - rStrm.readByteStringUC( false, getTextEncoding(), bNulChars ); + rStrm.readUniString( mbAllowNulChars ) : + rStrm.readByteStringUC( false, getTextEncoding(), mbAllowNulChars ); break; case BIFF_DATATYPE_BOOL: appendRawToken( OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == BIFF_TOK_BOOL_FALSE) ? 0.0 : 1.0 ); @@ -2519,13 +2531,18 @@ bool BiffFormulaParserImpl::importFuncCEToken( BiffInputStream& rStrm ) return pushBiffFunction( nCmdId, nParamCount ); } -bool BiffFormulaParserImpl::importExpToken5( BiffInputStream& rStrm ) +bool BiffFormulaParserImpl::importExpToken( BiffInputStream& rStrm ) { BinAddress aBaseAddr; aBaseAddr.read( rStrm ); - setSharedFormula( aBaseAddr ); - // formula has been set, exit parser by returning false - return false; + return pushSpecialTokenOperand( aBaseAddr, false ); +} + +bool BiffFormulaParserImpl::importTblToken( BiffInputStream& rStrm ) +{ + BinAddress aBaseAddr; + aBaseAddr.read( rStrm ); + return pushSpecialTokenOperand( aBaseAddr, true ); } bool BiffFormulaParserImpl::importNlrAddrToken( BiffInputStream& rStrm, bool bRow ) @@ -2795,22 +2812,35 @@ FormulaParser::~FormulaParser() { } -void FormulaParser::importFormula( FormulaContext& rContext, const OUString& rFormulaString ) const +ApiTokenSequence FormulaParser::importFormula( const CellAddress& rBaseAddress, const OUString& rFormulaString ) const { - mxImpl->importOoxFormula( rContext, rFormulaString ); + return mxImpl->importOoxFormula( rBaseAddress, rFormulaString ); } -void FormulaParser::importFormula( FormulaContext& rContext, SequenceInputStream& rStrm ) const +ApiTokenSequence FormulaParser::importFormula( const CellAddress& rBaseAddress, FormulaType eType, SequenceInputStream& rStrm ) const { - mxImpl->importBiff12Formula( rContext, rStrm ); + return mxImpl->importBiff12Formula( rBaseAddress, eType, rStrm ); } -void FormulaParser::importFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) const +ApiTokenSequence FormulaParser::importFormula( const CellAddress& rBaseAddress, FormulaType eType, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) const { - mxImpl->importBiffFormula( rContext, rStrm, pnFmlaSize ); + return mxImpl->importBiffFormula( rBaseAddress, eType, rStrm, pnFmlaSize ); } -void FormulaParser::convertErrorToFormula( FormulaContext& rContext, sal_uInt8 nErrorCode ) const +ApiTokenSequence FormulaParser::convertBoolToFormula( bool bValue ) const +{ + if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( bValue ? BIFF_FUNC_TRUE : BIFF_FUNC_FALSE ) ) + { + ApiTokenSequence aTokens( 3 ); + aTokens[ 0 ].OpCode = pFuncInfo->mnApiOpCode; + aTokens[ 1 ].OpCode = OPCODE_OPEN; + aTokens[ 2 ].OpCode = OPCODE_CLOSE; + return aTokens; + } + return ApiTokenSequence(); +} + +ApiTokenSequence FormulaParser::convertErrorToFormula( sal_uInt8 nErrorCode ) const { ApiTokenSequence aTokens( 3 ); // HACK: enclose all error codes into an 1x1 matrix @@ -2818,26 +2848,24 @@ void FormulaParser::convertErrorToFormula( FormulaContext& rContext, sal_uInt8 n aTokens[ 1 ].OpCode = OPCODE_PUSH; aTokens[ 1 ].Data <<= BiffHelper::calcDoubleFromError( nErrorCode ); aTokens[ 2 ].OpCode = OPCODE_ARRAY_CLOSE; - mxImpl->setFormula( rContext, aTokens ); + return aTokens; } -void FormulaParser::convertNameToFormula( FormulaContext& rContext, sal_Int32 nTokenIndex ) const +ApiTokenSequence FormulaParser::convertNameToFormula( sal_Int32 nTokenIndex ) const { - if( nTokenIndex >= 0 ) - { - ApiTokenSequence aTokens( 1 ); - aTokens[ 0 ].OpCode = OPCODE_NAME; - aTokens[ 0 ].Data <<= nTokenIndex; - mxImpl->setFormula( rContext, aTokens ); - } - else - convertErrorToFormula( rContext, BIFF_ERR_REF ); + if( nTokenIndex < 0 ) + return convertErrorToFormula( BIFF_ERR_REF ); + + ApiTokenSequence aTokens( 1 ); + aTokens[ 0 ].OpCode = OPCODE_NAME; + aTokens[ 0 ].Data <<= nTokenIndex; + return aTokens; } -void FormulaParser::convertNumberToHyperlink( FormulaContext& rContext, const OUString& rUrl, double fValue ) const +ApiTokenSequence FormulaParser::convertNumberToHyperlink( const OUString& rUrl, double fValue ) const { OSL_ENSURE( rUrl.getLength() > 0, "FormulaParser::convertNumberToHyperlink - missing URL" ); - if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_HYPERLINK ) ) + if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( BIFF_FUNC_HYPERLINK ) ) { ApiTokenSequence aTokens( 6 ); aTokens[ 0 ].OpCode = pFuncInfo->mnApiOpCode; @@ -2848,8 +2876,9 @@ void FormulaParser::convertNumberToHyperlink( FormulaContext& rContext, const OU aTokens[ 4 ].OpCode = OPCODE_PUSH; aTokens[ 4 ].Data <<= fValue; aTokens[ 5 ].OpCode = OPCODE_CLOSE; - mxImpl->setFormula( rContext, aTokens ); + return aTokens; } + return ApiTokenSequence(); } OUString FormulaParser::importOleTargetLink( const OUString& rFormulaString ) diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk index e337afe786a8..bcd539a70705 100755 --- a/oox/source/xls/makefile.mk +++ b/oox/source/xls/makefile.mk @@ -81,9 +81,9 @@ SLOFILES = \ $(SLO)$/richstringcontext.obj \ $(SLO)$/scenariobuffer.obj \ $(SLO)$/scenariocontext.obj \ - $(SLO)$/sharedformulabuffer.obj \ $(SLO)$/sharedstringsbuffer.obj \ $(SLO)$/sharedstringsfragment.obj \ + $(SLO)$/sheetdatabuffer.obj \ $(SLO)$/sheetdatacontext.obj \ $(SLO)$/stylesbuffer.obj \ $(SLO)$/stylesfragment.obj \ diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx index 5e5e5efef546..88935a679c83 100644 --- a/oox/source/xls/pivotcachebuffer.cxx +++ b/oox/source/xls/pivotcachebuffer.cxx @@ -44,6 +44,7 @@ #include "oox/xls/defnamesbuffer.hxx" #include "oox/xls/excelhandlers.hxx" #include "oox/xls/pivotcachefragment.hxx" +#include "oox/xls/sheetdatabuffer.hxx" #include "oox/xls/tablebuffer.hxx" #include "oox/xls/unitconverter.hxx" #include "oox/xls/worksheetbuffer.hxx" @@ -936,7 +937,8 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie void PivotCacheField::writeSourceHeaderCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const { - rSheetHelper.setStringCell( rSheetHelper.getCell( CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ) ), maFieldModel.maName ); + CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); + rSheetHelper.getSheetData().setStringCell( rSheetHelper.getCell( aCellAddr ), aCellAddr, maFieldModel.maName ); } void PivotCacheField::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const @@ -982,15 +984,17 @@ void PivotCacheField::writeItemToSourceDataCell( WorksheetHelper& rSheetHelper, { if( rItem.getType() != XML_m ) { - Reference< XCell > xCell = rSheetHelper.getCell( CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ) ); + CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); + SheetDataBuffer& rSheetData = rSheetHelper.getSheetData(); + Reference< XCell > xCell = rSheetHelper.getCell( aCellAddr ); if( xCell.is() ) switch( rItem.getType() ) { - case XML_s: rSheetHelper.setStringCell( xCell, rItem.getValue().get< OUString >() ); break; - case XML_n: xCell->setValue( rItem.getValue().get< double >() ); break; - case XML_i: xCell->setValue( rItem.getValue().get< sal_Int16 >() ); break; - case XML_d: rSheetHelper.setDateTimeCell( xCell, rItem.getValue().get< DateTime >() ); break; - case XML_b: rSheetHelper.setBooleanCell( xCell, rItem.getValue().get< bool >() ); break; - case XML_e: rSheetHelper.setErrorCell( xCell, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; + case XML_s: rSheetData.setStringCell( xCell, aCellAddr, rItem.getValue().get< OUString >() ); break; + case XML_n: rSheetData.setValueCell( xCell, aCellAddr, rItem.getValue().get< double >() ); break; + case XML_i: rSheetData.setValueCell( xCell, aCellAddr, rItem.getValue().get< sal_Int16 >() ); break; + case XML_d: rSheetData.setDateTimeCell( xCell, aCellAddr, rItem.getValue().get< DateTime >() ); break; + case XML_b: rSheetData.setBooleanCell( xCell, aCellAddr, rItem.getValue().get< bool >() ); break; + case XML_e: rSheetData.setErrorCell( xCell, aCellAddr, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; default: OSL_ENSURE( false, "PivotCacheField::writeItemToSourceDataCell - unexpected item data type" ); } } diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx index d49077af4f91..b28d3b64e8e3 100644 --- a/oox/source/xls/pivotcachefragment.cxx +++ b/oox/source/xls/pivotcachefragment.cxx @@ -208,15 +208,20 @@ void PivotCacheDefinitionFragment::finalizeImport() { OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() ); if( aRecFragmentPath.getLength() > 0 ) - importOoxFragment( new PivotCacheRecordsFragment( *this, aRecFragmentPath, mrPivotCache ) ); + { + sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet; + WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet ); + if( xSheetGlob.get() ) + importOoxFragment( new PivotCacheRecordsFragment( *xSheetGlob, aRecFragmentPath, mrPivotCache ) ); + } } } // ============================================================================ -PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorkbookHelper& rHelper, +PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath, const PivotCache& rPivotCache ) : - WorksheetFragmentBase( rHelper, rFragmentPath, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ), + WorksheetFragmentBase( rHelper, rFragmentPath ), mrPivotCache( rPivotCache ), mnCol( 0 ), mnRow( 0 ), @@ -373,10 +378,14 @@ bool BiffPivotCacheFragment::importFragment() { /* Last call of lclSeekToPCDField() failed and kept stream position unchanged. Stream should point to source data table now. */ - BiffPivotCacheRecordsContext aContext( *this, mrPivotCache ); - if( aContext.isValidSheet() ) + sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet; + WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet ); + if( xSheetGlob.get() ) + { + BiffPivotCacheRecordsContext aContext( *xSheetGlob, mrPivotCache ); while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) ) aContext.importRecord( rStrm ); + } } } @@ -385,8 +394,8 @@ bool BiffPivotCacheFragment::importFragment() // ============================================================================ -BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorkbookHelper& rHelper, const PivotCache& rPivotCache ) : - BiffWorksheetContextBase( rHelper, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ), +BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorksheetHelper& rHelper, const PivotCache& rPivotCache ) : + BiffWorksheetContextBase( rHelper ), mrPivotCache( rPivotCache ), mnColIdx( 0 ), mnRow( 0 ), diff --git a/oox/source/xls/sharedformulabuffer.cxx b/oox/source/xls/sharedformulabuffer.cxx deleted file mode 100644 index efdfe801f784..000000000000 --- a/oox/source/xls/sharedformulabuffer.cxx +++ /dev/null @@ -1,212 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "oox/xls/sharedformulabuffer.hxx" - -#include -#include -#include "oox/helper/propertyset.hxx" -#include "oox/xls/addressconverter.hxx" -#include "oox/xls/biffinputstream.hxx" -#include "oox/xls/formulaparser.hxx" - -namespace oox { -namespace xls { - -// ============================================================================ - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sheet; -using namespace ::com::sun::star::table; - -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - -// ============================================================================ - -namespace { - -bool operator==( const CellAddress& rAddr1, const CellAddress& rAddr2 ) -{ - return - (rAddr1.Sheet == rAddr2.Sheet) && - (rAddr1.Column == rAddr2.Column) && - (rAddr1.Row == rAddr2.Row); -} - -bool lclContains( const CellRangeAddress& rRange, const CellAddress& rAddr ) -{ - return - (rRange.Sheet == rAddr.Sheet) && - (rRange.StartColumn <= rAddr.Column) && (rAddr.Column <= rRange.EndColumn) && - (rRange.StartRow <= rAddr.Row) && (rAddr.Row <= rRange.EndRow); -} - -} // namespace - -// ============================================================================ - -ExtCellFormulaContext::ExtCellFormulaContext( const WorksheetHelper& rHelper, - const Reference< XFormulaTokens >& rxTokens, const CellAddress& rCellPos ) : - SimpleFormulaContext( rxTokens, false, false ), - WorksheetHelper( rHelper ) -{ - setBaseAddress( rCellPos ); -} - -void ExtCellFormulaContext::setSharedFormula( const CellAddress& rBaseAddr ) -{ - getSharedFormulas().setSharedFormulaCell( *this, rBaseAddr ); -} - -// ============================================================================ - -SharedFormulaBuffer::SharedFormulaBuffer( const WorksheetHelper& rHelper ) : - WorksheetHelper( rHelper ) -{ -} - -void SharedFormulaBuffer::importSharedFmla( const OUString& rFormula, const OUString& rSharedRange, sal_Int32 nSharedId, const CellAddress& rBaseAddr ) -{ - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, rSharedRange, getSheetIndex(), true, true ) ) - { - // create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" ); - BinAddress aMapKey( nSharedId, 0 ); - Reference< XNamedRange > xNamedRange = createDefinedName( aMapKey ); - // convert the formula definition - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY ); - if( xTokens.is() ) - { - SimpleFormulaContext aContext( xTokens, true, false ); - aContext.setBaseAddress( rBaseAddr ); - getFormulaParser().importFormula( aContext, rFormula ); - updateCachedCell( rBaseAddr, aMapKey ); - } - } -} - -void SharedFormulaBuffer::importSharedFmla( SequenceInputStream& rStrm, const CellAddress& rBaseAddr ) -{ - BinRange aRange; - rStrm >> aRange; - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) - { - // create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" ); - BinAddress aMapKey( rBaseAddr ); - Reference< XNamedRange > xNamedRange = createDefinedName( aMapKey ); - // load the formula definition - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY ); - if( xTokens.is() ) - { - SimpleFormulaContext aContext( xTokens, true, false ); - aContext.setBaseAddress( rBaseAddr ); - getFormulaParser().importFormula( aContext, rStrm ); - updateCachedCell( rBaseAddr, aMapKey ); - } - } -} - -void SharedFormulaBuffer::importSharedFmla( BiffInputStream& rStrm, const CellAddress& rBaseAddr ) -{ - BinRange aRange; - aRange.read( rStrm, false ); // always 8bit column indexes - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) - { - // create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" ); - BinAddress aMapKey( rBaseAddr ); - Reference< XNamedRange > xNamedRange = createDefinedName( aMapKey ); - // load the formula definition - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY ); - if( xTokens.is() ) - { - rStrm.skip( 2 ); // flags - SimpleFormulaContext aContext( xTokens, true, false ); - aContext.setBaseAddress( rBaseAddr ); - getFormulaParser().importFormula( aContext, rStrm ); - updateCachedCell( rBaseAddr, aMapKey ); - } - } -} - -void SharedFormulaBuffer::setSharedFormulaCell( ExtCellFormulaContext& rContext, const CellAddress& rBaseAddr ) -{ - if( !implSetSharedFormulaCell( rContext, BinAddress( rBaseAddr ) ) ) - if( rContext.getBaseAddress() == rBaseAddr ) - mxLastContext.reset( new ExtCellFormulaContext( rContext ) ); -} - -void SharedFormulaBuffer::setSharedFormulaCell( ExtCellFormulaContext& rContext, sal_Int32 nSharedId ) -{ - implSetSharedFormulaCell( rContext, BinAddress( nSharedId, 0 ) ); -} - -Reference< XNamedRange > SharedFormulaBuffer::createDefinedName( const BinAddress& rMapKey ) -{ - OSL_ENSURE( maIndexMap.count( rMapKey ) == 0, "SharedFormulaBuffer::createDefinedName - shared formula exists already" ); - // create the defined name representing the shared formula - OUString aName = OUStringBuffer().appendAscii( "__shared_" ). - append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ). - append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ). - append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear(); - Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName ); - PropertySet aNameProps( xNamedRange ); - aNameProps.setProperty( PROP_IsSharedFormula, true ); - sal_Int32 nTokenIndex = -1; - if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) - maIndexMap[ rMapKey ] = nTokenIndex; - return xNamedRange; -} - -bool SharedFormulaBuffer::implSetSharedFormulaCell( ExtCellFormulaContext& rContext, const BinAddress& rMapKey ) -{ - TokenIndexMap::const_iterator aIt = maIndexMap.find( rMapKey ); - sal_Int32 nTokenIndex = (aIt == maIndexMap.end()) ? -1 : aIt->second; - if( nTokenIndex >= 0 ) - { - getFormulaParser().convertNameToFormula( rContext, nTokenIndex ); - return true; - } - return false; -} - -void SharedFormulaBuffer::updateCachedCell( const CellAddress& rBaseAddr, const BinAddress& rMapKey ) -{ - if( mxLastContext.get() && (mxLastContext->getBaseAddress() == rBaseAddr) ) - implSetSharedFormulaCell( *mxLastContext, rMapKey ); - mxLastContext.reset(); -} - -// ============================================================================ - -} // namespace xls -} // namespace oox diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx new file mode 100755 index 000000000000..e63e9fbb61b5 --- /dev/null +++ b/oox/source/xls/sheetdatabuffer.cxx @@ -0,0 +1,689 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "oox/xls/sheetdatabuffer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "oox/helper/containerhelper.hxx" +#include "oox/helper/propertymap.hxx" +#include "oox/helper/propertyset.hxx" +#include "oox/token/tokens.hxx" +#include "oox/xls/addressconverter.hxx" +#include "oox/xls/biffinputstream.hxx" +#include "oox/xls/formulaparser.hxx" +#include "oox/xls/sharedstringsbuffer.hxx" +#include "oox/xls/unitconverter.hxx" + +namespace oox { +namespace xls { + +// ============================================================================ + +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sheet; +using namespace ::com::sun::star::table; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +// ============================================================================ + +namespace { + +bool lclContains( const CellRangeAddress& rRange, const CellAddress& rAddr ) +{ + return + (rRange.Sheet == rAddr.Sheet) && + (rRange.StartColumn <= rAddr.Column) && (rAddr.Column <= rRange.EndColumn) && + (rRange.StartRow <= rAddr.Row) && (rAddr.Row <= rRange.EndRow); +} + +} // namespace + +// ============================================================================ + +SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) : + WorksheetHelper( rHelper ), + mbPendingSharedFmla( false ) +{ +} + +void SheetDataBuffer::importSharedFmla( const OUString& rFormula, const OUString& rSharedRange, sal_Int32 nSharedId, const CellAddress& rBaseAddr ) +{ + CellRangeAddress aFmlaRange; + if( getAddressConverter().convertToCellRange( aFmlaRange, rSharedRange, getSheetIndex(), true, true ) ) try + { + // get or create the defined name representing the shared formula + OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); + Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( nSharedId, 0 ) ); + Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); + // convert the formula definition + ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, rFormula ); + xTokens->setTokens( aTokens ); + // retry to insert a pending shared formula cell + retryPendingSharedFormulaCell(); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::importSharedFmla( SequenceInputStream& rStrm, const CellAddress& rBaseAddr ) +{ + BinRange aRange; + rStrm >> aRange; + CellRangeAddress aFmlaRange; + if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) try + { + // get or create the defined name representing the shared formula + OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); + Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( rBaseAddr ) ); + Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); + // load the formula definition + ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); + xTokens->setTokens( aTokens ); + // retry to insert a pending shared formula cell + retryPendingSharedFormulaCell(); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::importSharedFmla( BiffInputStream& rStrm, const CellAddress& rBaseAddr ) +{ + BinRange aRange; + aRange.read( rStrm, false ); // always 8bit column indexes + CellRangeAddress aFmlaRange; + if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) try + { + // get or create the defined name representing the shared formula + OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); + Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( rBaseAddr ) ); + Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); + // load the formula definition + rStrm.skip( 2 ); // flags + ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); + xTokens->setTokens( aTokens ); + // retry to insert a pending shared formula cell + retryPendingSharedFormulaCell(); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::setValueCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, double fValue ) +{ + OSL_ENSURE( rxCell.is(), "SheetDataBuffer::setDateTimeCell - missing cell interface" ); + if( rxCell.is() ) + rxCell->setValue( fValue ); +} + +void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, const OUString& rText ) +{ + Reference< XText > xText( rxCell, UNO_QUERY ); + OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); + if( xText.is() ) + xText->setString( rText ); +} + +void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, const RichString& rString, sal_Int32 nXfId ) +{ + Reference< XText > xText( rxCell, UNO_QUERY ); + OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); + rString.convert( xText, nXfId ); +} + +void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, sal_Int32 nStringId, sal_Int32 nXfId ) +{ + Reference< XText > xText( rxCell, UNO_QUERY ); + OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); + getSharedStrings().convertString( xText, nStringId, nXfId ); +} + +void SheetDataBuffer::setDateTimeCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const DateTime& rDateTime ) +{ + // write serial date/time value into the cell + double fSerial = getUnitConverter().calcSerialFromDateTime( rDateTime ); + setValueCell( rxCell, rCellAddr, fSerial ); + // set appropriate number format + using namespace ::com::sun::star::util::NumberFormat; + sal_Int16 nStdFmt = (fSerial < 1.0) ? TIME : (((rDateTime.Hours > 0) || (rDateTime.Minutes > 0) || (rDateTime.Seconds > 0)) ? DATETIME : DATE); + setStandardNumFmt( rCellAddr, nStdFmt ); +} + +void SheetDataBuffer::setBooleanCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, bool bValue ) +{ + setFormulaCell( rxCell, rCellAddr, getFormulaParser().convertBoolToFormula( bValue ) ); +} + +void SheetDataBuffer::setErrorCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const OUString& rErrorCode ) +{ + setErrorCell( rxCell, rCellAddr, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); +} + +void SheetDataBuffer::setErrorCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, sal_uInt8 nErrorCode ) +{ + setFormulaCell( rxCell, rCellAddr, getFormulaParser().convertErrorToFormula( nErrorCode ) ); +} + +void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) +{ + mbPendingSharedFmla = false; + ApiTokenSequence aTokens; + + /* Detect special token passed as placeholder for array formulas, shared + formulas, and table operations. In BIFF, these formulas are represented + by a single tExp resp. tTbl token. If the formula parser finds these + tokens, it puts a single OPCODE_BAD token with the base address and + formula type into the token sequence. This information will be + extracted here, and in case of a shared formula, the shared formula + buffer will generate the resulting formula token array. */ + ApiSpecialTokenInfo aTokenInfo; + if( rTokens.hasElements() && getFormulaParser().extractSpecialTokenInfo( aTokenInfo, rTokens ) ) + { + /* The second member of the token info is set to true, if the formula + represents a table operation, which will be skipped. In BIFF12 it + is not possible to distinguish array and shared formulas + (BIFF5/BIFF8 provide this information with a special flag in the + FORMULA record). */ + if( !aTokenInfo.Second ) + { + /* Construct the token array representing the shared formula. If + the returned sequence is empty, the definition of the shared + formula has not been loaded yet, or the cell is part of an + array formula. In this case, the cell will be remembered. After + reading the formula definition it will be retried to insert the + formula via retryPendingSharedFormulaCell(). */ + aTokens = resolveSharedFormula( aTokenInfo.First ); + if( !aTokens.hasElements() ) + { + maSharedFmlaAddr = rCellAddr; + maSharedBaseAddr = aTokenInfo.First; + mbPendingSharedFmla = true; + } + } + } + else + { + // simple formula, use the passed token array + aTokens = rTokens; + } + + if( aTokens.hasElements() ) + { + Reference< XFormulaTokens > xTokens( rxCell, UNO_QUERY ); + OSL_ENSURE( xTokens.is(), "SheetDataBuffer::setFormulaCell - missing formula interface" ); + if( xTokens.is() ) + xTokens->setTokens( aTokens ); + } +} + +void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, sal_Int32 nSharedId ) +{ + setFormulaCell( rxCell, rCellAddr, resolveSharedFormula( nSharedId ) ); +} + +void SheetDataBuffer::setArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) +{ + try + { + Reference< XArrayFormulaTokens > xTokens( getCellRange( rRange ), UNO_QUERY_THROW ); + xTokens->setArrayTokens( rTokens ); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::setTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) +{ + OSL_ENSURE( getAddressConverter().checkCellRange( rRange, true, false ), "SheetDataBuffer::setTableOperation - invalid range" ); + sal_Int16 nSheet = getSheetIndex(); + bool bOk = false; + if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) + { + CellRangeAddress aOpRange = rRange; + CellAddress aRef1, aRef2; + if( getAddressConverter().convertToCellAddress( aRef1, rModel.maRef1, nSheet, true ) ) try + { + if( rModel.mb2dTable ) + { + if( !rModel.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rModel.maRef2, nSheet, true ) ) + { + // API call expects input values inside operation range + --aOpRange.StartColumn; + --aOpRange.StartRow; + // formula range is top-left cell of operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow, aOpRange.StartColumn, aOpRange.StartRow ); + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_BOTH, aRef2, aRef1 ); + bOk = true; + } + } + else if( rModel.mbRowTable ) + { + // formula range is column to the left of operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn - 1, aOpRange.StartRow, aOpRange.StartColumn - 1, aOpRange.EndRow ); + // API call expects input values (top row) inside operation range + --aOpRange.StartRow; + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_ROW, aRef1, aRef1 ); + bOk = true; + } + else + { + // formula range is row above operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow - 1, aOpRange.EndColumn, aOpRange.StartRow - 1 ); + // API call expects input values (left column) inside operation range + --aOpRange.StartColumn; + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_COLUMN, aRef1, aRef1 ); + bOk = true; + } + } + catch( Exception& ) + { + } + } + + // on error: fill cell range with error codes + if( !bOk ) + for( CellAddress aPos( nSheet, rRange.StartColumn, rRange.StartRow ); aPos.Row <= rRange.EndRow; ++aPos.Row ) + for( aPos.Column = rRange.StartColumn; aPos.Column <= rRange.EndColumn; ++aPos.Column ) + setErrorCell( getCell( aPos ), aPos, BIFF_ERR_REF ); +} + +void SheetDataBuffer::setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ) +{ + // set row formatting + if( bCustomFormat ) + { + // try to expand cached row range, if formatting is equal + if( (maXfIdRowRange.mnLastRow < 0) || !maXfIdRowRange.tryExpand( nFirstRow, nLastRow, nXfId ) ) + { + writeXfIdRowRangeProperties( maXfIdRowRange ); + maXfIdRowRange.set( nFirstRow, nLastRow, nXfId ); + } + } + else if( maXfIdRowRange.mnLastRow >= 0 ) + { + // finish last cached row range + writeXfIdRowRangeProperties( maXfIdRowRange ); + maXfIdRowRange.set( -1, -1, -1 ); + } +} + +void SheetDataBuffer::setCellFormat( const CellModel& rModel ) +{ + if( rModel.mxCell.is() && ((rModel.mnXfId >= 0) || (rModel.mnNumFmtId >= 0)) ) + { + // try to merge existing ranges and to write some formatting properties + if( !maXfIdRanges.empty() ) + { + // get row index of last inserted cell + sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; + // row changed - try to merge ranges of last row with existing ranges + if( rModel.maAddress.Row != nLastRow ) + { + mergeXfIdRanges(); + // write format properties of all ranges above last row and remove them + XfIdRangeMap::iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); + while( aIt != aEnd ) + { + // check that range cannot be merged with current row, and that range is not in cached row range + if( (aIt->second.maRange.EndRow < nLastRow) && !maXfIdRowRange.intersects( aIt->second.maRange ) ) + { + writeXfIdRangeProperties( aIt->second ); + maXfIdRanges.erase( aIt++ ); + } + else + ++aIt; + } + } + } + + // try to expand last existing range, or create new range entry + if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel ) ) + maXfIdRanges[ BinAddress( rModel.maAddress ) ].set( rModel ); + + // update merged ranges for 'center across selection' and 'fill' + if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() ) + { + sal_Int32 nHorAlign = pXf->getAlignment().getModel().mnHorAlign; + if( (nHorAlign == XML_centerContinuous) || (nHorAlign == XML_fill) ) + { + /* start new merged range, if cell is not empty (#108781#), + or try to expand last range with empty cell */ + if( rModel.mnCellType != XML_TOKEN_INVALID ) + maCenterFillRanges.push_back( MergedRange( rModel.maAddress, nHorAlign ) ); + else if( !maCenterFillRanges.empty() ) + maCenterFillRanges.rbegin()->tryExpand( rModel.maAddress, nHorAlign ); + } + } + } +} + +void SheetDataBuffer::setMergedRange( const CellRangeAddress& rRange ) +{ + maMergedRanges.push_back( MergedRange( rRange ) ); +} + +void SheetDataBuffer::setStandardNumFmt( const CellAddress& rCellAddr, sal_Int16 nStdNumFmt ) +{ + try + { + Reference< XNumberFormatsSupplier > xNumFmtsSupp( getDocument(), UNO_QUERY_THROW ); + Reference< XNumberFormatTypes > xNumFmtTypes( xNumFmtsSupp->getNumberFormats(), UNO_QUERY_THROW ); + sal_Int32 nIndex = xNumFmtTypes->getStandardFormat( nStdNumFmt, Locale() ); + PropertySet aPropSet( getCell( rCellAddr ) ); + aPropSet.setProperty( PROP_NumberFormat, nIndex ); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::finalizeImport() +{ + // write default formatting of remaining row range + writeXfIdRowRangeProperties( maXfIdRowRange ); + + // try to merge remaining inserted ranges + mergeXfIdRanges(); + // write all formatting + for( XfIdRangeMap::const_iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); aIt != aEnd; ++aIt ) + writeXfIdRangeProperties( aIt->second ); + + // merge all cached merged ranges and update right/bottom cell borders + MergedRangeList::const_iterator aIt, aEnd; + for( aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) + finalizeMergedRange( aIt->maRange ); + for( aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) + finalizeMergedRange( aIt->maRange ); +} + +// private -------------------------------------------------------------------- + +SheetDataBuffer::XfIdRowRange::XfIdRowRange() : + mnFirstRow( -1 ), + mnLastRow( -1 ), + mnXfId( -1 ) +{ +} + +bool SheetDataBuffer::XfIdRowRange::intersects( const CellRangeAddress& rRange ) const +{ + return (rRange.StartRow <= mnLastRow) && (mnFirstRow <= rRange.EndRow); +} + +void SheetDataBuffer::XfIdRowRange::set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) +{ + mnFirstRow = nFirstRow; + mnLastRow = nLastRow; + mnXfId = nXfId; +} + +bool SheetDataBuffer::XfIdRowRange::tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) +{ + if( mnXfId == nXfId ) + { + if( mnLastRow + 1 == nFirstRow ) + { + mnLastRow = nLastRow; + return true; + } + if( mnFirstRow == nLastRow + 1 ) + { + mnFirstRow = nFirstRow; + return true; + } + } + return false; +} + +void SheetDataBuffer::XfIdRange::set( const CellModel& rModel ) +{ + maRange.Sheet = rModel.maAddress.Sheet; + maRange.StartColumn = maRange.EndColumn = rModel.maAddress.Column; + maRange.StartRow = maRange.EndRow = rModel.maAddress.Row; + mnXfId = rModel.mnXfId; + mnNumFmtId = rModel.mnNumFmtId; +} + +bool SheetDataBuffer::XfIdRange::tryExpand( const CellModel& rModel ) +{ + if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == rModel.mnNumFmtId) && + (maRange.StartRow == rModel.maAddress.Row) && + (maRange.EndRow == rModel.maAddress.Row) && + (maRange.EndColumn + 1 == rModel.maAddress.Column) ) + { + ++maRange.EndColumn; + return true; + } + return false; +} + +bool SheetDataBuffer::XfIdRange::tryMerge( const XfIdRange& rXfIdRange ) +{ + if( (mnXfId == rXfIdRange.mnXfId) && + (mnNumFmtId == rXfIdRange.mnNumFmtId) && + (maRange.EndRow + 1 == rXfIdRange.maRange.StartRow) && + (maRange.StartColumn == rXfIdRange.maRange.StartColumn) && + (maRange.EndColumn == rXfIdRange.maRange.EndColumn) ) + { + maRange.EndRow = rXfIdRange.maRange.EndRow; + return true; + } + return false; +} + + +SheetDataBuffer::MergedRange::MergedRange( const CellRangeAddress& rRange ) : + maRange( rRange ), + mnHorAlign( XML_TOKEN_INVALID ) +{ +} + +SheetDataBuffer::MergedRange::MergedRange( const CellAddress& rAddress, sal_Int32 nHorAlign ) : + maRange( rAddress.Sheet, rAddress.Column, rAddress.Row, rAddress.Column, rAddress.Row ), + mnHorAlign( nHorAlign ) +{ +} + +bool SheetDataBuffer::MergedRange::tryExpand( const CellAddress& rAddress, sal_Int32 nHorAlign ) +{ + if( (mnHorAlign == nHorAlign) && (maRange.StartRow == rAddress.Row) && + (maRange.EndRow == rAddress.Row) && (maRange.EndColumn + 1 == rAddress.Column) ) + { + ++maRange.EndColumn; + return true; + } + return false; +} + +Reference< XNamedRange > SheetDataBuffer::createSharedFormulaName( const BinAddress& rMapKey ) +{ + // create the defined name that will represent the shared formula + OUString aName = OUStringBuffer().appendAscii( RTL_CONSTASCII_STRINGPARAM( "__shared_" ) ). + append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ). + append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ). + append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear(); + Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName ); + PropertySet aNameProps( xNamedRange ); + aNameProps.setProperty( PROP_IsSharedFormula, true ); + + // get and store the token index of the defined name + OSL_ENSURE( maTokenIndexes.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormulaName - key exists already" ); + sal_Int32 nTokenIndex = 0; + if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) ) + maTokenIndexes[ rMapKey ] = nTokenIndex; + + return xNamedRange; +} + +ApiTokenSequence SheetDataBuffer::resolveSharedFormula( sal_Int32 nSharedId ) const +{ + sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maTokenIndexes, BinAddress( nSharedId, 0 ), -1 ); + return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); +} + +ApiTokenSequence SheetDataBuffer::resolveSharedFormula( const CellAddress& rBaseAddr ) const +{ + sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maTokenIndexes, BinAddress( rBaseAddr ), -1 ); + return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); +} + +void SheetDataBuffer::retryPendingSharedFormulaCell() +{ + if( mbPendingSharedFmla ) + { + ApiTokenSequence aTokens = resolveSharedFormula( maSharedBaseAddr ); + setFormulaCell( getCell( maSharedFmlaAddr ), maSharedFmlaAddr, aTokens ); + mbPendingSharedFmla = false; + } +} + +void SheetDataBuffer::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const +{ + if( (rXfIdRowRange.mnLastRow >= 0) && (rXfIdRowRange.mnXfId >= 0) ) + { + AddressConverter& rAddrConv = getAddressConverter(); + CellRangeAddress aRange( getSheetIndex(), 0, rXfIdRowRange.mnFirstRow, rAddrConv.getMaxApiAddress().Column, rXfIdRowRange.mnLastRow ); + if( rAddrConv.validateCellRange( aRange, true, false ) ) + { + PropertySet aPropSet( getCellRange( aRange ) ); + getStyles().writeCellXfToPropertySet( aPropSet, rXfIdRowRange.mnXfId ); + } + } +} + +void SheetDataBuffer::writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const +{ + StylesBuffer& rStyles = getStyles(); + PropertyMap aPropMap; + if( rXfIdRange.mnXfId >= 0 ) + rStyles.writeCellXfToPropertyMap( aPropMap, rXfIdRange.mnXfId ); + if( rXfIdRange.mnNumFmtId >= 0 ) + rStyles.writeNumFmtToPropertyMap( aPropMap, rXfIdRange.mnNumFmtId ); + PropertySet aPropSet( getCellRange( rXfIdRange.maRange ) ); + aPropSet.setProperties( aPropMap ); +} + +void SheetDataBuffer::mergeXfIdRanges() +{ + if( !maXfIdRanges.empty() ) + { + // get row index of last range + sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; + // process all ranges located in the same row of the last range + XfIdRangeMap::iterator aMergeIt = maXfIdRanges.end(); + while( (aMergeIt != maXfIdRanges.begin()) && ((--aMergeIt)->second.maRange.StartRow == nLastRow) ) + { + const XfIdRange& rMergeXfIdRange = aMergeIt->second; + // try to find a range that can be merged with rMergeRange + bool bFound = false; + for( XfIdRangeMap::iterator aIt = maXfIdRanges.begin(); !bFound && (aIt != aMergeIt); ++aIt ) + if( (bFound = aIt->second.tryMerge( rMergeXfIdRange )) == true ) + maXfIdRanges.erase( aMergeIt++ ); + } + } +} + +void SheetDataBuffer::finalizeMergedRange( const CellRangeAddress& rRange ) +{ + bool bMultiCol = rRange.StartColumn < rRange.EndColumn; + bool bMultiRow = rRange.StartRow < rRange.EndRow; + + if( bMultiCol || bMultiRow ) try + { + // merge the cell range + Reference< XMergeable > xMerge( getCellRange( rRange ), UNO_QUERY_THROW ); + xMerge->merge( sal_True ); + + // if merging this range worked (no overlapping merged ranges), update cell borders + Reference< XCell > xTopLeft( getCell( CellAddress( getSheetIndex(), rRange.StartColumn, rRange.StartRow ) ), UNO_SET_THROW ); + PropertySet aTopLeftProp( xTopLeft ); + + // copy right border of top-right cell to right border of top-left cell + if( bMultiCol ) + { + PropertySet aTopRightProp( getCell( CellAddress( getSheetIndex(), rRange.EndColumn, rRange.StartRow ) ) ); + BorderLine aLine; + if( aTopRightProp.getProperty( aLine, PROP_RightBorder ) ) + aTopLeftProp.setProperty( PROP_RightBorder, aLine ); + } + + // copy bottom border of bottom-left cell to bottom border of top-left cell + if( bMultiRow ) + { + PropertySet aBottomLeftProp( getCell( CellAddress( getSheetIndex(), rRange.StartColumn, rRange.EndRow ) ) ); + BorderLine aLine; + if( aBottomLeftProp.getProperty( aLine, PROP_BottomBorder ) ) + aTopLeftProp.setProperty( PROP_BottomBorder, aLine ); + } + + // #i93609# merged range in a single row: test if manual row height is needed + if( !bMultiRow ) + { + bool bTextWrap = aTopLeftProp.getBoolProperty( PROP_IsTextWrapped ); + if( !bTextWrap && (xTopLeft->getType() == CellContentType_TEXT) ) + { + Reference< XText > xText( xTopLeft, UNO_QUERY ); + bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0); + } + if( bTextWrap ) + setManualRowHeight( rRange.StartRow ); + } + } + catch( Exception& ) + { + } +} + +// ============================================================================ + +} // namespace xls +} // namespace oox diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 2d678aec72ca..f387257eaaf0 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -27,8 +27,6 @@ #include "oox/xls/sheetdatacontext.hxx" -#include -#include #include #include #include @@ -39,7 +37,7 @@ #include "oox/xls/biffinputstream.hxx" #include "oox/xls/formulaparser.hxx" #include "oox/xls/richstringcontext.hxx" -#include "oox/xls/sharedformulabuffer.hxx" +#include "oox/xls/sheetdatabuffer.hxx" #include "oox/xls/unitconverter.hxx" namespace oox { @@ -100,61 +98,13 @@ const sal_uInt32 BIFF_ROW_SHOWPHONETIC = 0x40000000; const sal_Int32 BIFF2_CELL_USEIXFE = 63; -// ---------------------------------------------------------------------------- - -/** Formula context for cell formulas. */ -class CellFormulaContext : public SimpleFormulaContext -{ -public: - explicit CellFormulaContext( - const Reference< XFormulaTokens >& rxTokens, - const CellAddress& rCellPos ); -}; - -CellFormulaContext::CellFormulaContext( const Reference< XFormulaTokens >& rxTokens, const CellAddress& rCellPos ) : - SimpleFormulaContext( rxTokens, false, false ) -{ - setBaseAddress( rCellPos ); -} - -// ---------------------------------------------------------------------------- - -/** Uses the XArrayFormulaTokens interface to set a token sequence. */ -class ArrayFormulaContext : public FormulaContext -{ -public: - explicit ArrayFormulaContext( - const Reference< XArrayFormulaTokens >& rxTokens, - const CellRangeAddress& rArrayRange ); - - virtual void setTokens( const ApiTokenSequence& rTokens ); - -private: - Reference< XArrayFormulaTokens > mxTokens; -}; - -ArrayFormulaContext::ArrayFormulaContext( - const Reference< XArrayFormulaTokens >& rxTokens, const CellRangeAddress& rArrayRange ) : - FormulaContext( false, false ), - mxTokens( rxTokens ) -{ - OSL_ENSURE( mxTokens.is(), "ArrayFormulaContext::ArrayFormulaContext - missing XArrayFormulaTokens interface" ); - setBaseAddress( CellAddress( rArrayRange.Sheet, rArrayRange.StartColumn, rArrayRange.StartRow ) ); -} - -void ArrayFormulaContext::setTokens( const ApiTokenSequence& rTokens ) -{ - mxTokens->setArrayTokens( rTokens ); -} - -// ---------------------------------------------------------------------------- - } // namespace // ============================================================================ SheetDataContext::SheetDataContext( WorksheetFragmentBase& rFragment ) : - WorksheetContextBase( rFragment ) + WorksheetContextBase( rFragment ), + mrSheetData( getSheetData() ) { } @@ -177,10 +127,10 @@ ContextHandlerRef SheetDataContext::onCreateContext( sal_Int32 nElement, const A mxInlineStr.reset( new RichString( *this ) ); return new RichStringContext( *this, mxInlineStr ); case XLS_TOKEN( v ): - return this; + return this; // characters contain cell value case XLS_TOKEN( f ): importFormula( rAttribs ); - return this; + return this; // characters contain formula string } break; } @@ -192,94 +142,112 @@ void SheetDataContext::onCharacters( const OUString& rChars ) switch( getCurrentElement() ) { case XLS_TOKEN( v ): - maCurrCell.maValueStr = rChars; - maCurrCell.mbHasValueStr = true; + maCurrCell.maValue = rChars; break; - case XLS_TOKEN( f ): - if( maCurrCell.mxCell.is() ) try - { - switch( maCurrCell.mnFormulaType ) - { - case XML_normal: - if( rChars.getLength() > 0 ) - { - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY_THROW ); - CellFormulaContext aContext( xTokens, maCurrCell.maAddress ); - getFormulaParser().importFormula( aContext, rChars ); - } - break; - - case XML_array: - if( (maCurrCell.maFormulaRef.getLength() > 0) && (rChars.getLength() > 0) ) - { - CellRangeAddress aArrayRange; - Reference< XArrayFormulaTokens > xTokens( getCellRange( maCurrCell.maFormulaRef, &aArrayRange ), UNO_QUERY_THROW ); - ArrayFormulaContext aContext( xTokens, aArrayRange ); - getFormulaParser().importFormula( aContext, rChars ); - } - break; - - case XML_shared: - if( maCurrCell.mnSharedId >= 0 ) - { - if( rChars.getLength() > 0 ) - getSharedFormulas().importSharedFmla( rChars, maCurrCell.maFormulaRef, maCurrCell.mnSharedId, maCurrCell.maAddress ); - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY_THROW ); - ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress ); - getSharedFormulas().setSharedFormulaCell( aContext, maCurrCell.mnSharedId ); - } - break; - - case XML_dataTable: - if( maCurrCell.maFormulaRef.getLength() > 0 ) - { - CellRangeAddress aTableRange; - if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) - setTableOperation( aTableRange, maTableData ); - } - break; - - default: - OSL_ENSURE( false, "SheetDataContext::onCharacters - unknown formula type" ); - } - } - catch( Exception& ) - { - } + maCurrCell.maFormula = rChars; break; } } void SheetDataContext::onEndElement() { - if( isCurrentElement( XLS_TOKEN( c ) ) && maCurrCell.mxCell.is() ) + switch( getCurrentElement() ) { - if( maCurrCell.mxCell->getType() == CellContentType_EMPTY ) - { - if( maCurrCell.mbHasValueStr ) - { - // implemented in WorksheetHelper class - setCell( maCurrCell ); - } - else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() ) - { - // convert font settings - mxInlineStr->finalizeImport(); - // write string to cell - Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY ); - if( xText.is() ) - mxInlineStr->convert( xText, maCurrCell.mnXfId ); - } - else + case XLS_TOKEN( c ): + if( maCurrCell.mxCell.is() ) { - // empty cell, update cell type - maCurrCell.mnCellType = XML_TOKEN_INVALID; - } - } + // try to create a formula cell + if( maCurrCell.mxCell->getType() == CellContentType_EMPTY ) + { + switch( maCurrCell.mnFormulaType ) + { + case XML_normal: + if( maCurrCell.maFormula.getLength() > 0 ) + { + ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, maCurrCell.maFormula ); + mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); + } + break; + + case XML_array: + if( (maCurrCell.maFormula.getLength() > 0) && (maCurrCell.maFormulaRef.getLength() > 0) ) + { + CellRangeAddress aArrayRange; + if( getAddressConverter().convertToCellRange( aArrayRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) + { + CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, maCurrCell.maFormula ); + mrSheetData.setArrayFormula( aArrayRange, aTokens ); + } + } + break; + + case XML_shared: + if( maCurrCell.mnSharedId >= 0 ) + { + if( maCurrCell.maFormula.getLength() > 0 ) + mrSheetData.importSharedFmla( maCurrCell.maFormula, maCurrCell.maFormulaRef, maCurrCell.mnSharedId, maCurrCell.maAddress ); + mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.mnSharedId ); + } + break; + + case XML_dataTable: + if( maCurrCell.maFormulaRef.getLength() > 0 ) + { + CellRangeAddress aTableRange; + if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) + mrSheetData.setTableOperation( aTableRange, maTableData ); + } + break; + + default: + OSL_ENSURE( maCurrCell.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onCharacters - unknown formula type" ); + } + } + + // no formula created: try to set the cell value + if( maCurrCell.mxCell->getType() == CellContentType_EMPTY ) + { + if( maCurrCell.maValue.getLength() > 0 ) + { + switch( maCurrCell.mnCellType ) + { + case XML_n: + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toDouble() ); + break; + case XML_b: + mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toDouble() != 0.0 ); + // #108770# set 'Standard' number format for all Boolean cells + maCurrCell.mnNumFmtId = 0; + break; + case XML_e: + mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue ); + break; + case XML_str: + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue ); + break; + case XML_s: + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toInt32(), maCurrCell.mnXfId ); + break; + } + } + else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() ) + { + mxInlineStr->finalizeImport(); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, *mxInlineStr, maCurrCell.mnXfId ); + } + else + { + // empty cell, update cell type + maCurrCell.mnCellType = XML_TOKEN_INVALID; + } + } - // store the cell formatting data - setCellFormat( maCurrCell ); + // store the cell formatting data + mrSheetData.setCellFormat( maCurrCell ); + } + break; } } @@ -288,10 +256,7 @@ ContextHandlerRef SheetDataContext::onCreateRecordContext( sal_Int32 nRecId, Seq switch( getCurrentElement() ) { case BIFF12_ID_SHEETDATA: - switch( nRecId ) - { - case BIFF12_ID_ROW: importRow( rStrm ); return this; - } + if( nRecId == BIFF12_ID_ROW ) { importRow( rStrm ); return this; } break; case BIFF12_ID_ROW: @@ -409,19 +374,19 @@ void SheetDataContext::importCellBool( SequenceInputStream& rStrm, CellType eCel } else { - setBooleanCell( maCurrCell.mxCell, bValue ); + mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, bValue ); // #108770# set 'Standard' number format for all Boolean cells maCurrCell.mnNumFmtId = 0; } } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellBlank( SequenceInputStream& rStrm, CellType eCellType ) { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" ); importCellHeader( rStrm, eCellType ); - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eCellType ) @@ -434,9 +399,9 @@ void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eC if( eCellType == CELLTYPE_FORMULA ) importCellFormula( rStrm ); else - maCurrCell.mxCell->setValue( fValue ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, fValue ); } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellError( SequenceInputStream& rStrm, CellType eCellType ) @@ -449,9 +414,9 @@ void SheetDataContext::importCellError( SequenceInputStream& rStrm, CellType eCe if( eCellType == CELLTYPE_FORMULA ) importCellFormula( rStrm ); else - setErrorCell( maCurrCell.mxCell, nErrorCode ); + mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, nErrorCode ); } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellRk( SequenceInputStream& rStrm, CellType eCellType ) @@ -460,8 +425,8 @@ void SheetDataContext::importCellRk( SequenceInputStream& rStrm, CellType eCellT importCellHeader( rStrm, eCellType ); maCurrCell.mnCellType = XML_n; if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) - maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - setCellFormat( maCurrCell ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellRString( SequenceInputStream& rStrm, CellType eCellType ) @@ -469,15 +434,14 @@ void SheetDataContext::importCellRString( SequenceInputStream& rStrm, CellType e OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRString - no formula cells supported" ); importCellHeader( rStrm, eCellType ); maCurrCell.mnCellType = XML_inlineStr; - Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY ); - if( xText.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) { RichString aString( *this ); aString.importString( rStrm, true ); aString.finalizeImport(); - aString.convert( xText, maCurrCell.mnXfId ); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellSi( SequenceInputStream& rStrm, CellType eCellType ) @@ -486,8 +450,8 @@ void SheetDataContext::importCellSi( SequenceInputStream& rStrm, CellType eCellT importCellHeader( rStrm, eCellType ); maCurrCell.mnCellType = XML_s; if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) - setSharedStringCell( maCurrCell.mxCell, rStrm.readInt32(), maCurrCell.mnXfId ); - setCellFormat( maCurrCell ); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readInt32(), maCurrCell.mnXfId ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eCellType ) @@ -495,7 +459,7 @@ void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eC importCellHeader( rStrm, eCellType ); maCurrCell.mnCellType = XML_inlineStr; Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY ); - if( xText.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) { RichString aString( *this ); aString.importString( rStrm, false ); @@ -503,20 +467,16 @@ void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eC if( eCellType == CELLTYPE_FORMULA ) importCellFormula( rStrm ); else - aString.convert( xText, maCurrCell.mnXfId ); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellFormula( SequenceInputStream& rStrm ) { rStrm.skip( 2 ); - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY ); - if( xTokens.is() ) - { - ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress ); - getFormulaParser().importFormula( aContext, rStrm ); - } + ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, FORMULATYPE_CELL, rStrm ); + mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); } void SheetDataContext::importRow( SequenceInputStream& rStrm ) @@ -548,19 +508,18 @@ void SheetDataContext::importArray( SequenceInputStream& rStrm ) BinRange aRange; rStrm >> aRange; CellRangeAddress aArrayRange; - Reference< XCellRange > xRange = getCellRange( aRange, &aArrayRange ); - Reference< XArrayFormulaTokens > xTokens( xRange, UNO_QUERY ); - if( xRange.is() && xTokens.is() ) + if( getAddressConverter().convertToCellRange( aArrayRange, aRange, getSheetIndex(), true, true ) ) { rStrm.skip( 1 ); - ArrayFormulaContext aContext( xTokens, aArrayRange ); - getFormulaParser().importFormula( aContext, rStrm ); + CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_ARRAY, rStrm ); + mrSheetData.setArrayFormula( aArrayRange, aTokens ); } } void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm ) { - getSharedFormulas().importSharedFmla( rStrm, maCurrCell.maAddress ); + mrSheetData.importSharedFmla( rStrm, maCurrCell.maAddress ); } void SheetDataContext::importDataTable( SequenceInputStream& rStrm ) @@ -580,7 +539,7 @@ void SheetDataContext::importDataTable( SequenceInputStream& rStrm ) aModel.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D ); aModel.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL ); aModel.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL ); - setTableOperation( aTableRange, aModel ); + mrSheetData.setTableOperation( aTableRange, aModel ); } } @@ -588,25 +547,27 @@ void SheetDataContext::importDataTable( SequenceInputStream& rStrm ) BiffSheetDataContext::BiffSheetDataContext( const WorksheetHelper& rHelper ) : BiffWorksheetContextBase( rHelper ), + mrSheetData( getSheetData() ), mnBiff2XfId( 0 ) { switch( getBiff() ) { case BIFF2: - mnFormulaIgnoreSize = 9; // double formula result, 1 byte flags - mnArrayIgnoreSize = 1; // recalc-always flag + mnFormulaSkipSize = 9; // double formula result, 1 byte flags + mnArraySkipSize = 1; // recalc-always flag break; case BIFF3: case BIFF4: - mnFormulaIgnoreSize = 10; // double formula result, 2 byte flags - mnArrayIgnoreSize = 2; // 2 byte flags + mnFormulaSkipSize = 10; // double formula result, 2 byte flags + mnArraySkipSize = 2; // 2 byte flags break; case BIFF5: case BIFF8: - mnFormulaIgnoreSize = 14; // double formula result, 2 byte flags, 4 bytes nothing - mnArrayIgnoreSize = 6; // 2 byte flags, 4 bytes nothing + mnFormulaSkipSize = 14; // double formula result, 2 byte flags, 4 bytes nothing + mnArraySkipSize = 6; // 2 byte flags, 4 bytes nothing + break; + case BIFF_UNKNOWN: break; - case BIFF_UNKNOWN: break; } } @@ -687,7 +648,8 @@ void BiffSheetDataContext::importRecord( BiffInputStream& rStrm ) } break; - case BIFF_UNKNOWN: break; + case BIFF_UNKNOWN: + break; } } } @@ -752,7 +714,7 @@ void BiffSheetDataContext::importCellHeader( BiffInputStream& rStrm, bool bBiff2 void BiffSheetDataContext::importBlank( BiffInputStream& rStrm ) { importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK ); - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) @@ -766,87 +728,77 @@ void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) { case BIFF_BOOLERR_BOOL: maCurrCell.mnCellType = XML_b; - setBooleanCell( maCurrCell.mxCell, nValue != 0 ); + mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, nValue != 0 ); // #108770# set 'Standard' number format for all Boolean cells maCurrCell.mnNumFmtId = 0; break; case BIFF_BOOLERR_ERROR: maCurrCell.mnCellType = XML_e; - setErrorCell( maCurrCell.mxCell, nValue ); + mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, nValue ); break; default: OSL_ENSURE( false, "BiffSheetDataContext::importBoolErr - unknown cell type" ); } } - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importFormula( BiffInputStream& rStrm ) { importCellHeader( rStrm, getBiff() == BIFF2 ); maCurrCell.mnCellType = XML_n; - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY ); - if( xTokens.is() ) - { - rStrm.skip( mnFormulaIgnoreSize ); - ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress ); - getFormulaParser().importFormula( aContext, rStrm ); - } - setCellFormat( maCurrCell ); + rStrm.skip( mnFormulaSkipSize ); + ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, FORMULATYPE_CELL, rStrm ); + mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importInteger( BiffInputStream& rStrm ) { importCellHeader( rStrm, true ); maCurrCell.mnCellType = XML_n; - if( maCurrCell.mxCell.is() ) - maCurrCell.mxCell->setValue( rStrm.readuInt16() ); - setCellFormat( maCurrCell ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readuInt16() ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) { + /* the deep secrets of BIFF type and record identifier... + record id BIFF -> XF type String type + 0x0004 2-7 -> 3 byte 8-bit length, byte string + 0x0004 8 -> 3 byte 16-bit length, unicode string + 0x0204 2-7 -> 2 byte 16-bit length, byte string + 0x0204 8 -> 2 byte 16-bit length, unicode string + */ bool bBiff2Xf = rStrm.getRecId() == BIFF2_ID_LABEL; importCellHeader( rStrm, bBiff2Xf ); maCurrCell.mnCellType = XML_inlineStr; - Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY ); - if( xText.is() ) + RichString aString( *this ); + if( getBiff() == BIFF8 ) { - /* the deep secrets of BIFF type and record identifier... - record id BIFF -> XF type String type - 0x0004 2-7 -> 3 byte 8-bit length, byte string - 0x0004 8 -> 3 byte 16-bit length, unicode string - 0x0204 2-7 -> 2 byte 16-bit length, byte string - 0x0204 8 -> 2 byte 16-bit length, unicode string */ - - RichString aString( *this ); - if( getBiff() == BIFF8 ) - { - aString.importUniString( rStrm ); - } - else - { - // #i63105# use text encoding from FONT record - rtl_TextEncoding eTextEnc = getTextEncoding(); - if( const Font* pFont = getStyles().getFontFromCellXf( maCurrCell.mnXfId ).get() ) - eTextEnc = pFont->getFontEncoding(); - BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT; - setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING ); - aString.importByteString( rStrm, eTextEnc, nFlags ); - } - aString.finalizeImport(); - aString.convert( xText, maCurrCell.mnXfId ); + aString.importUniString( rStrm ); + } + else + { + // #i63105# use text encoding from FONT record + rtl_TextEncoding eTextEnc = getTextEncoding(); + if( const Font* pFont = getStyles().getFontFromCellXf( maCurrCell.mnXfId ).get() ) + eTextEnc = pFont->getFontEncoding(); + BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT; + setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING ); + aString.importByteString( rStrm, eTextEnc, nFlags ); } - setCellFormat( maCurrCell ); + aString.finalizeImport(); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm ) { importCellHeader( rStrm, false ); maCurrCell.mnCellType = XML_s; - if( maCurrCell.mxCell.is() ) - setSharedStringCell( maCurrCell.mxCell, rStrm.readInt32(), maCurrCell.mnXfId ); - setCellFormat( maCurrCell ); + mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readInt32(), maCurrCell.mnXfId ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm ) @@ -856,7 +808,7 @@ void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm ) { setCurrCell( aAddr ); importXfId( rStrm, false ); - setCellFormat( maCurrCell ); + mrSheetData.setCellFormat( maCurrCell ); } } @@ -869,9 +821,8 @@ void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm ) maCurrCell.mnCellType = XML_n; importXfId( rStrm, false ); sal_Int32 nRkValue = rStrm.readInt32(); - if( maCurrCell.mxCell.is() ) - maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( nRkValue ) ); - setCellFormat( maCurrCell ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( nRkValue ) ); + mrSheetData.setCellFormat( maCurrCell ); } } @@ -879,18 +830,16 @@ void BiffSheetDataContext::importNumber( BiffInputStream& rStrm ) { importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER ); maCurrCell.mnCellType = XML_n; - if( maCurrCell.mxCell.is() ) - maCurrCell.mxCell->setValue( rStrm.readDouble() ); - setCellFormat( maCurrCell ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readDouble() ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importRk( BiffInputStream& rStrm ) { importCellHeader( rStrm, false ); maCurrCell.mnCellType = XML_n; - if( maCurrCell.mxCell.is() ) - maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - setCellFormat( maCurrCell ); + mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); + mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) @@ -939,19 +888,18 @@ void BiffSheetDataContext::importArray( BiffInputStream& rStrm ) BinRange aRange; aRange.read( rStrm, false ); // columns always 8-bit CellRangeAddress aArrayRange; - Reference< XCellRange > xRange = getCellRange( aRange, &aArrayRange ); - Reference< XArrayFormulaTokens > xTokens( xRange, UNO_QUERY ); - if( xRange.is() && xTokens.is() ) + if( getAddressConverter().convertToCellRange( aArrayRange, aRange, getSheetIndex(), true, true ) ) { - rStrm.skip( mnArrayIgnoreSize ); - ArrayFormulaContext aContext( xTokens, aArrayRange ); - getFormulaParser().importFormula( aContext, rStrm ); + rStrm.skip( mnArraySkipSize ); + CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); + ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_ARRAY, rStrm ); + mrSheetData.setArrayFormula( aArrayRange, aTokens ); } } void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm ) { - getSharedFormulas().importSharedFmla( rStrm, maCurrCell.maAddress ); + mrSheetData.importSharedFmla( rStrm, maCurrCell.maAddress ); } void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm ) @@ -991,7 +939,7 @@ void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm ) } aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false ); aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false ); - setTableOperation( aTableRange, aModel ); + mrSheetData.setTableOperation( aTableRange, aModel ); } } diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 843bfd69fdfe..13382787e958 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -222,8 +222,10 @@ void WorkbookFragment::finalizeImport() /* Create fragments for all sheets, before importing them. Needed to do some preprocessing in the fragment constructors, e.g. loading the table fragments for all sheets that are needed before the cell formulas are - loaded. */ - typedef ::std::vector< FragmentHandlerRef > SheetFragmentVector; + loaded. Additionally, the instances of the WorkbookGlobals structures + have to be stored for every sheet. */ + typedef ::std::pair< WorksheetGlobalsRef, FragmentHandlerRef > SheetFragmentHandler; + typedef ::std::vector< SheetFragmentHandler > SheetFragmentVector; SheetFragmentVector aSheetFragments; WorksheetBuffer& rWorksheets = getWorksheets(); sal_Int32 nWorksheetCount = rWorksheets.getWorksheetCount(); @@ -238,34 +240,49 @@ void WorkbookFragment::finalizeImport() OSL_ENSURE( aFragmentPath.getLength() > 0, "WorkbookFragment::finalizeImport - cannot access sheet fragment" ); if( aFragmentPath.getLength() > 0 ) { - ::rtl::Reference< WorksheetFragmentBase > xFragment; double fSegmentLength = getProgressBar().getFreeLength() / (nWorksheetCount - nWorksheet); ISegmentProgressBarRef xSheetSegment = getProgressBar().createSegment( fSegmentLength ); - // create the fragment according to the sheet type + // get the sheet type according to the relations type + WorksheetType eSheetType = SHEETTYPE_EMPTYSHEET; if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "worksheet" ) ) - { - xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_WORKSHEET, nCalcSheet ) ); - } + eSheetType = SHEETTYPE_WORKSHEET; else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "chartsheet" ) ) - { - xFragment.set( new ChartsheetFragment( *this, aFragmentPath, xSheetSegment, nCalcSheet ) ); - } + eSheetType = SHEETTYPE_CHARTSHEET; else if( (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlMacrosheet" )) || (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlIntlMacrosheet" )) ) - { - xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_MACROSHEET, nCalcSheet ) ); - } + eSheetType = SHEETTYPE_MACROSHEET; else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "dialogsheet" ) ) + eSheetType = SHEETTYPE_DIALOGSHEET; + OSL_ENSURE( eSheetType != SHEETTYPE_EMPTYSHEET, "WorkbookFragment::finalizeImport - unknown sheet type" ); + if( eSheetType != SHEETTYPE_EMPTYSHEET ) { - xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_DIALOGSHEET, nCalcSheet ) ); + // create the WorksheetGlobals object + WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetSegment, eSheetType, nCalcSheet ); + OSL_ENSURE( xSheetGlob.get(), "WorkbookFragment::finalizeImport - missing sheet in document" ); + if( xSheetGlob.get() ) + { + // create the sheet fragment handler + ::rtl::Reference< WorksheetFragmentBase > xFragment; + switch( eSheetType ) + { + case SHEETTYPE_WORKSHEET: + case SHEETTYPE_MACROSHEET: + case SHEETTYPE_DIALOGSHEET: + xFragment.set( new WorksheetFragment( *xSheetGlob, aFragmentPath ) ); + break; + case SHEETTYPE_CHARTSHEET: + xFragment.set( new ChartsheetFragment( *xSheetGlob, aFragmentPath ) ); + break; + default: + OSL_ENSURE( false, "WorkbookFragment::finalizeImport - unexpected sheet type" ); + } + + // insert the fragment into the map + if( xFragment.is() ) + aSheetFragments.push_back( SheetFragmentHandler( xSheetGlob, xFragment.get() ) ); + } } - - // insert the fragment into the map - OSL_ENSURE( xFragment.is(), "WorkbookFragment::finalizeImport - unknown sheet type" ); - OSL_ENSURE( !xFragment.is() || xFragment->isValidSheet(), "WorkbookFragment::finalizeImport - missing sheet in document" ); - if( xFragment.is() && xFragment->isValidSheet() ) - aSheetFragments.push_back( xFragment.get() ); } } } @@ -278,9 +295,10 @@ void WorkbookFragment::finalizeImport() for( SheetFragmentVector::iterator aIt = aSheetFragments.begin(), aEnd = aSheetFragments.end(); aIt != aEnd; ++aIt ) { // import the sheet fragment - importOoxFragment( *aIt ); - // delete fragment object, will free all allocated sheet buffers - aIt->clear(); + importOoxFragment( aIt->second ); + // delete fragment object and WorkbookGlobals object, will free all allocated sheet buffers + aIt->second.clear(); + aIt->first.reset(); } // open the VBA project storage @@ -715,26 +733,32 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa break; } - // create the worksheet fragment + // create the WorksheetGlobals object ISegmentProgressBarRef xSheetProgress = rProgressBar.createSegment( rProgressBar.getFreeLength() ); + WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetProgress, eSheetType, nCalcSheet ); + OSL_ENSURE( xSheetGlob.get(), "BiffWorkbookFragment::importSheetFragment - missing sheet in document" ); + if( !xSheetGlob.get() ) + return false; + + // create the worksheet fragment ::boost::shared_ptr< BiffWorksheetFragmentBase > xFragment; switch( eSheetType ) { case SHEETTYPE_WORKSHEET: case SHEETTYPE_MACROSHEET: case SHEETTYPE_DIALOGSHEET: - xFragment.reset( new BiffWorksheetFragment( *this, xSheetProgress, eSheetType, nCalcSheet ) ); + xFragment.reset( new BiffWorksheetFragment( *xSheetGlob, *this ) ); break; case SHEETTYPE_CHARTSHEET: - xFragment.reset( new BiffChartsheetFragment( *this, xSheetProgress, nCalcSheet ) ); + xFragment.reset( new BiffChartsheetFragment( *xSheetGlob, *this ) ); break; case SHEETTYPE_MODULESHEET: case SHEETTYPE_EMPTYSHEET: - xFragment.reset( new BiffSkipWorksheetFragment( *this, xSheetProgress, nCalcSheet ) ); + xFragment.reset( new BiffSkipWorksheetFragment( *xSheetGlob, *this ) ); break; } // load the sheet fragment records - return xFragment->isValidSheet() && xFragment->importFragment(); + return xFragment.get() && xFragment->importFragment(); } // ============================================================================ diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx index 6adb7957d4b8..a06001ca3971 100644 --- a/oox/source/xls/workbookhelper.cxx +++ b/oox/source/xls/workbookhelper.cxx @@ -98,12 +98,12 @@ bool IgnoreCaseCompare::operator()( const OUString& rName1, const OUString& rNam // ============================================================================ -class WorkbookData +class WorkbookGlobals { public: - explicit WorkbookData( ExcelFilter& rFilter ); - explicit WorkbookData( ExcelBiffFilter& rFilter, BiffType eBiff ); - ~WorkbookData(); + explicit WorkbookGlobals( ExcelFilter& rFilter ); + explicit WorkbookGlobals( ExcelBiffFilter& rFilter, BiffType eBiff ); + ~WorkbookGlobals(); /** Returns true, if this helper refers to a valid document. */ inline bool isValid() const { return mxDoc.is(); } @@ -118,14 +118,15 @@ public: inline FilterType getFilterType() const { return meFilterType; } /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */ inline bool isWorkbookFile() const { return mbWorkbook; } - /** Returns the index of the current sheet in the Calc document. */ - inline sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; } - /** Sets the index of the current sheet in the Calc document. */ - inline void setCurrentSheetIndex( sal_Int16 nSheet ) { mnCurrSheet = nSheet; } /** Returns the VBA project storage. */ inline StorageRef getVbaProjectStorage() const { return mxVbaPrjStrg; } - /** Sets the VBA project storage. */ + /** Returns the index of the current Calc sheet, if filter currently processes a sheet. */ + inline sal_Int16 getCurrentSheetIndex() const { return mnCurrSheet; } + + /** Sets the VBA project storage used to import VBA source code and forms. */ inline void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { mxVbaPrjStrg = rxVbaPrjStrg; } + /** Sets the index of the current Calc sheet, if filter currently processes a sheet. */ + inline void setCurrentSheetIndex( sal_Int16 nSheet ) { mnCurrSheet = nSheet; } // document model --------------------------------------------------------- @@ -286,7 +287,7 @@ private: // ---------------------------------------------------------------------------- -WorkbookData::WorkbookData( ExcelFilter& rFilter ) : +WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) : mrBaseFilter( rFilter ), mrExcelBase( rFilter ), meFilterType( FILTER_OOXML ), @@ -295,11 +296,11 @@ WorkbookData::WorkbookData( ExcelFilter& rFilter ) : meBiff( BIFF_UNKNOWN ) { // register at the filter, needed for virtual callbacks (even during construction) - mrExcelBase.registerWorkbookData( *this ); + mrExcelBase.registerWorkbookGlobals( *this ); initialize( true ); } -WorkbookData::WorkbookData( ExcelBiffFilter& rFilter, BiffType eBiff ) : +WorkbookGlobals::WorkbookGlobals( ExcelBiffFilter& rFilter, BiffType eBiff ) : mrBaseFilter( rFilter ), mrExcelBase( rFilter ), meFilterType( FILTER_BIFF ), @@ -308,19 +309,19 @@ WorkbookData::WorkbookData( ExcelBiffFilter& rFilter, BiffType eBiff ) : meBiff( eBiff ) { // register at the filter, needed for virtual callbacks (even during construction) - mrExcelBase.registerWorkbookData( *this ); + mrExcelBase.registerWorkbookGlobals( *this ); initialize( eBiff >= BIFF5 ); } -WorkbookData::~WorkbookData() +WorkbookGlobals::~WorkbookGlobals() { finalize(); - mrExcelBase.unregisterWorkbookData(); + mrExcelBase.unregisterWorkbookGlobals(); } // document model ------------------------------------------------------------- -Reference< XNameContainer > WorkbookData::getStyleFamily( bool bPageStyles ) const +Reference< XNameContainer > WorkbookGlobals::getStyleFamily( bool bPageStyles ) const { Reference< XNameContainer > xStylesNC; try @@ -332,11 +333,11 @@ Reference< XNameContainer > WorkbookData::getStyleFamily( bool bPageStyles ) con catch( Exception& ) { } - OSL_ENSURE( xStylesNC.is(), "WorkbookData::getStyleFamily - cannot access style family" ); + OSL_ENSURE( xStylesNC.is(), "WorkbookGlobals::getStyleFamily - cannot access style family" ); return xStylesNC; } -Reference< XStyle > WorkbookData::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const +Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const { Reference< XStyle > xStyle; try @@ -347,11 +348,11 @@ Reference< XStyle > WorkbookData::getStyleObject( const OUString& rStyleName, bo catch( Exception& ) { } - OSL_ENSURE( xStyle.is(), "WorkbookData::getStyleObject - cannot access style object" ); + OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" ); return xStyle; } -Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const +Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const { // create the name and insert it into the Calc document Reference< XNamedRange > xNamedRange; @@ -369,11 +370,11 @@ Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName, catch( Exception& ) { } - OSL_ENSURE( xNamedRange.is(), "WorkbookData::createNamedRangeObject - cannot create defined name" ); + OSL_ENSURE( xNamedRange.is(), "WorkbookGlobals::createNamedRangeObject - cannot create defined name" ); return xNamedRange; } -Reference< XDatabaseRange > WorkbookData::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const +Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const { // validate cell range CellRangeAddress aDestRange = rRangeAddr; @@ -395,11 +396,11 @@ Reference< XDatabaseRange > WorkbookData::createDatabaseRangeObject( OUString& o catch( Exception& ) { } - OSL_ENSURE( xDatabaseRange.is(), "WorkbookData::createDatabaseRangeObject - cannot create database range" ); + OSL_ENSURE( xDatabaseRange.is(), "WorkbookGlobals::createDatabaseRangeObject - cannot create database range" ); return xDatabaseRange; } -Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool bPageStyle ) const +Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, bool bPageStyle ) const { Reference< XStyle > xStyle; try @@ -411,63 +412,62 @@ Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool catch( Exception& ) { } - OSL_ENSURE( xStyle.is(), "WorkbookData::createStyleObject - cannot create style" ); + OSL_ENSURE( xStyle.is(), "WorkbookGlobals::createStyleObject - cannot create style" ); return xStyle; } // BIFF specific -------------------------------------------------------------- -void WorkbookData::setTextEncoding( rtl_TextEncoding eTextEnc ) +void WorkbookGlobals::setTextEncoding( rtl_TextEncoding eTextEnc ) { if( eTextEnc != RTL_TEXTENCODING_DONTKNOW ) meTextEnc = eTextEnc; } -void WorkbookData::setCodePage( sal_uInt16 nCodePage ) +void WorkbookGlobals::setCodePage( sal_uInt16 nCodePage ) { setTextEncoding( BiffHelper::calcTextEncodingFromCodePage( nCodePage ) ); mbHasCodePage = true; } -void WorkbookData::setAppFontEncoding( rtl_TextEncoding eAppFontEnc ) +void WorkbookGlobals::setAppFontEncoding( rtl_TextEncoding eAppFontEnc ) { if( !mbHasCodePage ) setTextEncoding( eAppFontEnc ); } -void WorkbookData::setIsWorkbookFile() +void WorkbookGlobals::setIsWorkbookFile() { - OSL_ENSURE( meBiff == BIFF4, "WorkbookData::setIsWorkbookFile - invalid call" ); + OSL_ENSURE( meBiff == BIFF4, "WorkbookGlobals::setIsWorkbookFile - invalid call" ); mbWorkbook = true; } -void WorkbookData::createBuffersPerSheet( sal_Int16 nSheet ) +void WorkbookGlobals::createBuffersPerSheet( sal_Int16 nSheet ) { - // set mnCurrSheet to enable usage of WorkbookHelper::getCurrentSheetIndex() - mnCurrSheet = nSheet; switch( meBiff ) { case BIFF2: case BIFF3: - OSL_ENSURE( mnCurrSheet == 0, "WorkbookData::createBuffersPerSheet - unexpected sheet index" ); - mxDefNames->setLocalCalcSheet( mnCurrSheet ); + OSL_ENSURE( nSheet == 0, "WorkbookGlobals::createBuffersPerSheet - unexpected sheet index" ); + mxDefNames->setLocalCalcSheet( nSheet ); break; case BIFF4: - OSL_ENSURE( mbWorkbook || (mnCurrSheet == 0), "WorkbookData::createBuffersPerSheet - unexpected sheet index" ); + OSL_ENSURE( mbWorkbook || (nSheet == 0), "WorkbookGlobals::createBuffersPerSheet - unexpected sheet index" ); // #i11183# sheets in BIFF4W files have own styles and names - if( mbWorkbook && (mnCurrSheet > 0) ) + if( nSheet > 0 ) { mxStyles.reset( new StylesBuffer( *this ) ); mxDefNames.reset( new DefinedNamesBuffer( *this ) ); mxExtLinks.reset( new ExternalLinkBuffer( *this ) ); } - mxDefNames->setLocalCalcSheet( mnCurrSheet ); + mxDefNames->setLocalCalcSheet( nSheet ); break; case BIFF5: // BIFF5 stores external references per sheet - mxExtLinks.reset( new ExternalLinkBuffer( *this ) ); + if( nSheet > 0 ) + mxExtLinks.reset( new ExternalLinkBuffer( *this ) ); break; case BIFF8: @@ -476,12 +476,11 @@ void WorkbookData::createBuffersPerSheet( sal_Int16 nSheet ) case BIFF_UNKNOWN: break; } - mnCurrSheet = -1; } // private -------------------------------------------------------------------- -void WorkbookData::initialize( bool bWorkbookFile ) +void WorkbookGlobals::initialize( bool bWorkbookFile ) { maCellStyles = CREATE_OUSTRING( "CellStyles" ); maPageStyles = CREATE_OUSTRING( "PageStyles" ); @@ -494,7 +493,7 @@ void WorkbookData::initialize( bool bWorkbookFile ) // the spreadsheet document mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY ); - OSL_ENSURE( mxDoc.is(), "WorkbookData::initialize - no spreadsheet document" ); + OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" ); mxWorkbookSettings.reset( new WorkbookSettings( *this ) ); mxViewSettings.reset( new ViewSettings( *this ) ); @@ -557,7 +556,7 @@ void WorkbookData::initialize( bool bWorkbookFile ) } } -void WorkbookData::finalize() +void WorkbookGlobals::finalize() { // set some document properties needed after import if( mrBaseFilter.isImportFilter() ) @@ -588,57 +587,73 @@ WorkbookHelper::~WorkbookHelper() { } +/*static*/ WorkbookGlobalsRef WorkbookHelper::constructGlobals( ExcelFilter& rFilter ) +{ + WorkbookGlobalsRef xBookGlob( new WorkbookGlobals( rFilter ) ); + if( !xBookGlob->isValid() ) + xBookGlob.reset(); + return xBookGlob; +} + +/*static*/ WorkbookGlobalsRef WorkbookHelper::constructGlobals( ExcelBiffFilter& rFilter, BiffType eBiff ) +{ + WorkbookGlobalsRef xBookGlob( new WorkbookGlobals( rFilter, eBiff ) ); + if( !xBookGlob->isValid() ) + xBookGlob.reset(); + return xBookGlob; +} + // filter --------------------------------------------------------------------- FilterBase& WorkbookHelper::getBaseFilter() const { - return mrBookData.getBaseFilter(); + return mrBookGlob.getBaseFilter(); } FilterType WorkbookHelper::getFilterType() const { - return mrBookData.getFilterType(); + return mrBookGlob.getFilterType(); } SegmentProgressBar& WorkbookHelper::getProgressBar() const { - return mrBookData.getProgressBar(); + return mrBookGlob.getProgressBar(); } bool WorkbookHelper::isWorkbookFile() const { - return mrBookData.isWorkbookFile(); + return mrBookGlob.isWorkbookFile(); } sal_Int16 WorkbookHelper::getCurrentSheetIndex() const { - return mrBookData.getCurrentSheetIndex(); + return mrBookGlob.getCurrentSheetIndex(); } -void WorkbookHelper::setCurrentSheetIndex( sal_Int16 nSheet ) +void WorkbookHelper::setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) { - mrBookData.setCurrentSheetIndex( nSheet ); + mrBookGlob.setVbaProjectStorage( rxVbaPrjStrg ); } -void WorkbookHelper::setVbaProjectStorage( const StorageRef& rxVbaPrjStrg ) +void WorkbookHelper::setCurrentSheetIndex( sal_Int16 nSheet ) { - mrBookData.setVbaProjectStorage( rxVbaPrjStrg ); + mrBookGlob.setCurrentSheetIndex( nSheet ); } void WorkbookHelper::finalizeWorkbookImport() { // workbook settings, document and sheet view settings - mrBookData.getWorkbookSettings().finalizeImport(); - mrBookData.getViewSettings().finalizeImport(); + mrBookGlob.getWorkbookSettings().finalizeImport(); + mrBookGlob.getViewSettings().finalizeImport(); /* Insert all pivot tables. Must be done after loading all sheets, because data pilots expect existing source data on creation. */ - mrBookData.getPivotTables().finalizeImport(); + mrBookGlob.getPivotTables().finalizeImport(); /* Insert scenarios after all sheet processing is done, because new hidden sheets are created for scenarios which would confuse code that relies on certain sheet indexes. Must be done after pivot tables too. */ - mrBookData.getScenarios().finalizeImport(); + mrBookGlob.getScenarios().finalizeImport(); /* Set 'Default' page style to automatic page numbering (default is manual number 1). Otherwise hidden sheets (e.g. for scenarios) which have @@ -649,7 +664,7 @@ void WorkbookHelper::finalizeWorkbookImport() /* Import the VBA project (after finalizing workbook settings which contains the workbook code name). */ - StorageRef xVbaPrjStrg = mrBookData.getVbaProjectStorage(); + StorageRef xVbaPrjStrg = mrBookGlob.getVbaProjectStorage(); if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() ) getBaseFilter().getVbaProject().importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() ); } @@ -658,7 +673,7 @@ void WorkbookHelper::finalizeWorkbookImport() Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const { - return mrBookData.getDocument(); + return mrBookGlob.getDocument(); } Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int16 nSheet ) const @@ -719,129 +734,129 @@ Reference< XCellRange > WorkbookHelper::getCellRangeFromDoc( const CellRangeAddr Reference< XNameContainer > WorkbookHelper::getStyleFamily( bool bPageStyles ) const { - return mrBookData.getStyleFamily( bPageStyles ); + return mrBookGlob.getStyleFamily( bPageStyles ); } Reference< XStyle > WorkbookHelper::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const { - return mrBookData.getStyleObject( rStyleName, bPageStyle ); + return mrBookGlob.getStyleObject( rStyleName, bPageStyle ); } Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const { - return mrBookData.createNamedRangeObject( orName, nNameFlags ); + return mrBookGlob.createNamedRangeObject( orName, nNameFlags ); } Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const { - return mrBookData.createDatabaseRangeObject( orName, rRangeAddr ); + return mrBookGlob.createDatabaseRangeObject( orName, rRangeAddr ); } Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const { - return mrBookData.createStyleObject( orStyleName, bPageStyle ); + return mrBookGlob.createStyleObject( orStyleName, bPageStyle ); } // buffers -------------------------------------------------------------------- WorkbookSettings& WorkbookHelper::getWorkbookSettings() const { - return mrBookData.getWorkbookSettings(); + return mrBookGlob.getWorkbookSettings(); } ViewSettings& WorkbookHelper::getViewSettings() const { - return mrBookData.getViewSettings(); + return mrBookGlob.getViewSettings(); } WorksheetBuffer& WorkbookHelper::getWorksheets() const { - return mrBookData.getWorksheets(); + return mrBookGlob.getWorksheets(); } ThemeBuffer& WorkbookHelper::getTheme() const { - return mrBookData.getTheme(); + return mrBookGlob.getTheme(); } StylesBuffer& WorkbookHelper::getStyles() const { - return mrBookData.getStyles(); + return mrBookGlob.getStyles(); } SharedStringsBuffer& WorkbookHelper::getSharedStrings() const { - return mrBookData.getSharedStrings(); + return mrBookGlob.getSharedStrings(); } ExternalLinkBuffer& WorkbookHelper::getExternalLinks() const { - return mrBookData.getExternalLinks(); + return mrBookGlob.getExternalLinks(); } DefinedNamesBuffer& WorkbookHelper::getDefinedNames() const { - return mrBookData.getDefinedNames(); + return mrBookGlob.getDefinedNames(); } TableBuffer& WorkbookHelper::getTables() const { - return mrBookData.getTables(); + return mrBookGlob.getTables(); } ScenarioBuffer& WorkbookHelper::getScenarios() const { - return mrBookData.getScenarios(); + return mrBookGlob.getScenarios(); } ConnectionsBuffer& WorkbookHelper::getConnections() const { - return mrBookData.getConnections(); + return mrBookGlob.getConnections(); } PivotCacheBuffer& WorkbookHelper::getPivotCaches() const { - return mrBookData.getPivotCaches(); + return mrBookGlob.getPivotCaches(); } PivotTableBuffer& WorkbookHelper::getPivotTables() const { - return mrBookData.getPivotTables(); + return mrBookGlob.getPivotTables(); } // converters ----------------------------------------------------------------- FormulaParser& WorkbookHelper::getFormulaParser() const { - return mrBookData.getFormulaParser(); + return mrBookGlob.getFormulaParser(); } UnitConverter& WorkbookHelper::getUnitConverter() const { - return mrBookData.getUnitConverter(); + return mrBookGlob.getUnitConverter(); } AddressConverter& WorkbookHelper::getAddressConverter() const { - return mrBookData.getAddressConverter(); + return mrBookGlob.getAddressConverter(); } ExcelChartConverter& WorkbookHelper::getChartConverter() const { - return mrBookData.getChartConverter(); + return mrBookGlob.getChartConverter(); } PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const { - return mrBookData.getPageSettingsConverter(); + return mrBookGlob.getPageSettingsConverter(); } // OOXML/BIFF12 specific ------------------------------------------------------ XmlFilterBase& WorkbookHelper::getOoxFilter() const { - OSL_ENSURE( mrBookData.getFilterType() == FILTER_OOXML, "WorkbookHelper::getOoxFilter - invalid call" ); - return mrBookData.getOoxFilter(); + OSL_ENSURE( mrBookGlob.getFilterType() == FILTER_OOXML, "WorkbookHelper::getOoxFilter - invalid call" ); + return mrBookGlob.getOoxFilter(); } bool WorkbookHelper::importOoxFragment( const ::rtl::Reference< FragmentHandler >& rxHandler ) @@ -853,82 +868,48 @@ bool WorkbookHelper::importOoxFragment( const ::rtl::Reference< FragmentHandler BinaryFilterBase& WorkbookHelper::getBiffFilter() const { - OSL_ENSURE( mrBookData.getFilterType() == FILTER_BIFF, "WorkbookHelper::getBiffFilter - invalid call" ); - return mrBookData.getBiffFilter(); + OSL_ENSURE( mrBookGlob.getFilterType() == FILTER_BIFF, "WorkbookHelper::getBiffFilter - invalid call" ); + return mrBookGlob.getBiffFilter(); } BiffType WorkbookHelper::getBiff() const { - return mrBookData.getBiff(); + return mrBookGlob.getBiff(); } rtl_TextEncoding WorkbookHelper::getTextEncoding() const { - return mrBookData.getTextEncoding(); + return mrBookGlob.getTextEncoding(); } void WorkbookHelper::setTextEncoding( rtl_TextEncoding eTextEnc ) { - mrBookData.setTextEncoding( eTextEnc ); + mrBookGlob.setTextEncoding( eTextEnc ); } void WorkbookHelper::setCodePage( sal_uInt16 nCodePage ) { - mrBookData.setCodePage( nCodePage ); + mrBookGlob.setCodePage( nCodePage ); } void WorkbookHelper::setAppFontEncoding( rtl_TextEncoding eAppFontEnc ) { - mrBookData.setAppFontEncoding( eAppFontEnc ); + mrBookGlob.setAppFontEncoding( eAppFontEnc ); } void WorkbookHelper::setIsWorkbookFile() { - mrBookData.setIsWorkbookFile(); + mrBookGlob.setIsWorkbookFile(); } void WorkbookHelper::createBuffersPerSheet( sal_Int16 nSheet ) { - mrBookData.createBuffersPerSheet( nSheet ); + mrBookGlob.createBuffersPerSheet( nSheet ); } BiffCodecHelper& WorkbookHelper::getCodecHelper() const { - return mrBookData.getCodecHelper(); -} - -// ============================================================================ - -namespace prv { - -WorkbookDataOwner::WorkbookDataOwner( WorkbookDataRef xBookData ) : - mxBookData( xBookData ) -{ -} - -WorkbookDataOwner::~WorkbookDataOwner() -{ -} - -} // namespace prv - -// ---------------------------------------------------------------------------- - -WorkbookHelperRoot::WorkbookHelperRoot( ExcelFilter& rFilter ) : - prv::WorkbookDataOwner( prv::WorkbookDataRef( new WorkbookData( rFilter ) ) ), - WorkbookHelper( *mxBookData ) -{ -} - -WorkbookHelperRoot::WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff ) : - prv::WorkbookDataOwner( prv::WorkbookDataRef( new WorkbookData( rFilter, eBiff ) ) ), - WorkbookHelper( *mxBookData ) -{ -} - -bool WorkbookHelperRoot::isValid() const -{ - return mxBookData->isValid(); + return mrBookGlob.getCodecHelper(); } // ============================================================================ diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index 77f0c1072706..387aef608339 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -44,6 +44,7 @@ #include "oox/xls/querytablefragment.hxx" #include "oox/xls/scenariobuffer.hxx" #include "oox/xls/scenariocontext.hxx" +#include "oox/xls/sheetdatabuffer.hxx" #include "oox/xls/sheetdatacontext.hxx" #include "oox/xls/tablefragment.hxx" #include "oox/xls/viewsettings.hxx" @@ -124,32 +125,18 @@ ContextHandlerRef DataValidationsContext::onCreateContext( sal_Int32 nElement, c return 0; } -namespace { - -ApiTokenSequence lclImportDataValFormula( FormulaParser& rParser, const OUString& rFormula, const CellAddress& rBaseAddress ) -{ - TokensFormulaContext aContext( true, false ); - aContext.setBaseAddress( rBaseAddress ); - rParser.importFormula( aContext, rFormula ); - return aContext.getTokens(); -} - -} // namespace - void DataValidationsContext::onCharacters( const OUString& rChars ) { if( mxValModel.get() ) switch( getCurrentElement() ) { case XLS_TOKEN( formula1 ): - mxValModel->maTokens1 = lclImportDataValFormula( - getFormulaParser(), rChars, mxValModel->maRanges.getBaseAddress() ); + mxValModel->maTokens1 = getFormulaParser().importFormula( mxValModel->maRanges.getBaseAddress(), rChars ); // process string list of a list validation (convert to list of string tokens) if( mxValModel->mnType == XML_list ) getFormulaParser().convertStringToStringList( mxValModel->maTokens1, ',', true ); break; case XLS_TOKEN( formula2 ): - mxValModel->maTokens2 = lclImportDataValFormula( - getFormulaParser(), rChars, mxValModel->maRanges.getBaseAddress() ); + mxValModel->maTokens2 = getFormulaParser().importFormula( mxValModel->maRanges.getBaseAddress(), rChars ); break; } } @@ -213,12 +200,9 @@ void DataValidationsContext::importDataValidation( SequenceInputStream& rStrm ) // condition formula(s) FormulaParser& rParser = getFormulaParser(); - TokensFormulaContext aContext( true, false ); - aContext.setBaseAddress( aModel.maRanges.getBaseAddress() ); - rParser.importFormula( aContext, rStrm ); - aModel.maTokens1 = aContext.getTokens(); - rParser.importFormula( aContext, rStrm ); - aModel.maTokens2 = aContext.getTokens(); + CellAddress aBaseAddr = aModel.maRanges.getBaseAddress(); + aModel.maTokens1 = rParser.importFormula( aBaseAddr, FORMULATYPE_VALIDATION, rStrm ); + aModel.maTokens2 = rParser.importFormula( aBaseAddr, FORMULATYPE_VALIDATION, rStrm ); // process string list of a list validation (convert to list of string tokens) if( (aModel.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) ) rParser.convertStringToStringList( aModel.maTokens1, ',', true ); @@ -229,9 +213,8 @@ void DataValidationsContext::importDataValidation( SequenceInputStream& rStrm ) // ============================================================================ -WorksheetFragment::WorksheetFragment( const WorkbookHelper& rHelper, - const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - WorksheetFragmentBase( rHelper, rFragmentPath, rxProgressBar, eSheetType, nSheet ) +WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : + WorksheetFragmentBase( rHelper, rFragmentPath ) { // import data tables related to this worksheet RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "table" ) ); @@ -558,7 +541,7 @@ void WorksheetFragment::importMergeCell( const AttributeList& rAttribs ) { CellRangeAddress aRange; if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) ) - setMergedRange( aRange ); + getSheetData().setMergedRange( aRange ); } void WorksheetFragment::importHyperlink( const AttributeList& rAttribs ) @@ -682,7 +665,7 @@ void WorksheetFragment::importMergeCell( SequenceInputStream& rStrm ) rStrm >> aBinRange; CellRangeAddress aRange; if( getAddressConverter().convertToCellRange( aRange, aBinRange, getSheetIndex(), true, true ) ) - setMergedRange( aRange ); + getSheetData().setMergedRange( aRange ); } void WorksheetFragment::importHyperlink( SequenceInputStream& rStrm ) @@ -753,9 +736,8 @@ void WorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedDat // ============================================================================ -BiffWorksheetFragment::BiffWorksheetFragment( const BiffWorkbookFragmentBase& rParent, - const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - BiffWorksheetFragmentBase( rParent, rxProgressBar, eSheetType, nSheet ) +BiffWorksheetFragment::BiffWorksheetFragment( const WorksheetHelper& rHelper, const BiffWorkbookFragmentBase& rParent ) : + BiffWorksheetFragmentBase( rHelper, rParent ) { } @@ -1047,10 +1029,7 @@ ApiTokenSequence lclReadDataValFormula( BiffInputStream& rStrm, FormulaParser& r { sal_uInt16 nFmlaSize = rStrm.readuInt16(); rStrm.skip( 2 ); - // enable NUL characters, string list is single tStr token with NUL separators - TokensFormulaContext aContext( true, false, true ); - rParser.importFormula( aContext, rStrm, &nFmlaSize ); - return aContext.getTokens(); + return rParser.importFormula( CellAddress(), FORMULATYPE_VALIDATION, rStrm, &nFmlaSize ); } } // namespace @@ -1169,7 +1148,7 @@ void BiffWorksheetFragment::importMergedCells( BiffInputStream& rStrm ) ApiCellRangeList aRanges; getAddressConverter().convertToCellRangeList( aRanges, aBiffRanges, getSheetIndex(), true ); for( ApiCellRangeList::const_iterator aIt = aRanges.begin(), aEnd = aRanges.end(); aIt != aEnd; ++aIt ) - setMergedRange( *aIt ); + getSheetData().setMergedRange( *aIt ); } void BiffWorksheetFragment::importNote( BiffInputStream& rStrm ) diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 00f65f90294f..778adcff24ab 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -50,10 +49,6 @@ #include #include #include -#include -#include -#include -#include #include #include "oox/core/filterbase.hxx" #include "oox/helper/containerhelper.hxx" @@ -67,8 +62,8 @@ #include "oox/xls/formulaparser.hxx" #include "oox/xls/pagesettings.hxx" #include "oox/xls/querytablebuffer.hxx" -#include "oox/xls/sharedformulabuffer.hxx" #include "oox/xls/sharedstringsbuffer.hxx" +#include "oox/xls/sheetdatabuffer.hxx" #include "oox/xls/stylesbuffer.hxx" #include "oox/xls/unitconverter.hxx" #include "oox/xls/viewsettings.hxx" @@ -192,10 +187,10 @@ void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal void CellModel::reset() { mxCell.clear(); - maValueStr = maFormulaRef = OUString(); + maValue = maFormula = maFormulaRef = OUString(); mnCellType = mnFormulaType = XML_TOKEN_INVALID; mnSharedId = mnXfId = mnNumFmtId = -1; - mbHasValueStr = mbShowPhonetic = false; + mbShowPhonetic = false; } // ---------------------------------------------------------------------------- @@ -324,10 +319,10 @@ void ValidationModel::setBiffErrorStyle( sal_uInt8 nErrorStyle ) // ============================================================================ // ============================================================================ -class WorksheetData : public WorkbookHelper +class WorksheetGlobals : public WorkbookHelper { public: - explicit WorksheetData( + explicit WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, @@ -336,16 +331,12 @@ public: /** Returns true, if this helper refers to an existing Calc sheet. */ inline bool isValidSheet() const { return mxSheet.is(); } - /** Returns a cell formula simulating the passed boolean value. */ - const OUString& getBooleanFormula( bool bValue ) const; - /** Returns the type of this sheet. */ inline WorksheetType getSheetType() const { return meSheetType; } /** Returns the index of the current sheet. */ inline sal_Int16 getSheetIndex() const { return maUsedArea.Sheet; } /** Returns the XSpreadsheet interface of the current sheet. */ - inline const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& - getSheet() const { return mxSheet; } + inline const Reference< XSpreadsheet >& getSheet() const { return mxSheet; } /** Returns the XCell interface for the passed cell address. */ Reference< XCell > getCell( const CellAddress& rAddress ) const; @@ -379,10 +370,8 @@ public: /** Returns the cell range address that contains the passed rectangle in 1/100 mm. */ CellRangeAddress getCellRangeFromRectangle( const Rectangle& rRect ) const; - /** Returns the worksheet settings object. */ - inline WorksheetSettings& getWorksheetSettings() { return maSheetSett; } - /** Returns the buffer containing all shared formulas in this sheet. */ - inline SharedFormulaBuffer& getSharedFormulas() { return maSharedFmlas; } + /** Returns the buffer for cell contents and cell formatting. */ + inline SheetDataBuffer& getSheetData() { return maSheetData; } /** Returns the conditional formattings in this sheet. */ inline CondFormatBuffer& getCondFormats() { return maCondFormats; } /** Returns the buffer for all cell comments in this sheet. */ @@ -391,6 +380,8 @@ public: inline AutoFilterBuffer& getAutoFilters() { return maAutoFilters; } /** Returns the buffer for all web query tables in this sheet. */ inline QueryTableBuffer& getQueryTables() { return maQueryTables; } + /** Returns the worksheet settings object. */ + inline WorksheetSettings& getWorksheetSettings() { return maSheetSett; } /** Returns the page/print settings for this sheet. */ inline PageSettings& getPageSettings() { return maPageSett; } /** Returns the view settings for this sheet. */ @@ -402,10 +393,6 @@ public: /** Changes the current sheet type. */ inline void setSheetType( WorksheetType eSheetType ) { meSheetType = eSheetType; } - /** Stores the cell format at the passed address. */ - void setCellFormat( const CellModel& rModel ); - /** Merges the cells in the passed cell range. */ - void setMergedRange( const CellRangeAddress& rRange ); /** Sets a column or row page break described in the passed struct. */ void setPageBreak( const PageBreakModel& rModel, bool bRowBreak ); /** Inserts the hyperlink URL into the spreadsheet. */ @@ -434,6 +421,8 @@ public: @descr Column default formatting is converted directly, other settings are cached and converted in the finalizeImport() call. */ void setColumnModel( const ColumnModel& rModel ); + /** Converts column default cell formatting. */ + void convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const; /** Sets default height and hidden state for all unused rows in the sheet. */ void setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom ); @@ -441,11 +430,8 @@ public: @descr Row default formatting is converted directly, other settings are cached and converted in the finalizeImport() call. */ void setRowModel( const RowModel& rModel ); - - /** Converts column default cell formatting. */ - void convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const; - /** Converts row default cell formatting. */ - void convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) const; + /** Specifies that the passed row needs to set its height manually. */ + void setManualRowHeight( sal_Int32 nRow ); /** Initial conversion before importing the worksheet. */ void initializeWorksheetImport(); @@ -459,52 +445,6 @@ private: typedef ::std::list< HyperlinkModel > HyperlinkModelList; typedef ::std::list< ValidationModel > ValidationModelList; - struct XfIdRowRange - { - sal_Int32 mnFirstRow; /// Index of first row. - sal_Int32 mnLastRow; /// Index of last row. - sal_Int32 mnXfId; /// XF identifier for the row range. - - explicit XfIdRowRange(); - bool intersects( const CellRangeAddress& rRange ) const; - void set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); - bool tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); - }; - - struct XfIdRange - { - CellRangeAddress maRange; /// The formatted cell range. - sal_Int32 mnXfId; /// XF identifier for the range. - sal_Int32 mnNumFmtId; /// Number format id overriding the XF. - - void set( const CellModel& rModel ); - bool tryExpand( const CellModel& rModel ); - bool tryMerge( const XfIdRange& rXfIdRange ); - }; - - struct MergedRange - { - CellRangeAddress maRange; /// The formatted cell range. - sal_Int32 mnHorAlign; /// Horizontal alignment in the range. - - explicit MergedRange( const CellRangeAddress& rRange ); - explicit MergedRange( const CellAddress& rAddress, sal_Int32 nHorAlign ); - bool tryExpand( const CellAddress& rAddress, sal_Int32 nHorAlign ); - }; - - typedef ::std::pair< sal_Int32, sal_Int32 > RowColKey; - typedef ::std::map< RowColKey, XfIdRange > XfIdRangeMap; - typedef ::std::list< MergedRange > MergedRangeList; - - /** Writes all cell formatting attributes to the passed row range. */ - void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const; - /** Writes all cell formatting attributes to the passed cell range. */ - void writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const; - /** Tries to merge the ranges last inserted in maXfIdRanges with existing ranges. */ - void mergeXfIdRanges(); - /** Finalizes the remaining ranges in maXfIdRanges. */ - void finalizeXfIdRanges(); - /** Inserts all imported hyperlinks into their cell ranges. */ void finalizeHyperlinkRanges() const; /** Generates the final URL for the passed hyperlink. */ @@ -515,11 +455,6 @@ private: /** Inserts all imported data validations into their cell ranges. */ void finalizeValidationRanges() const; - /** Merges all cached merged ranges and updates right/bottom cell borders. */ - void finalizeMergedRanges(); - /** Merges the passed merged range and updates right/bottom cell borders. */ - void finalizeMergedRange( const CellRangeAddress& rRange ); - /** Converts column properties for all columns in the sheet. */ void convertColumns(); /** Converts column properties. */ @@ -542,8 +477,6 @@ private: typedef ::std::auto_ptr< VmlDrawing > VmlDrawingPtr; typedef ::std::auto_ptr< BiffSheetDrawing > BiffSheetDrawingPtr; - const OUString maTrueFormula; /// Replacement formula for TRUE boolean cells. - const OUString maFalseFormula; /// Replacement formula for FALSE boolean cells. const OUString maSheetCellRanges; /// Service name for a SheetCellRanges object. const OUString maUrlTextField; /// Service name for a URL text field. const CellAddress& mrMaxApiPos; /// Reference to maximum Calc cell address from address converter. @@ -554,17 +487,13 @@ private: RowModelMap maRowModels; /// Rows sorted by row index. HyperlinkModelList maHyperlinks; /// Cell ranges containing hyperlinks. ValidationModelList maValidations; /// Cell ranges containing data validation settings. - XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows. - XfIdRangeMap maXfIdRanges; /// Collected XF identifiers for cell ranges. - MergedRangeList maMergedRanges; /// Merged cell ranges. - MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment. ValueRangeSet maManualRowHeights; /// Rows that need manual height independent from own settings. - WorksheetSettings maSheetSett; /// Global settings for this sheet. - SharedFormulaBuffer maSharedFmlas; /// Buffer for shared formulas in this sheet. + SheetDataBuffer maSheetData; /// Buffer for cell contents and cell formatting. CondFormatBuffer maCondFormats; /// Buffer for conditional formattings. CommentsBuffer maComments; /// Buffer for all cell comments in this sheet. AutoFilterBuffer maAutoFilters; /// Sheet auto filters (not associated to a table). QueryTableBuffer maQueryTables; /// Buffer for all web query tables in this sheet. + WorksheetSettings maSheetSett; /// Global settings for this sheet. PageSettings maPageSett; /// Page/print settings for this sheet. SheetViewSettings maSheetViewSett; /// View settings for this sheet. VmlDrawingPtr mxVmlDrawing; /// Collection of all VML shapes. @@ -583,20 +512,18 @@ private: // ---------------------------------------------------------------------------- -WorksheetData::WorksheetData( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : +WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : WorkbookHelper( rHelper ), - maTrueFormula( CREATE_OUSTRING( "=TRUE()" ) ), - maFalseFormula( CREATE_OUSTRING( "=FALSE()" ) ), maSheetCellRanges( CREATE_OUSTRING( "com.sun.star.sheet.SheetCellRanges" ) ), maUrlTextField( CREATE_OUSTRING( "com.sun.star.text.TextField.URL" ) ), mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ), maUsedArea( nSheet, SAL_MAX_INT32, SAL_MAX_INT32, -1, -1 ), - maSheetSett( *this ), - maSharedFmlas( *this ), + maSheetData( *this ), maCondFormats( *this ), maComments( *this ), maAutoFilters( *this ), maQueryTables( *this ), + maSheetSett( *this ), maPageSett( *this ), maSheetViewSett( *this ), mxProgressBar( rxProgressBar ), @@ -645,12 +572,7 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, const ISegmentProgr } } -const OUString& WorksheetData::getBooleanFormula( bool bValue ) const -{ - return bValue ? maTrueFormula : maFalseFormula; -} - -Reference< XCell > WorksheetData::getCell( const CellAddress& rAddress ) const +Reference< XCell > WorksheetGlobals::getCell( const CellAddress& rAddress ) const { Reference< XCell > xCell; if( mxSheet.is() ) try @@ -663,7 +585,7 @@ Reference< XCell > WorksheetData::getCell( const CellAddress& rAddress ) const return xCell; } -Reference< XCellRange > WorksheetData::getCellRange( const CellRangeAddress& rRange ) const +Reference< XCellRange > WorksheetGlobals::getCellRange( const CellRangeAddress& rRange ) const { Reference< XCellRange > xRange; if( mxSheet.is() ) try @@ -676,7 +598,7 @@ Reference< XCellRange > WorksheetData::getCellRange( const CellRangeAddress& rRa return xRange; } -Reference< XSheetCellRanges > WorksheetData::getCellRangeList( const ApiCellRangeList& rRanges ) const +Reference< XSheetCellRanges > WorksheetGlobals::getCellRangeList( const ApiCellRangeList& rRanges ) const { Reference< XSheetCellRanges > xRanges; if( mxSheet.is() && !rRanges.empty() ) try @@ -691,7 +613,7 @@ Reference< XSheetCellRanges > WorksheetData::getCellRangeList( const ApiCellRang return xRanges; } -Reference< XCellRange > WorksheetData::getColumn( sal_Int32 nCol ) const +Reference< XCellRange > WorksheetGlobals::getColumn( sal_Int32 nCol ) const { Reference< XCellRange > xColumn; try @@ -706,7 +628,7 @@ Reference< XCellRange > WorksheetData::getColumn( sal_Int32 nCol ) const return xColumn; } -Reference< XCellRange > WorksheetData::getRow( sal_Int32 nRow ) const +Reference< XCellRange > WorksheetGlobals::getRow( sal_Int32 nRow ) const { Reference< XCellRange > xRow; try @@ -721,7 +643,7 @@ Reference< XCellRange > WorksheetData::getRow( sal_Int32 nRow ) const return xRow; } -Reference< XTableColumns > WorksheetData::getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const +Reference< XTableColumns > WorksheetGlobals::getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const { Reference< XTableColumns > xColumns; nLastCol = ::std::min( nLastCol, mrMaxApiPos.Column ); @@ -734,7 +656,7 @@ Reference< XTableColumns > WorksheetData::getColumns( sal_Int32 nFirstCol, sal_I return xColumns; } -Reference< XTableRows > WorksheetData::getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const +Reference< XTableRows > WorksheetGlobals::getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const { Reference< XTableRows > xRows; nLastRow = ::std::min( nLastRow, mrMaxApiPos.Row ); @@ -747,7 +669,7 @@ Reference< XTableRows > WorksheetData::getRows( sal_Int32 nFirstRow, sal_Int32 n return xRows; } -Reference< XDrawPage > WorksheetData::getDrawPage() const +Reference< XDrawPage > WorksheetGlobals::getDrawPage() const { Reference< XDrawPage > xDrawPage; try @@ -760,13 +682,13 @@ Reference< XDrawPage > WorksheetData::getDrawPage() const return xDrawPage; } -const Size& WorksheetData::getDrawPageSize() const +const Size& WorksheetGlobals::getDrawPageSize() const { - OSL_ENSURE( (maDrawPageSize.Width > 0) && (maDrawPageSize.Height > 0), "WorksheetData::getDrawPageSize - called too early, size invalid" ); + OSL_ENSURE( (maDrawPageSize.Width > 0) && (maDrawPageSize.Height > 0), "WorksheetGlobals::getDrawPageSize - called too early, size invalid" ); return maDrawPageSize; } -Point WorksheetData::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const +Point WorksheetGlobals::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const { Point aPoint; PropertySet aCellProp( getCell( CellAddress( getSheetIndex(), nCol, nRow ) ) ); @@ -774,7 +696,7 @@ Point WorksheetData::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const return aPoint; } -Size WorksheetData::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const +Size WorksheetGlobals::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const { Size aSize; PropertySet aCellProp( getCell( CellAddress( getSheetIndex(), nCol, nRow ) ) ); @@ -851,7 +773,7 @@ bool lclUpdateInterval( sal_Int32& rnBegAddr, sal_Int32& rnMidAddr, sal_Int32& r } // namespace -CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition ) const +CellAddress WorksheetGlobals::getCellAddressFromPosition( const Point& rPosition ) const { // starting cell address and its position in drawing layer (top-left edge) sal_Int32 nBegCol = 0; @@ -887,7 +809,7 @@ CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition ) return CellAddress( getSheetIndex(), nMidCol, nMidRow ); } -CellRangeAddress WorksheetData::getCellRangeFromRectangle( const Rectangle& rRect ) const +CellRangeAddress WorksheetGlobals::getCellRangeFromRectangle( const Rectangle& rRect ) const { CellAddress aStartAddr = getCellAddressFromPosition( Point( rRect.X, rRect.Y ) ); Point aBotRight( rRect.X + rRect.Width, rRect.Y + rRect.Height ); @@ -907,62 +829,7 @@ CellRangeAddress WorksheetData::getCellRangeFromRectangle( const Rectangle& rRec return CellRangeAddress( getSheetIndex(), aStartAddr.Column, aStartAddr.Row, aEndAddr.Column, aEndAddr.Row ); } -void WorksheetData::setCellFormat( const CellModel& rModel ) -{ - if( rModel.mxCell.is() && ((rModel.mnXfId >= 0) || (rModel.mnNumFmtId >= 0)) ) - { - // try to merge existing ranges and to write some formatting properties - if( !maXfIdRanges.empty() ) - { - // get row index of last inserted cell - sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; - // row changed - try to merge ranges of last row with existing ranges - if( rModel.maAddress.Row != nLastRow ) - { - mergeXfIdRanges(); - // write format properties of all ranges above last row and remove them - XfIdRangeMap::iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); - while( aIt != aEnd ) - { - // check that range cannot be merged with current row, and that range is not in cached row range - if( (aIt->second.maRange.EndRow < nLastRow) && !maXfIdRowRange.intersects( aIt->second.maRange ) ) - { - writeXfIdRangeProperties( aIt->second ); - maXfIdRanges.erase( aIt++ ); - } - else - ++aIt; - } - } - } - - // try to expand last existing range, or create new range entry - if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel ) ) - maXfIdRanges[ RowColKey( rModel.maAddress.Row, rModel.maAddress.Column ) ].set( rModel ); - - // update merged ranges for 'center across selection' and 'fill' - if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() ) - { - sal_Int32 nHorAlign = pXf->getAlignment().getModel().mnHorAlign; - if( (nHorAlign == XML_centerContinuous) || (nHorAlign == XML_fill) ) - { - /* start new merged range, if cell is not empty (#108781#), - or try to expand last range with empty cell */ - if( rModel.mnCellType != XML_TOKEN_INVALID ) - maCenterFillRanges.push_back( MergedRange( rModel.maAddress, nHorAlign ) ); - else if( !maCenterFillRanges.empty() ) - maCenterFillRanges.rbegin()->tryExpand( rModel.maAddress, nHorAlign ); - } - } - } -} - -void WorksheetData::setMergedRange( const CellRangeAddress& rRange ) -{ - maMergedRanges.push_back( MergedRange( rRange ) ); -} - -void WorksheetData::setPageBreak( const PageBreakModel& rModel, bool bRowBreak ) +void WorksheetGlobals::setPageBreak( const PageBreakModel& rModel, bool bRowBreak ) { if( rModel.mbManual && (rModel.mnColRow > 0) ) { @@ -971,27 +838,27 @@ void WorksheetData::setPageBreak( const PageBreakModel& rModel, bool bRowBreak ) } } -void WorksheetData::setHyperlink( const HyperlinkModel& rModel ) +void WorksheetGlobals::setHyperlink( const HyperlinkModel& rModel ) { maHyperlinks.push_back( rModel ); } -void WorksheetData::setValidation( const ValidationModel& rModel ) +void WorksheetGlobals::setValidation( const ValidationModel& rModel ) { maValidations.push_back( rModel ); } -void WorksheetData::setDrawingPath( const OUString& rDrawingPath ) +void WorksheetGlobals::setDrawingPath( const OUString& rDrawingPath ) { maDrawingPath = rDrawingPath; } -void WorksheetData::setVmlDrawingPath( const OUString& rVmlDrawingPath ) +void WorksheetGlobals::setVmlDrawingPath( const OUString& rVmlDrawingPath ) { maVmlDrawingPath = rVmlDrawingPath; } -void WorksheetData::extendUsedArea( const CellAddress& rAddress ) +void WorksheetGlobals::extendUsedArea( const CellAddress& rAddress ) { maUsedArea.StartColumn = ::std::min( maUsedArea.StartColumn, rAddress.Column ); maUsedArea.StartRow = ::std::min( maUsedArea.StartRow, rAddress.Row ); @@ -999,13 +866,13 @@ void WorksheetData::extendUsedArea( const CellAddress& rAddress ) maUsedArea.EndRow = ::std::max( maUsedArea.EndRow, rAddress.Row ); } -void WorksheetData::extendUsedArea( const CellRangeAddress& rRange ) +void WorksheetGlobals::extendUsedArea( const CellRangeAddress& rRange ) { extendUsedArea( CellAddress( rRange.Sheet, rRange.StartColumn, rRange.StartRow ) ); extendUsedArea( CellAddress( rRange.Sheet, rRange.EndColumn, rRange.EndRow ) ); } -void WorksheetData::extendShapeBoundingBox( const Rectangle& rShapeRect ) +void WorksheetGlobals::extendShapeBoundingBox( const Rectangle& rShapeRect ) { if( (maShapeBoundingBox.Width == 0) && (maShapeBoundingBox.Height == 0) ) { @@ -1023,7 +890,7 @@ void WorksheetData::extendShapeBoundingBox( const Rectangle& rShapeRect ) } } -void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth ) +void WorksheetGlobals::setBaseColumnWidth( sal_Int32 nWidth ) { // do not modify width, if setDefaultColumnWidth() has been used if( !mbHasDefWidth && (nWidth > 0) ) @@ -1035,7 +902,7 @@ void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth ) } } -void WorksheetData::setDefaultColumnWidth( double fWidth ) +void WorksheetGlobals::setDefaultColumnWidth( double fWidth ) { // overrides a width set with setBaseColumnWidth() if( fWidth > 0.0 ) @@ -1045,7 +912,7 @@ void WorksheetData::setDefaultColumnWidth( double fWidth ) } } -void WorksheetData::setColumnModel( const ColumnModel& rModel ) +void WorksheetGlobals::setColumnModel( const ColumnModel& rModel ) { // convert 1-based OOXML column indexes to 0-based API column indexes sal_Int32 nFirstCol = rModel.mnFirstCol - 1; @@ -1060,7 +927,17 @@ void WorksheetData::setColumnModel( const ColumnModel& rModel ) } } -void WorksheetData::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom ) +void WorksheetGlobals::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const +{ + CellRangeAddress aRange( getSheetIndex(), nFirstCol, 0, nLastCol, mrMaxApiPos.Row ); + if( getAddressConverter().validateCellRange( aRange, true, false ) ) + { + PropertySet aPropSet( getCellRange( aRange ) ); + getStyles().writeCellXfToPropertySet( aPropSet, nXfId ); + } +} + +void WorksheetGlobals::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom ) { maDefRowModel.mfHeight = fHeight; maDefRowModel.mbCustomHeight = bCustomHeight; @@ -1069,7 +946,7 @@ void WorksheetData::setDefaultRowSettings( double fHeight, bool bCustomHeight, b maDefRowModel.mbThickBottom = bThickBottom; } -void WorksheetData::setRowModel( const RowModel& rModel ) +void WorksheetGlobals::setRowModel( const RowModel& rModel ) { // convert 1-based OOXML row indexes to 0-based API row indexes sal_Int32 nFirstRow = rModel.mnFirstRow - 1; @@ -1077,22 +954,7 @@ void WorksheetData::setRowModel( const RowModel& rModel ) if( (0 <= nFirstRow) && (nFirstRow <= mrMaxApiPos.Row) ) { // set row formatting - if( rModel.mbCustomFormat ) - { - // try to expand cached row range, if formatting is equal - if( (maXfIdRowRange.mnLastRow < 0) || !maXfIdRowRange.tryExpand( nFirstRow, nLastRow, rModel.mnXfId ) ) - { - writeXfIdRowRangeProperties( maXfIdRowRange ); - maXfIdRowRange.set( nFirstRow, nLastRow, rModel.mnXfId ); - } - } - else if( maXfIdRowRange.mnLastRow >= 0 ) - { - // finish last cached row range - writeXfIdRowRangeProperties( maXfIdRowRange ); - maXfIdRowRange.set( -1, -1, -1 ); - } - + maSheetData.setRowFormat( nFirstRow, nLastRow, rModel.mnXfId, rModel.mbCustomFormat ); // expand last entry or add new entry if( maRowModels.empty() || !maRowModels.rbegin()->second.tryExpand( rModel ) ) maRowModels[ nFirstRow ] = rModel; @@ -1100,52 +962,35 @@ void WorksheetData::setRowModel( const RowModel& rModel ) lclUpdateProgressBar( mxRowProgress, maUsedArea, nLastRow ); } -void WorksheetData::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const +void WorksheetGlobals::setManualRowHeight( sal_Int32 nRow ) { - CellRangeAddress aRange( getSheetIndex(), nFirstCol, 0, nLastCol, mrMaxApiPos.Row ); - if( getAddressConverter().validateCellRange( aRange, true, false ) ) - { - PropertySet aPropSet( getCellRange( aRange ) ); - getStyles().writeCellXfToPropertySet( aPropSet, nXfId ); - } + maManualRowHeights.insert( nRow ); } -void WorksheetData::convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) const -{ - CellRangeAddress aRange( getSheetIndex(), 0, nFirstRow, mrMaxApiPos.Column, nLastRow ); - if( getAddressConverter().validateCellRange( aRange, true, false ) ) - { - PropertySet aPropSet( getCellRange( aRange ) ); - getStyles().writeCellXfToPropertySet( aPropSet, nXfId ); - } -} - -void WorksheetData::initializeWorksheetImport() +void WorksheetGlobals::initializeWorksheetImport() { // set default cell style for unused cells PropertySet aPropSet( mxSheet ); aPropSet.setProperty( PROP_CellStyle, getStyles().getDefaultStyleName() ); - /* Remember current sheet index in global data, needed by some global + /* Remember the current sheet index in global data, needed by global objects, e.g. the chart converter. */ setCurrentSheetIndex( getSheetIndex() ); } -void WorksheetData::finalizeWorksheetImport() +void WorksheetGlobals::finalizeWorksheetImport() { lclUpdateProgressBar( mxRowProgress, 1.0 ); - finalizeXfIdRanges(); + maSheetData.finalizeImport(); lclUpdateProgressBar( mxFinalProgress, 0.25 ); finalizeHyperlinkRanges(); finalizeValidationRanges(); - finalizeMergedRanges(); maAutoFilters.finalizeImport( getSheetIndex() ); - maSheetSett.finalizeImport(); maCondFormats.finalizeImport(); maQueryTables.finalizeImport(); + maSheetSett.finalizeImport(); maPageSett.finalizeImport(); maSheetViewSett.finalizeImport(); - maSheetSett.finalizeImport(); lclUpdateProgressBar( mxFinalProgress, 0.5 ); convertColumns(); @@ -1154,159 +999,13 @@ void WorksheetData::finalizeWorksheetImport() finalizeDrawings(); lclUpdateProgressBar( mxFinalProgress, 1.0 ); - // reset current sheet index in global data + // forget current sheet index in global data setCurrentSheetIndex( -1 ); } // private -------------------------------------------------------------------- -WorksheetData::XfIdRowRange::XfIdRowRange() : - mnFirstRow( -1 ), - mnLastRow( -1 ), - mnXfId( -1 ) -{ -} - -bool WorksheetData::XfIdRowRange::intersects( const CellRangeAddress& rRange ) const -{ - return (rRange.StartRow <= mnLastRow) && (mnFirstRow <= rRange.EndRow); -} - -void WorksheetData::XfIdRowRange::set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) -{ - mnFirstRow = nFirstRow; - mnLastRow = nLastRow; - mnXfId = nXfId; -} - -bool WorksheetData::XfIdRowRange::tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) -{ - if( mnXfId == nXfId ) - { - if( mnLastRow + 1 == nFirstRow ) - { - mnLastRow = nLastRow; - return true; - } - if( mnFirstRow == nLastRow + 1 ) - { - mnFirstRow = nFirstRow; - return true; - } - } - return false; -} - -void WorksheetData::XfIdRange::set( const CellModel& rModel ) -{ - maRange.Sheet = rModel.maAddress.Sheet; - maRange.StartColumn = maRange.EndColumn = rModel.maAddress.Column; - maRange.StartRow = maRange.EndRow = rModel.maAddress.Row; - mnXfId = rModel.mnXfId; - mnNumFmtId = rModel.mnNumFmtId; -} - -bool WorksheetData::XfIdRange::tryExpand( const CellModel& rModel ) -{ - if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == rModel.mnNumFmtId) && - (maRange.StartRow == rModel.maAddress.Row) && - (maRange.EndRow == rModel.maAddress.Row) && - (maRange.EndColumn + 1 == rModel.maAddress.Column) ) - { - ++maRange.EndColumn; - return true; - } - return false; -} - -bool WorksheetData::XfIdRange::tryMerge( const XfIdRange& rXfIdRange ) -{ - if( (mnXfId == rXfIdRange.mnXfId) && - (mnNumFmtId == rXfIdRange.mnNumFmtId) && - (maRange.EndRow + 1 == rXfIdRange.maRange.StartRow) && - (maRange.StartColumn == rXfIdRange.maRange.StartColumn) && - (maRange.EndColumn == rXfIdRange.maRange.EndColumn) ) - { - maRange.EndRow = rXfIdRange.maRange.EndRow; - return true; - } - return false; -} - - -WorksheetData::MergedRange::MergedRange( const CellRangeAddress& rRange ) : - maRange( rRange ), - mnHorAlign( XML_TOKEN_INVALID ) -{ -} - -WorksheetData::MergedRange::MergedRange( const CellAddress& rAddress, sal_Int32 nHorAlign ) : - maRange( rAddress.Sheet, rAddress.Column, rAddress.Row, rAddress.Column, rAddress.Row ), - mnHorAlign( nHorAlign ) -{ -} - -bool WorksheetData::MergedRange::tryExpand( const CellAddress& rAddress, sal_Int32 nHorAlign ) -{ - if( (mnHorAlign == nHorAlign) && (maRange.StartRow == rAddress.Row) && - (maRange.EndRow == rAddress.Row) && (maRange.EndColumn + 1 == rAddress.Column) ) - { - ++maRange.EndColumn; - return true; - } - return false; -} - -void WorksheetData::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const -{ - if( (rXfIdRowRange.mnLastRow >= 0) && (rXfIdRowRange.mnXfId >= 0) ) - convertRowFormat( rXfIdRowRange.mnFirstRow, rXfIdRowRange.mnLastRow, rXfIdRowRange.mnXfId ); -} - -void WorksheetData::writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const -{ - StylesBuffer& rStyles = getStyles(); - PropertyMap aPropMap; - if( rXfIdRange.mnXfId >= 0 ) - rStyles.writeCellXfToPropertyMap( aPropMap, rXfIdRange.mnXfId ); - if( rXfIdRange.mnNumFmtId >= 0 ) - rStyles.writeNumFmtToPropertyMap( aPropMap, rXfIdRange.mnNumFmtId ); - PropertySet aPropSet( getCellRange( rXfIdRange.maRange ) ); - aPropSet.setProperties( aPropMap ); -} - -void WorksheetData::mergeXfIdRanges() -{ - if( !maXfIdRanges.empty() ) - { - // get row index of last range - sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; - // process all ranges located in the same row of the last range - XfIdRangeMap::iterator aMergeIt = maXfIdRanges.end(); - while( (aMergeIt != maXfIdRanges.begin()) && ((--aMergeIt)->second.maRange.StartRow == nLastRow) ) - { - const XfIdRange& rMergeXfIdRange = aMergeIt->second; - // try to find a range that can be merged with rMergeRange - bool bFound = false; - for( XfIdRangeMap::iterator aIt = maXfIdRanges.begin(); !bFound && (aIt != aMergeIt); ++aIt ) - if( (bFound = aIt->second.tryMerge( rMergeXfIdRange )) == true ) - maXfIdRanges.erase( aMergeIt++ ); - } - } -} - -void WorksheetData::finalizeXfIdRanges() -{ - // write default formatting of remaining row range - writeXfIdRowRangeProperties( maXfIdRowRange ); - // try to merge remaining inserted ranges - mergeXfIdRanges(); - // write all formatting - for( XfIdRangeMap::const_iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); aIt != aEnd; ++aIt ) - writeXfIdRangeProperties( aIt->second ); -} - -void WorksheetData::finalizeHyperlinkRanges() const +void WorksheetGlobals::finalizeHyperlinkRanges() const { for( HyperlinkModelList::const_iterator aIt = maHyperlinks.begin(), aEnd = maHyperlinks.end(); aIt != aEnd; ++aIt ) { @@ -1319,7 +1018,7 @@ void WorksheetData::finalizeHyperlinkRanges() const } } -OUString WorksheetData::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) const +OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) const { OUStringBuffer aUrlBuffer; if( rHyperlink.maTarget.getLength() > 0 ) @@ -1347,20 +1046,20 @@ OUString WorksheetData::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) cons return aUrl; } -void WorksheetData::insertHyperlink( const CellAddress& rAddress, const OUString& rUrl ) const +void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUString& rUrl ) const { Reference< XCell > xCell = getCell( rAddress ); if( xCell.is() ) switch( xCell->getType() ) { // #i54261# restrict creation of URL field to text cells - case ::com::sun::star::table::CellContentType_TEXT: + case CellContentType_TEXT: { Reference< XText > xText( xCell, UNO_QUERY ); if( xText.is() ) { // create a URL field object and set its properties Reference< XTextContent > xUrlField( getBaseFilter().getModelFactory()->createInstance( maUrlTextField ), UNO_QUERY ); - OSL_ENSURE( xUrlField.is(), "WorksheetData::insertHyperlink - cannot create text field" ); + OSL_ENSURE( xUrlField.is(), "WorksheetGlobals::insertHyperlink - cannot create text field" ); if( xUrlField.is() ) { // properties of the URL field @@ -1376,7 +1075,7 @@ void WorksheetData::insertHyperlink( const CellAddress& rAddress, const OUString } catch( const Exception& ) { - OSL_ENSURE( false, "WorksheetData::insertHyperlink - cannot insert text field" ); + OSL_ENSURE( false, "WorksheetGlobals::insertHyperlink - cannot insert text field" ); } } } @@ -1386,15 +1085,13 @@ void WorksheetData::insertHyperlink( const CellAddress& rAddress, const OUString // fix for #i31050# disabled, HYPERLINK is not able to return numeric value (#i91351#) #if 0 // #i31050# replace number with HYPERLINK function - case ::com::sun::star::table::CellContentType_VALUE: + case CellContentType_VALUE: { Reference< XFormulaTokens > xTokens( xCell, UNO_QUERY ); - OSL_ENSURE( xTokens.is(), "WorksheetHelper::insertHyperlink - missing formula interface" ); - if( xTokens.is() ) - { - SimpleFormulaContext aContext( xTokens, false, false ); - getFormulaParser().convertNumberToHyperlink( aContext, rUrl, xCell->getValue() ); - } + ApiTokenSequence aTokens = getFormulaParser().convertNumberToHyperlink( rUrl, xCell->getValue() ); + OSL_ENSURE( xTokens.is(), "WorksheetHelper::insertHyperlink - missing formula token interface" ); + if( xTokens.is() && aTokens.hasElements() ) + xTokens->setTokens( aTokens ); } break; #endif @@ -1403,7 +1100,7 @@ void WorksheetData::insertHyperlink( const CellAddress& rAddress, const OUString } } -void WorksheetData::finalizeValidationRanges() const +void WorksheetGlobals::finalizeValidationRanges() const { for( ValidationModelList::const_iterator aIt = maValidations.begin(), aEnd = maValidations.end(); aIt != aEnd; ++aIt ) { @@ -1413,37 +1110,36 @@ void WorksheetData::finalizeValidationRanges() const if( xValidation.is() ) { PropertySet aValProps( xValidation ); - namespace csss = ::com::sun::star::sheet; // convert validation type to API enum - ValidationType eType = csss::ValidationType_ANY; + ValidationType eType = ValidationType_ANY; switch( aIt->mnType ) { - case XML_custom: eType = csss::ValidationType_CUSTOM; break; - case XML_date: eType = csss::ValidationType_DATE; break; - case XML_decimal: eType = csss::ValidationType_DECIMAL; break; - case XML_list: eType = csss::ValidationType_LIST; break; - case XML_none: eType = csss::ValidationType_ANY; break; - case XML_textLength: eType = csss::ValidationType_TEXT_LEN; break; - case XML_time: eType = csss::ValidationType_TIME; break; - case XML_whole: eType = csss::ValidationType_WHOLE; break; - default: OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown validation type" ); + case XML_custom: eType = ValidationType_CUSTOM; break; + case XML_date: eType = ValidationType_DATE; break; + case XML_decimal: eType = ValidationType_DECIMAL; break; + case XML_list: eType = ValidationType_LIST; break; + case XML_none: eType = ValidationType_ANY; break; + case XML_textLength: eType = ValidationType_TEXT_LEN; break; + case XML_time: eType = ValidationType_TIME; break; + case XML_whole: eType = ValidationType_WHOLE; break; + default: OSL_ENSURE( false, "WorksheetGlobals::finalizeValidationRanges - unknown validation type" ); } aValProps.setProperty( PROP_Type, eType ); // convert error alert style to API enum - ValidationAlertStyle eAlertStyle = csss::ValidationAlertStyle_STOP; + ValidationAlertStyle eAlertStyle = ValidationAlertStyle_STOP; switch( aIt->mnErrorStyle ) { - case XML_information: eAlertStyle = csss::ValidationAlertStyle_INFO; break; - case XML_stop: eAlertStyle = csss::ValidationAlertStyle_STOP; break; - case XML_warning: eAlertStyle = csss::ValidationAlertStyle_WARNING; break; - default: OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown error style" ); + case XML_information: eAlertStyle = ValidationAlertStyle_INFO; break; + case XML_stop: eAlertStyle = ValidationAlertStyle_STOP; break; + case XML_warning: eAlertStyle = ValidationAlertStyle_WARNING; break; + default: OSL_ENSURE( false, "WorksheetGlobals::finalizeValidationRanges - unknown error style" ); } aValProps.setProperty( PROP_ErrorAlertStyle, eAlertStyle ); // convert dropdown style to API visibility constants - sal_Int16 nVisibility = aIt->mbNoDropDown ? csss::TableValidationVisibility::INVISIBLE : csss::TableValidationVisibility::UNSORTED; + sal_Int16 nVisibility = aIt->mbNoDropDown ? TableValidationVisibility::INVISIBLE : TableValidationVisibility::UNSORTED; aValProps.setProperty( PROP_ShowList, nVisibility ); // messages @@ -1478,67 +1174,7 @@ void WorksheetData::finalizeValidationRanges() const } } -void WorksheetData::finalizeMergedRanges() -{ - MergedRangeList::const_iterator aIt, aEnd; - for( aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) - finalizeMergedRange( aIt->maRange ); - for( aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) - finalizeMergedRange( aIt->maRange ); -} - -void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange ) -{ - bool bMultiCol = rRange.StartColumn < rRange.EndColumn; - bool bMultiRow = rRange.StartRow < rRange.EndRow; - - if( bMultiCol || bMultiRow ) try - { - // merge the cell range - Reference< XMergeable > xMerge( getCellRange( rRange ), UNO_QUERY_THROW ); - xMerge->merge( sal_True ); - - // if merging this range worked (no overlapping merged ranges), update cell borders - Reference< XCell > xTopLeft( getCell( CellAddress( getSheetIndex(), rRange.StartColumn, rRange.StartRow ) ), UNO_SET_THROW ); - PropertySet aTopLeftProp( xTopLeft ); - - // copy right border of top-right cell to right border of top-left cell - if( bMultiCol ) - { - PropertySet aTopRightProp( getCell( CellAddress( getSheetIndex(), rRange.EndColumn, rRange.StartRow ) ) ); - BorderLine aLine; - if( aTopRightProp.getProperty( aLine, PROP_RightBorder ) ) - aTopLeftProp.setProperty( PROP_RightBorder, aLine ); - } - - // copy bottom border of bottom-left cell to bottom border of top-left cell - if( bMultiRow ) - { - PropertySet aBottomLeftProp( getCell( CellAddress( getSheetIndex(), rRange.StartColumn, rRange.EndRow ) ) ); - BorderLine aLine; - if( aBottomLeftProp.getProperty( aLine, PROP_BottomBorder ) ) - aTopLeftProp.setProperty( PROP_BottomBorder, aLine ); - } - - // #i93609# merged range in a single row: test if manual row height is needed - if( !bMultiRow ) - { - bool bTextWrap = aTopLeftProp.getBoolProperty( PROP_IsTextWrapped ); - if( !bTextWrap && (xTopLeft->getType() == ::com::sun::star::table::CellContentType_TEXT) ) - { - Reference< XText > xText( xTopLeft, UNO_QUERY ); - bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0); - } - if( bTextWrap ) - maManualRowHeights.insert( rRange.StartRow ); - } - } - catch( Exception& ) - { - } -} - -void WorksheetData::convertColumns() +void WorksheetGlobals::convertColumns() { sal_Int32 nNextCol = 0; sal_Int32 nMaxCol = mrMaxApiPos.Column; @@ -1567,7 +1203,7 @@ void WorksheetData::convertColumns() convertOutlines( aColLevels, nMaxCol + 1, 0, false, false ); } -void WorksheetData::convertColumns( OutlineLevelVec& orColLevels, +void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels, sal_Int32 nFirstCol, sal_Int32 nLastCol, const ColumnModel& rModel ) { PropertySet aPropSet( getColumns( nFirstCol, nLastCol ) ); @@ -1588,7 +1224,7 @@ void WorksheetData::convertColumns( OutlineLevelVec& orColLevels, convertOutlines( orColLevels, nFirstCol, rModel.mnLevel, rModel.mbCollapsed, false ); } -void WorksheetData::convertRows() +void WorksheetGlobals::convertRows() { sal_Int32 nNextRow = 0; sal_Int32 nMaxRow = mrMaxApiPos.Row; @@ -1617,7 +1253,7 @@ void WorksheetData::convertRows() convertOutlines( aRowLevels, nMaxRow + 1, 0, false, true ); } -void WorksheetData::convertRows( OutlineLevelVec& orRowLevels, +void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels, sal_Int32 nFirstRow, sal_Int32 nLastRow, const RowModel& rModel, double fDefHeight ) { // row height: convert points to row height in 1/100 mm @@ -1648,13 +1284,13 @@ void WorksheetData::convertRows( OutlineLevelVec& orRowLevels, convertOutlines( orRowLevels, nFirstRow, rModel.mnLevel, rModel.mbCollapsed, true ); } -void WorksheetData::convertOutlines( OutlineLevelVec& orLevels, +void WorksheetGlobals::convertOutlines( OutlineLevelVec& orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows ) { /* It is ensured from caller functions, that this function is called without any gaps between the processed column or row ranges. */ - OSL_ENSURE( nLevel >= 0, "WorksheetData::convertOutlines - negative outline level" ); + OSL_ENSURE( nLevel >= 0, "WorksheetGlobals::convertOutlines - negative outline level" ); nLevel = ::std::max< sal_Int32 >( nLevel, 0 ); sal_Int32 nSize = orLevels.size(); @@ -1677,7 +1313,7 @@ void WorksheetData::convertOutlines( OutlineLevelVec& orLevels, } } -void WorksheetData::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapse, bool bRows ) +void WorksheetGlobals::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapse, bool bRows ) { try { @@ -1685,14 +1321,14 @@ void WorksheetData::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastC if( bRows ) { CellRangeAddress aRange( getSheetIndex(), 0, nFirstColRow, 0, nLastColRow ); - xOutline->group( aRange, ::com::sun::star::table::TableOrientation_ROWS ); + xOutline->group( aRange, TableOrientation_ROWS ); if( bCollapse ) xOutline->hideDetail( aRange ); } else { CellRangeAddress aRange( getSheetIndex(), nFirstColRow, 0, nLastColRow, 0 ); - xOutline->group( aRange, ::com::sun::star::table::TableOrientation_COLUMNS ); + xOutline->group( aRange, TableOrientation_COLUMNS ); if( bCollapse ) xOutline->hideDetail( aRange ); } @@ -1702,7 +1338,7 @@ void WorksheetData::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastC } } -void WorksheetData::finalizeDrawings() +void WorksheetGlobals::finalizeDrawings() { // calculate the current drawing page size (after rows/columns are imported) PropertySet aRangeProp( getCellRange( CellRangeAddress( getSheetIndex(), 0, 0, mrMaxApiPos.Column, mrMaxApiPos.Row ) ) ); @@ -1752,46 +1388,55 @@ void WorksheetData::finalizeDrawings() if( maSheetViewSett.isSheetRightToLeft() ) { PropertySet aPropSet( mxSheet ); - aPropSet.setProperty( PROP_TableLayout, ::com::sun::star::text::WritingMode2::RL_TB ); + aPropSet.setProperty( PROP_TableLayout, WritingMode2::RL_TB ); } } // ============================================================================ // ============================================================================ -WorksheetHelper::WorksheetHelper( WorksheetData& rSheetData ) : - WorkbookHelper( rSheetData ), - mrSheetData( rSheetData ) +WorksheetHelper::WorksheetHelper( WorksheetGlobals& rSheetGlob ) : + WorkbookHelper( rSheetGlob ), + mrSheetGlob( rSheetGlob ) { } +/*static*/ WorksheetGlobalsRef WorksheetHelper::constructGlobals( const WorkbookHelper& rHelper, + const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) +{ + WorksheetGlobalsRef xSheetGlob( new WorksheetGlobals( rHelper, rxProgressBar, eSheetType, nSheet ) ); + if( !xSheetGlob->isValidSheet() ) + xSheetGlob.reset(); + return xSheetGlob; +} + WorksheetType WorksheetHelper::getSheetType() const { - return mrSheetData.getSheetType(); + return mrSheetGlob.getSheetType(); } sal_Int16 WorksheetHelper::getSheetIndex() const { - return mrSheetData.getSheetIndex(); + return mrSheetGlob.getSheetIndex(); } const Reference< XSpreadsheet >& WorksheetHelper::getSheet() const { - return mrSheetData.getSheet(); + return mrSheetGlob.getSheet(); } Reference< XCell > WorksheetHelper::getCell( const CellAddress& rAddress ) const { - return mrSheetData.getCell( rAddress ); + return mrSheetGlob.getCell( rAddress ); } Reference< XCell > WorksheetHelper::getCell( const OUString& rAddressStr, CellAddress* opAddress ) const { CellAddress aAddress; - if( getAddressConverter().convertToCellAddress( aAddress, rAddressStr, mrSheetData.getSheetIndex(), true ) ) + if( getAddressConverter().convertToCellAddress( aAddress, rAddressStr, mrSheetGlob.getSheetIndex(), true ) ) { if( opAddress ) *opAddress = aAddress; - return mrSheetData.getCell( aAddress ); + return mrSheetGlob.getCell( aAddress ); } return Reference< XCell >(); } @@ -1799,62 +1444,22 @@ Reference< XCell > WorksheetHelper::getCell( const OUString& rAddressStr, CellAd Reference< XCell > WorksheetHelper::getCell( const BinAddress& rBinAddress, CellAddress* opAddress ) const { CellAddress aAddress; - if( getAddressConverter().convertToCellAddress( aAddress, rBinAddress, mrSheetData.getSheetIndex(), true ) ) + if( getAddressConverter().convertToCellAddress( aAddress, rBinAddress, mrSheetGlob.getSheetIndex(), true ) ) { if( opAddress ) *opAddress = aAddress; - return mrSheetData.getCell( aAddress ); + return mrSheetGlob.getCell( aAddress ); } return Reference< XCell >(); } Reference< XCellRange > WorksheetHelper::getCellRange( const CellRangeAddress& rRange ) const { - return mrSheetData.getCellRange( rRange ); -} - -Reference< XCellRange > WorksheetHelper::getCellRange( const OUString& rRangeStr, CellRangeAddress* opRange ) const -{ - CellRangeAddress aRange; - if( getAddressConverter().convertToCellRange( aRange, rRangeStr, mrSheetData.getSheetIndex(), true, true ) ) - { - if( opRange ) *opRange = aRange; - return mrSheetData.getCellRange( aRange ); - } - return Reference< XCellRange >(); -} - -Reference< XCellRange > WorksheetHelper::getCellRange( const BinRange& rBinRange, CellRangeAddress* opRange ) const -{ - CellRangeAddress aRange; - if( getAddressConverter().convertToCellRange( aRange, rBinRange, mrSheetData.getSheetIndex(), true, true ) ) - { - if( opRange ) *opRange = aRange; - return mrSheetData.getCellRange( aRange ); - } - return Reference< XCellRange >(); + return mrSheetGlob.getCellRange( rRange ); } Reference< XSheetCellRanges > WorksheetHelper::getCellRangeList( const ApiCellRangeList& rRanges ) const { - return mrSheetData.getCellRangeList( rRanges ); -} - -Reference< XSheetCellRanges > WorksheetHelper::getCellRangeList( - const OUString& rRangesStr, ApiCellRangeList* opRanges ) const -{ - ApiCellRangeList aRanges; - getAddressConverter().convertToCellRangeList( aRanges, rRangesStr, mrSheetData.getSheetIndex(), true ); - if( opRanges ) *opRanges = aRanges; - return mrSheetData.getCellRangeList( aRanges ); -} - -Reference< XSheetCellRanges > WorksheetHelper::getCellRangeList( - const BinRangeList& rBinRanges, ApiCellRangeList* opRanges ) const -{ - ApiCellRangeList aRanges; - getAddressConverter().convertToCellRangeList( aRanges, rBinRanges, mrSheetData.getSheetIndex(), true ); - if( opRanges ) *opRanges = aRanges; - return mrSheetData.getCellRangeList( aRanges ); + return mrSheetGlob.getCellRangeList( rRanges ); } CellAddress WorksheetHelper::getCellAddress( const Reference< XCell >& rxCell ) @@ -1879,272 +1484,112 @@ CellRangeAddress WorksheetHelper::getRangeAddress( const Reference< XCellRange > Reference< XCellRange > WorksheetHelper::getColumn( sal_Int32 nCol ) const { - return mrSheetData.getColumn( nCol ); + return mrSheetGlob.getColumn( nCol ); } Reference< XCellRange > WorksheetHelper::getRow( sal_Int32 nRow ) const { - return mrSheetData.getRow( nRow ); + return mrSheetGlob.getRow( nRow ); } Reference< XTableColumns > WorksheetHelper::getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const { - return mrSheetData.getColumns( nFirstCol, nLastCol ); + return mrSheetGlob.getColumns( nFirstCol, nLastCol ); } Reference< XTableRows > WorksheetHelper::getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const { - return mrSheetData.getRows( nFirstRow, nLastRow ); + return mrSheetGlob.getRows( nFirstRow, nLastRow ); } Reference< XDrawPage > WorksheetHelper::getDrawPage() const { - return mrSheetData.getDrawPage(); + return mrSheetGlob.getDrawPage(); } Point WorksheetHelper::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const { - return mrSheetData.getCellPosition( nCol, nRow ); + return mrSheetGlob.getCellPosition( nCol, nRow ); } Size WorksheetHelper::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const { - return mrSheetData.getCellSize( nCol, nRow ); + return mrSheetGlob.getCellSize( nCol, nRow ); } Size WorksheetHelper::getDrawPageSize() const { - return mrSheetData.getDrawPageSize(); + return mrSheetGlob.getDrawPageSize(); } -WorksheetSettings& WorksheetHelper::getWorksheetSettings() const +SheetDataBuffer& WorksheetHelper::getSheetData() const { - return mrSheetData.getWorksheetSettings(); -} - -SharedFormulaBuffer& WorksheetHelper::getSharedFormulas() const -{ - return mrSheetData.getSharedFormulas(); + return mrSheetGlob.getSheetData(); } CondFormatBuffer& WorksheetHelper::getCondFormats() const { - return mrSheetData.getCondFormats(); + return mrSheetGlob.getCondFormats(); } CommentsBuffer& WorksheetHelper::getComments() const { - return mrSheetData.getComments(); + return mrSheetGlob.getComments(); } AutoFilterBuffer& WorksheetHelper::getAutoFilters() const { - return mrSheetData.getAutoFilters(); + return mrSheetGlob.getAutoFilters(); } QueryTableBuffer& WorksheetHelper::getQueryTables() const { - return mrSheetData.getQueryTables(); + return mrSheetGlob.getQueryTables(); +} + +WorksheetSettings& WorksheetHelper::getWorksheetSettings() const +{ + return mrSheetGlob.getWorksheetSettings(); } PageSettings& WorksheetHelper::getPageSettings() const { - return mrSheetData.getPageSettings(); + return mrSheetGlob.getPageSettings(); } SheetViewSettings& WorksheetHelper::getSheetViewSettings() const { - return mrSheetData.getSheetViewSettings(); + return mrSheetGlob.getSheetViewSettings(); } VmlDrawing& WorksheetHelper::getVmlDrawing() const { - return mrSheetData.getVmlDrawing(); + return mrSheetGlob.getVmlDrawing(); } BiffSheetDrawing& WorksheetHelper::getBiffDrawing() const { - return mrSheetData.getBiffDrawing(); -} - -void WorksheetHelper::setStringCell( const Reference< XCell >& rxCell, const OUString& rText ) const -{ - OSL_ENSURE( rxCell.is(), "WorksheetHelper::setStringCell - missing cell interface" ); - Reference< XText > xText( rxCell, UNO_QUERY ); - if( xText.is() ) - xText->setString( rText ); -} - -void WorksheetHelper::setSharedStringCell( const Reference< XCell >& rxCell, sal_Int32 nStringId, sal_Int32 nXfId ) const -{ - OSL_ENSURE( rxCell.is(), "WorksheetHelper::setSharedStringCell - missing cell interface" ); - getSharedStrings().convertString( Reference< XText >( rxCell, UNO_QUERY ), nStringId, nXfId ); -} - -void WorksheetHelper::setDateTimeCell( const Reference< XCell >& rxCell, const DateTime& rDateTime ) const -{ - OSL_ENSURE( rxCell.is(), "WorksheetHelper::setDateTimeCell - missing cell interface" ); - // write serial date/time value into the cell - double fSerial = getUnitConverter().calcSerialFromDateTime( rDateTime ); - rxCell->setValue( fSerial ); - // set appropriate number format - using namespace ::com::sun::star::util::NumberFormat; - sal_Int16 nStdFmt = (fSerial < 1.0) ? TIME : (((rDateTime.Hours > 0) || (rDateTime.Minutes > 0) || (rDateTime.Seconds > 0)) ? DATETIME : DATE); - setStandardNumFmt( rxCell, nStdFmt ); -} - -void WorksheetHelper::setBooleanCell( const Reference< XCell >& rxCell, bool bValue ) const -{ - OSL_ENSURE( rxCell.is(), "WorksheetHelper::setBooleanCell - missing cell interface" ); - rxCell->setFormula( mrSheetData.getBooleanFormula( bValue ) ); -} - -void WorksheetHelper::setErrorCell( const Reference< XCell >& rxCell, const OUString& rErrorCode ) const -{ - setErrorCell( rxCell, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); -} - -void WorksheetHelper::setErrorCell( const Reference< XCell >& rxCell, sal_uInt8 nErrorCode ) const -{ - Reference< XFormulaTokens > xTokens( rxCell, UNO_QUERY ); - OSL_ENSURE( xTokens.is(), "WorksheetHelper::setErrorCell - missing formula interface" ); - if( xTokens.is() ) - { - SimpleFormulaContext aContext( xTokens, false, false ); - getFormulaParser().convertErrorToFormula( aContext, nErrorCode ); - } -} - -void WorksheetHelper::setCell( CellModel& orModel ) const -{ - OSL_ENSURE( orModel.mxCell.is(), "WorksheetHelper::setCell - missing cell interface" ); - if( orModel.mbHasValueStr ) switch( orModel.mnCellType ) - { - case XML_b: - setBooleanCell( orModel.mxCell, orModel.maValueStr.toDouble() != 0.0 ); - // #108770# set 'Standard' number format for all Boolean cells - orModel.mnNumFmtId = 0; - break; - case XML_n: - orModel.mxCell->setValue( orModel.maValueStr.toDouble() ); - break; - case XML_e: - setErrorCell( orModel.mxCell, orModel.maValueStr ); - break; - case XML_str: - setStringCell( orModel.mxCell, orModel.maValueStr ); - break; - case XML_s: - setSharedStringCell( orModel.mxCell, orModel.maValueStr.toInt32(), orModel.mnXfId ); - break; - } -} - -void WorksheetHelper::setStandardNumFmt( const Reference< XCell >& rxCell, sal_Int16 nStdNumFmt ) const -{ - try - { - Reference< XNumberFormatsSupplier > xNumFmtsSupp( getDocument(), UNO_QUERY_THROW ); - Reference< XNumberFormatTypes > xNumFmtTypes( xNumFmtsSupp->getNumberFormats(), UNO_QUERY_THROW ); - sal_Int32 nIndex = xNumFmtTypes->getStandardFormat( nStdNumFmt, Locale() ); - PropertySet aPropSet( rxCell ); - aPropSet.setProperty( PROP_NumberFormat, nIndex ); - } - catch( Exception& ) - { - } + return mrSheetGlob.getBiffDrawing(); } void WorksheetHelper::setSheetType( WorksheetType eSheetType ) { - mrSheetData.setSheetType( eSheetType ); -} - -void WorksheetHelper::setCellFormat( const CellModel& rModel ) -{ - mrSheetData.setCellFormat( rModel ); -} - -void WorksheetHelper::setMergedRange( const CellRangeAddress& rRange ) -{ - mrSheetData.setMergedRange( rRange ); + mrSheetGlob.setSheetType( eSheetType ); } void WorksheetHelper::setPageBreak( const PageBreakModel& rModel, bool bRowBreak ) { - mrSheetData.setPageBreak( rModel, bRowBreak ); + mrSheetGlob.setPageBreak( rModel, bRowBreak ); } void WorksheetHelper::setHyperlink( const HyperlinkModel& rModel ) { - mrSheetData.setHyperlink( rModel ); + mrSheetGlob.setHyperlink( rModel ); } void WorksheetHelper::setValidation( const ValidationModel& rModel ) { - mrSheetData.setValidation( rModel ); -} - -void WorksheetHelper::setTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) const -{ - OSL_ENSURE( getAddressConverter().checkCellRange( rRange, true, false ), "WorksheetHelper::setTableOperation - invalid range" ); - bool bOk = false; - if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) - { - CellRangeAddress aOpRange = rRange; - CellAddress aRef1, aRef2; - if( getAddressConverter().convertToCellAddress( aRef1, rModel.maRef1, mrSheetData.getSheetIndex(), true ) ) try - { - if( rModel.mb2dTable ) - { - if( !rModel.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rModel.maRef2, mrSheetData.getSheetIndex(), true ) ) - { - // API call expects input values inside operation range - --aOpRange.StartColumn; - --aOpRange.StartRow; - // formula range is top-left cell of operation range - CellRangeAddress aFormulaRange( mrSheetData.getSheetIndex(), aOpRange.StartColumn, aOpRange.StartRow, aOpRange.StartColumn, aOpRange.StartRow ); - // set multiple operation - Reference< XMultipleOperation > xMultOp( mrSheetData.getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, ::com::sun::star::sheet::TableOperationMode_BOTH, aRef2, aRef1 ); - bOk = true; - } - } - else if( rModel.mbRowTable ) - { - // formula range is column to the left of operation range - CellRangeAddress aFormulaRange( mrSheetData.getSheetIndex(), aOpRange.StartColumn - 1, aOpRange.StartRow, aOpRange.StartColumn - 1, aOpRange.EndRow ); - // API call expects input values (top row) inside operation range - --aOpRange.StartRow; - // set multiple operation - Reference< XMultipleOperation > xMultOp( mrSheetData.getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, ::com::sun::star::sheet::TableOperationMode_ROW, aRef1, aRef1 ); - bOk = true; - } - else - { - // formula range is row above operation range - CellRangeAddress aFormulaRange( mrSheetData.getSheetIndex(), aOpRange.StartColumn, aOpRange.StartRow - 1, aOpRange.EndColumn, aOpRange.StartRow - 1 ); - // API call expects input values (left column) inside operation range - --aOpRange.StartColumn; - // set multiple operation - Reference< XMultipleOperation > xMultOp( mrSheetData.getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, ::com::sun::star::sheet::TableOperationMode_COLUMN, aRef1, aRef1 ); - bOk = true; - } - } - catch( Exception& ) - { - } - } - - // on error: fill cell range with error codes - if( !bOk ) - { - for( CellAddress aPos( mrSheetData.getSheetIndex(), rRange.StartColumn, rRange.StartRow ); aPos.Row <= rRange.EndRow; ++aPos.Row ) - for( aPos.Column = rRange.StartColumn; aPos.Column <= rRange.EndColumn; ++aPos.Column ) - setErrorCell( mrSheetData.getCell( aPos ), BIFF_ERR_REF ); - } + mrSheetGlob.setValidation( rModel ); } void WorksheetHelper::setLabelRanges( const ApiCellRangeList& rColRanges, const ApiCellRangeList& rRowRanges ) @@ -2201,107 +1646,72 @@ void WorksheetHelper::setLabelRanges( const ApiCellRangeList& rColRanges, const void WorksheetHelper::setDrawingPath( const OUString& rDrawingPath ) { - mrSheetData.setDrawingPath( rDrawingPath ); + mrSheetGlob.setDrawingPath( rDrawingPath ); } void WorksheetHelper::setVmlDrawingPath( const OUString& rVmlDrawingPath ) { - mrSheetData.setVmlDrawingPath( rVmlDrawingPath ); + mrSheetGlob.setVmlDrawingPath( rVmlDrawingPath ); } void WorksheetHelper::extendUsedArea( const CellAddress& rAddress ) { - mrSheetData.extendUsedArea( rAddress ); + mrSheetGlob.extendUsedArea( rAddress ); } void WorksheetHelper::extendUsedArea( const CellRangeAddress& rRange ) { - mrSheetData.extendUsedArea( rRange ); + mrSheetGlob.extendUsedArea( rRange ); } void WorksheetHelper::extendShapeBoundingBox( const Rectangle& rShapeRect ) { - mrSheetData.extendShapeBoundingBox( rShapeRect ); + mrSheetGlob.extendShapeBoundingBox( rShapeRect ); } void WorksheetHelper::setBaseColumnWidth( sal_Int32 nWidth ) { - mrSheetData.setBaseColumnWidth( nWidth ); + mrSheetGlob.setBaseColumnWidth( nWidth ); } void WorksheetHelper::setDefaultColumnWidth( double fWidth ) { - mrSheetData.setDefaultColumnWidth( fWidth ); + mrSheetGlob.setDefaultColumnWidth( fWidth ); } void WorksheetHelper::setDefaultColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) { - mrSheetData.convertColumnFormat( nFirstCol, nLastCol, nXfId ); + mrSheetGlob.convertColumnFormat( nFirstCol, nLastCol, nXfId ); } void WorksheetHelper::setColumnModel( const ColumnModel& rModel ) { - mrSheetData.setColumnModel( rModel ); + mrSheetGlob.setColumnModel( rModel ); } void WorksheetHelper::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom ) { - mrSheetData.setDefaultRowSettings( fHeight, bCustomHeight, bHidden, bThickTop, bThickBottom ); + mrSheetGlob.setDefaultRowSettings( fHeight, bCustomHeight, bHidden, bThickTop, bThickBottom ); } void WorksheetHelper::setRowModel( const RowModel& rModel ) { - mrSheetData.setRowModel( rModel ); -} - -void WorksheetHelper::initializeWorksheetImport() -{ - mrSheetData.initializeWorksheetImport(); -} - -void WorksheetHelper::finalizeWorksheetImport() -{ - mrSheetData.finalizeWorksheetImport(); -} - -// ============================================================================ - -namespace prv { - -WorksheetDataOwner::WorksheetDataOwner( WorksheetDataRef xSheetData ) : - mxSheetData( xSheetData ) -{ -} - -WorksheetDataOwner::~WorksheetDataOwner() -{ + mrSheetGlob.setRowModel( rModel ); } -} // namespace prv - -// ---------------------------------------------------------------------------- - -WorksheetHelperRoot::WorksheetHelperRoot( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) : - prv::WorksheetDataOwner( prv::WorksheetDataRef( new WorksheetData( rHelper, rxProgressBar, eSheetType, nSheet ) ) ), - WorksheetHelper( *mxSheetData ) +void WorksheetHelper::setManualRowHeight( sal_Int32 nRow ) { + mrSheetGlob.setManualRowHeight( nRow ); } -WorksheetHelperRoot::WorksheetHelperRoot( const WorksheetHelper& rHelper ) : - prv::WorksheetDataOwner( prv::WorksheetDataRef() ), - WorksheetHelper( rHelper ) -{ -} - -WorksheetHelperRoot::WorksheetHelperRoot( const WorksheetHelperRoot& rHelper ) : - prv::WorksheetDataOwner( rHelper.mxSheetData ), - WorksheetHelper( rHelper ) +void WorksheetHelper::initializeWorksheetImport() { + mrSheetGlob.initializeWorksheetImport(); } -bool WorksheetHelperRoot::isValidSheet() const +void WorksheetHelper::finalizeWorksheetImport() { - return mxSheetData->isValidSheet(); + mrSheetGlob.finalizeWorksheetImport(); } // ============================================================================ -- cgit From 1a96f96d48647907520617ac9c5d14f4b51b409d Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 10 Feb 2011 18:53:18 +0100 Subject: dr78: #i106580# handle SvxTextLineItem, base class of SvxUnderlineItem --- sc/source/ui/view/formatsh.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 3ff7222178f3..ca5898343496 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1225,13 +1225,22 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) if( pSet ) { - const SvxUnderlineItem& rUnderline = (const SvxUnderlineItem&)pSet->Get( ATTR_FONT_UNDERLINE ); + const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE ); if( rUnderline.ISA(SvxUnderlineItem) ) { pTabViewShell->ApplyAttr( rUnderline ); pNewSet->Put( rUnderline,rUnderline.Which() ); } + else if ( rUnderline.ISA(SvxTextLineItem) ) + { + // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem) + const SvxTextLineItem& rTextLineItem = static_cast(rUnderline); + SvxUnderlineItem aNewItem( rTextLineItem.GetLineStyle(), rTextLineItem.Which() ); + aNewItem.SetColor( rTextLineItem.GetColor() ); + pTabViewShell->ApplyAttr( aNewItem ); + pNewSet->Put( aNewItem, aNewItem.Which() ); + } } else { -- cgit From 3965dbb11d44ee09ff7f43ea1a931f30b7b8439a Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 11 Feb 2011 16:11:43 +0100 Subject: dr78: #164376# oox import performance: step 2 - move every access to XCell interface into SheetDataBuffer class, delay creation of array formulas and table operations, let XCellRangeData::setDataArray() accept formula token sequences in addition to plain values --- sc/source/ui/unoobj/cellsuno.cxx | 75 ++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 25 deletions(-) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index ceb76f7671a0..cb3ab775ccb4 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1110,35 +1110,60 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, for (long nCol=0; nColSetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); - } - else if ( eElemClass == uno::TypeClass_BYTE || - eElemClass == uno::TypeClass_SHORT || - eElemClass == uno::TypeClass_UNSIGNED_SHORT || - eElemClass == uno::TypeClass_LONG || - eElemClass == uno::TypeClass_UNSIGNED_LONG || - eElemClass == uno::TypeClass_FLOAT || - eElemClass == uno::TypeClass_DOUBLE ) + switch( rElement.getValueTypeClass() ) { + case uno::TypeClass_VOID: + { + // void = "no value" + pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); + } + break; + // #87871# accept integer types because Basic passes a floating point // variable as byte, short or long if it's an integer number. - double fVal(0.0); - rElement >>= fVal; - pDoc->SetValue( nDocCol, nDocRow, nTab, fVal ); - } - else if ( eElemClass == uno::TypeClass_STRING ) - { - rtl::OUString aUStr; - rElement >>= aUStr; - if ( aUStr.getLength() ) - pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) ); + case uno::TypeClass_BYTE: + case uno::TypeClass_SHORT: + case uno::TypeClass_UNSIGNED_SHORT: + case uno::TypeClass_LONG: + case uno::TypeClass_UNSIGNED_LONG: + case uno::TypeClass_FLOAT: + case uno::TypeClass_DOUBLE: + { + double fVal(0.0); + rElement >>= fVal; + pDoc->SetValue( nDocCol, nDocRow, nTab, fVal ); + } + break; + + case uno::TypeClass_STRING: + { + rtl::OUString aUStr; + rElement >>= aUStr; + if ( aUStr.getLength() ) + pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) ); + } + break; + + // accept Sequence for formula cells + case uno::TypeClass_SEQUENCE: + { + uno::Sequence< sheet::FormulaToken > aTokens; + if ( rElement >>= aTokens ) + { + ScTokenArray aTokenArray; + ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens ); + ScAddress aPos( nDocCol, nDocRow, nTab ); + ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aPos, &aTokenArray ); + pDoc->PutCell( aPos, pNewCell ); + } + else + bError = true; + } + break; + + default: + bError = true; // invalid type } - else - bError = TRUE; // invalid type ++nDocCol; } -- cgit From f042519085109581abcdff4403e7e6d9999d4980 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 11 Feb 2011 16:11:43 +0100 Subject: dr78: #164376# oox import performance: step 2 - move every access to XCell interface into SheetDataBuffer class, delay creation of array formulas and table operations, let XCellRangeData::setDataArray() accept formula token sequences in addition to plain values --- oox/inc/oox/xls/defnamesbuffer.hxx | 6 +- oox/inc/oox/xls/sheetdatabuffer.hxx | 133 ++++-- oox/inc/oox/xls/sheetdatacontext.hxx | 84 ++-- oox/inc/oox/xls/worksheethelper.hxx | 47 -- oox/source/xls/defnamesbuffer.cxx | 22 +- oox/source/xls/externallinkbuffer.cxx | 5 +- oox/source/xls/pivotcachebuffer.cxx | 18 +- oox/source/xls/sheetdatabuffer.cxx | 410 +++++++++--------- oox/source/xls/sheetdatacontext.cxx | 789 +++++++++++++++++----------------- oox/source/xls/worksheethelper.cxx | 43 -- 10 files changed, 771 insertions(+), 786 deletions(-) diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx index 27f9f13f6e87..f26a51a1f04c 100644 --- a/oox/inc/oox/xls/defnamesbuffer.hxx +++ b/oox/inc/oox/xls/defnamesbuffer.hxx @@ -94,11 +94,11 @@ public: protected: /** Converts the OOXML formula string stored in the own model. */ - ApiTokenSequence importOoxFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ); + ApiTokenSequence importOoxFormula( sal_Int16 nBaseSheet ); /** Imports the BIFF12 formula from the passed stream. */ - ApiTokenSequence importBiff12Formula( const ::com::sun::star::table::CellAddress& rBaseAddr, SequenceInputStream& rStrm ); + ApiTokenSequence importBiff12Formula( sal_Int16 nBaseSheet, SequenceInputStream& rStrm ); /** Imports the BIFF formula from the passed stream. */ - ApiTokenSequence importBiffFormula( const ::com::sun::star::table::CellAddress& rBaseAddr, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); + ApiTokenSequence importBiffFormula( sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ); /** Tries to convert the passed token sequence to a SingleReference or ComplexReference. */ void extractReference( const ApiTokenSequence& rTokens ); diff --git a/oox/inc/oox/xls/sheetdatabuffer.hxx b/oox/inc/oox/xls/sheetdatabuffer.hxx index 52b71b4f0ef9..878d225ff81f 100755 --- a/oox/inc/oox/xls/sheetdatabuffer.hxx +++ b/oox/inc/oox/xls/sheetdatabuffer.hxx @@ -42,6 +42,53 @@ namespace xls { // ============================================================================ +/** Stores basic data about cell values and formatting. */ +struct CellModel +{ + ::com::sun::star::table::CellAddress + maCellAddr; /// The address of the current cell. + sal_Int32 mnCellType; /// Data type of the cell value. + sal_Int32 mnXfId; /// XF (cell formatting) identifier. + bool mbShowPhonetic; /// True = show phonetic text. + + explicit CellModel(); +}; + +// ---------------------------------------------------------------------------- + +/** Stores data about cell formulas. */ +struct CellFormulaModel +{ + ::com::sun::star::table::CellRangeAddress + maFormulaRef; /// Formula range for array/shared formulas and data tables. + sal_Int32 mnFormulaType; /// Type of the formula (regular, array, shared, table). + sal_Int32 mnSharedId; /// Identifier of a shared formula (OOXML only). + + explicit CellFormulaModel(); + + /** Returns true, if the passed cell address is valid for an array formula. */ + bool isValidArrayRef( const ::com::sun::star::table::CellAddress& rCellAddr ); + /** Returns true, if the passed cell address is valid for a shared formula. */ + bool isValidSharedRef( const ::com::sun::star::table::CellAddress& rCellAddr ); +}; + +// ---------------------------------------------------------------------------- + +/** Stores data about table operations. */ +struct DataTableModel +{ + ::rtl::OUString maRef1; /// First reference cell for table operations. + ::rtl::OUString maRef2; /// Second reference cell for table operations. + bool mb2dTable; /// True = 2-dimensional data table. + bool mbRowTable; /// True = row oriented data table. + bool mbRef1Deleted; /// True = first reference cell deleted. + bool mbRef2Deleted; /// True = second reference cell deleted. + + explicit DataTableModel(); +}; + +// ============================================================================ + /** Manages the cell contents and cell formatting of a sheet. */ class SheetDataBuffer : public WorksheetHelper @@ -49,81 +96,71 @@ class SheetDataBuffer : public WorksheetHelper public: explicit SheetDataBuffer( const WorksheetHelper& rHelper ); - /** Imports a shared formula from a OOXML formula string. */ - void importSharedFmla( const ::rtl::OUString& rFormula, - const ::rtl::OUString& rSharedRange, sal_Int32 nSharedId, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Imports a shared formula from a SHAREDFORMULA record in the passed stream */ - void importSharedFmla( SequenceInputStream& rStrm, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Imports a shared formula from a SHAREDFMLA record in the passed stream. */ - void importSharedFmla( BiffInputStream& rStrm, - const ::com::sun::star::table::CellAddress& rBaseAddr ); - /** Sets the passed value to the cell. */ void setValueCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, double fValue ); /** Sets the passed string to the cell. */ void setStringCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, const ::rtl::OUString& rText ); /** Sets the passed rich-string to the cell. */ void setStringCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, const RichString& rString, sal_Int32 nXfId ); /** Sets the shared string with the passed identifier to the cell. */ void setStringCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nStringId, sal_Int32 nXfId ); /** Sets the passed date/time value to the cell and adjusts number format. */ void setDateTimeCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, const ::com::sun::star::util::DateTime& rDateTime ); /** Sets the passed boolean value to the cell and adjusts number format. */ void setBooleanCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, bool bValue ); /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ void setErrorCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, const ::rtl::OUString& rErrorCode ); /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ void setErrorCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, sal_uInt8 nErrorCode ); /** Sets the passed formula token sequence to the cell. */ void setFormulaCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, const ApiTokenSequence& rTokens ); /** Sets the shared formula with the passed identifier to the cell (OOXML only). */ void setFormulaCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell, const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nSharedId ); /** Inserts the passed token array as array formula. */ - void setArrayFormula( + void createArrayFormula( const ::com::sun::star::table::CellRangeAddress& rRange, const ApiTokenSequence& rTokens ); /** Sets a multiple table operation to the passed range. */ - void setTableOperation( + void createTableOperation( const ::com::sun::star::table::CellRangeAddress& rRange, const DataTableModel& rModel ); + /** Creates a named range with a special name for a shared formula with the + specified identifier and formula definition (OOXML only). */ + void createSharedFormula( + sal_Int32 nSharedId, + const ApiTokenSequence& rTokens ); + /** Creates a named range with a special name for a shared formula with the + specified base address and formula definition (BIFF only). */ + void createSharedFormula( + const ::com::sun::star::table::CellAddress& rCellAddr, + const ApiTokenSequence& rTokens ); /** Sets default cell formatting for the specified range of rows. */ void setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ); - /** Processes the cell formatting data of the passed cell. */ - void setCellFormat( const CellModel& rModel ); + /** Processes the cell formatting data of the passed cell. + @param nNumFmtId If set, overrides number format of the cell XF. */ + void setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId = -1 ); /** Merges the cells in the passed cell range. */ void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the specified cell. */ @@ -138,21 +175,21 @@ private: struct XfIdRowRange; struct XfIdRange; - /** Creates and returns an empty named range with a special name for a - shared formula with the specified base position. */ - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > - createSharedFormulaName( const BinAddress& rMapKey ); + /** Inserts the passed array formula into the sheet. */ + void finalizeArrayFormula( + const ::com::sun::star::table::CellRangeAddress& rRange, + const ApiTokenSequence& rTokens ); + /** Inserts the passed table operation into the sheet. */ + void finalizeTableOperation( + const ::com::sun::star::table::CellRangeAddress& rRange, + const DataTableModel& rModel ); + /** Creates a named range with a special name for a shared formula with the + specified base address and formula definition. */ + void createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens ); /** Creates a formula token array representing the shared formula with the - passed identifier (OOXML only). */ - ApiTokenSequence resolveSharedFormula( sal_Int32 nSharedId ) const; - /** Creates a formula token array representing the shared formula at the - passed base address. */ - ApiTokenSequence resolveSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr ) const; - - /** Retries to insert a shared formula that has not been set in the last - call to setFormulaCell() due to the missing formula definition. */ - void retryPendingSharedFormulaCell(); + passed identifier. */ + ApiTokenSequence resolveSharedFormula( const BinAddress& rMapKey ) const; /** Writes all cell formatting attributes to the passed row range. */ void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const; @@ -165,6 +202,9 @@ private: void finalizeMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); private: + typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula; + typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, DataTableModel > TableOperation; + struct XfIdRowRange { sal_Int32 mnFirstRow; /// Index of first row. @@ -182,10 +222,10 @@ private: ::com::sun::star::table::CellRangeAddress maRange; /// The formatted cell range. sal_Int32 mnXfId; /// XF identifier for the range. - sal_Int32 mnNumFmtId; /// Number format id overriding the XF. + sal_Int32 mnNumFmtId; /// Number format overriding the XF. - void set( const CellModel& rModel ); - bool tryExpand( const CellModel& rModel ); + void set( const CellModel& rModel, sal_Int32 nNumFmtId ); + bool tryExpand( const CellModel& rModel, sal_Int32 nNumFmtId ); bool tryMerge( const XfIdRange& rXfIdRange ); }; @@ -200,15 +240,18 @@ private: bool tryExpand( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); }; - typedef ::std::map< BinAddress, sal_Int32 > TokenIndexMap; + typedef ::std::list< ArrayFormula > ArrayFormulaList; + typedef ::std::list< TableOperation > TableOperationList; + typedef ::std::map< BinAddress, sal_Int32 > SharedFormulaMap; typedef ::std::map< BinAddress, XfIdRange > XfIdRangeMap; typedef ::std::list< MergedRange > MergedRangeList; - TokenIndexMap maTokenIndexes; /// Maps shared formula base address to defined name token index. + ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet. + TableOperationList maTableOperations; /// All table operations in the sheet. + SharedFormulaMap maSharedFormulas; /// Maps shared formula base address to defined name token index. ::com::sun::star::table::CellAddress maSharedFmlaAddr; /// Address of a cell containing a pending shared formula. - ::com::sun::star::table::CellAddress - maSharedBaseAddr; /// Base address of the pending shared formula. + BinAddress maSharedBaseAddr; /// Base address of the pending shared formula. XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows. XfIdRangeMap maXfIdRanges; /// Collected XF identifiers for cell ranges. MergedRangeList maMergedRanges; /// Merged cell ranges. diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index c01106228c72..60948ab9f70d 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -30,22 +30,37 @@ #include "oox/xls/excelhandlers.hxx" #include "oox/xls/richstring.hxx" - -namespace com { namespace sun { namespace star { - namespace table { class XCell; } -} } } +#include "oox/xls/sheetdatabuffer.hxx" namespace oox { namespace xls { // ============================================================================ +/** Used as base for sheet data context classes. Provides fast access to often + used converter objects and sheet index, to improve performance. + */ +struct SheetDataContextBase +{ + AddressConverter& mrAddressConv; /// The address converter. + FormulaParser& mrFormulaParser; /// The formula parser. + SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. + CellModel maCellData; /// Position, contents, formatting of current imported cell. + CellFormulaModel maFmlaData; /// Settings for a cell formula. + sal_Int16 mnSheet; /// Index of the current sheet. + + explicit SheetDataContextBase( const WorksheetHelper& rHelper ); + virtual ~SheetDataContextBase(); +}; + +// ============================================================================ + /** This class implements importing the sheetData element. The sheetData element contains all row settings and all cells in a single sheet of a spreadsheet document. */ -class SheetDataContext : public WorksheetContextBase +class SheetDataContext : public WorksheetContextBase, private SheetDataContextBase { public: explicit SheetDataContext( WorksheetFragmentBase& rFragment ); @@ -64,12 +79,20 @@ private: /** Imports row settings from a row element. */ void importRow( const AttributeList& rAttribs ); /** Imports cell settings from a c element. */ - void importCell( const AttributeList& rAttribs ); + bool importCell( const AttributeList& rAttribs ); /** Imports cell settings from an f element. */ void importFormula( const AttributeList& rAttribs ); - /** Imports a cell address and the following XF identifier. */ - void importCellHeader( SequenceInputStream& rStrm, CellType eCellType ); + /** Imports row settings from a ROW record. */ + void importRow( SequenceInputStream& rStrm ); + + /** Reads a cell address and the following XF identifier. */ + bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType ); + /** Reads a cell formula for the current cell. */ + ApiTokenSequence readCellFormula( SequenceInputStream& rStrm ); + /** Reads the formula range used by shared formulas, arrays, and data tables. */ + bool readFormulaRef( SequenceInputStream& rStrm ); + /** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */ void importCellBlank( SequenceInputStream& rStrm, CellType eCellType ); /** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */ @@ -87,31 +110,28 @@ private: /** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */ void importCellString( SequenceInputStream& rStrm, CellType eCellType ); - /** Imports a cell formula for the current cell. */ - void importCellFormula( SequenceInputStream& rStrm ); - - /** Imports row settings from a ROW record. */ - void importRow( SequenceInputStream& rStrm ); /** Imports an array formula from an ARRAY record. */ void importArray( SequenceInputStream& rStrm ); - /** Imports a shared formula from a SHAREDFORMULA record. */ - void importSharedFmla( SequenceInputStream& rStrm ); /** Imports table operation from a DATATABLE record. */ void importDataTable( SequenceInputStream& rStrm ); + /** Imports a shared formula from a SHAREDFORMULA record. */ + void importSharedFmla( SequenceInputStream& rStrm ); private: - SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. - CellModel maCurrCell; /// Position and formatting of current imported cell. - DataTableModel maTableData; /// Additional data for table operation ranges. - BinAddress maCurrPos; /// Current position for binary import. - RichStringRef mxInlineStr; /// Inline rich string from 'is' element. + ::rtl::OUString maCellValue; /// Cell value string (OOXML only). + RichStringRef mxInlineStr; /// Inline rich string (OOXML only). + ApiTokenSequence maTokens; /// Formula token array (OOXML only). + DataTableModel maTableData; /// Settings for table operations. + BinAddress maCurrPos; /// Current cell position (BIFF12 only). + bool mbHasFormula; /// True = current cell has formula data (OOXML only). + bool mbValidRange; /// True = maFmlaData.maFormulaRef is valid (OOXML only). }; // ============================================================================ /** This class implements importing row settings and all cells of a sheet. */ -class BiffSheetDataContext : public BiffWorksheetContextBase +class BiffSheetDataContext : public BiffWorksheetContextBase, private SheetDataContextBase { public: explicit BiffSheetDataContext( const WorksheetHelper& rHelper ); @@ -120,13 +140,15 @@ public: virtual void importRecord( BiffInputStream& rStrm ); private: - /** Sets current cell according to the passed address. */ - void setCurrCell( const BinAddress& rAddr ); + /** Imports row settings from a ROW record. */ + void importRow( BiffInputStream& rStrm ); - /** Imports an XF identifier and sets the mnXfId member. */ - void importXfId( BiffInputStream& rStrm, bool bBiff2 ); - /** Imports a BIFF cell address and the following XF identifier. */ - void importCellHeader( BiffInputStream& rStrm, bool bBiff2 ); + /** Reads an XF identifier and initializes a new cell. */ + bool readCellXfId( const BinAddress& rAddr, BiffInputStream& rStrm, bool bBiff2 ); + /** Reads a BIFF cell address and the following XF identifier. */ + bool readCellHeader( BiffInputStream& rStrm, bool bBiff2 ); + /** Reads the formula range used by shared formulas, arrays, and data tables. */ + bool readFormulaRef( BiffInputStream& rStrm ); /** Imports a BLANK record describing a blank but formatted cell. */ void importBlank( BiffInputStream& rStrm ); @@ -149,18 +171,14 @@ private: /** Imports an RK record describing a numeric cell. */ void importRk( BiffInputStream& rStrm ); - /** Imports row settings from a ROW record. */ - void importRow( BiffInputStream& rStrm ); /** Imports an ARRAY record describing an array formula of a cell range. */ void importArray( BiffInputStream& rStrm ); - /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */ - void importSharedFmla( BiffInputStream& rStrm ); /** Imports table operation from a DATATABLE or DATATABLE2 record. */ void importDataTable( BiffInputStream& rStrm ); + /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */ + void importSharedFmla( BiffInputStream& rStrm ); private: - SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. - CellModel maCurrCell; /// Position and formatting of current imported cell. sal_uInt32 mnFormulaSkipSize; /// Number of bytes to be ignored in FORMULA record. sal_uInt32 mnArraySkipSize; /// Number of bytes to be ignored in ARRAY record. sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record. diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index fe788be852cb..27754c898608 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -80,42 +80,6 @@ enum WorksheetType // ============================================================================ -/** Stores some data about a cell. */ -struct CellModel -{ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > mxCell; - ::com::sun::star::table::CellAddress maAddress; - ::rtl::OUString maValue; /// String containing cell value data. - ::rtl::OUString maFormula; /// String containing the formula definition. - ::rtl::OUString maFormulaRef; /// String containing formula range for array/shared formulas. - sal_Int32 mnCellType; /// Data type of the cell value. - sal_Int32 mnFormulaType; /// Type of the formula (regular, array, shared, table). - sal_Int32 mnSharedId; /// Shared formula identifier. - sal_Int32 mnXfId; /// XF (cell formatting) identifier. - sal_Int32 mnNumFmtId; /// Forced number format (overrides XF if set). - bool mbShowPhonetic; /// True = show phonetic text. - - inline explicit CellModel() { reset(); } - void reset(); -}; - -// ---------------------------------------------------------------------------- - -/** Stores data about a data table a.k.a. multiple operation range. */ -struct DataTableModel -{ - ::rtl::OUString maRef1; /// String containing first reference cell for data table formulas. - ::rtl::OUString maRef2; /// String containing second reference cell for data table formulas. - bool mb2dTable; /// True = 2-dimensional data table. - bool mbRowTable; /// True = row oriented data table. - bool mbRef1Deleted; /// True = first reference cell deleted. - bool mbRef2Deleted; /// True = second reference cell deleted. - - explicit DataTableModel(); -}; - -// ---------------------------------------------------------------------------- - /** Stores formatting data about a range of columns. */ struct ColumnModel { @@ -243,17 +207,6 @@ public: /** Returns the XCell interface for the passed cell address. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > getCell( const ::com::sun::star::table::CellAddress& rAddress ) const; - /** Returns the XCell interface for the passed cell address string. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > - getCell( - const ::rtl::OUString& rAddressStr, - ::com::sun::star::table::CellAddress* opAddress = 0 ) const; - /** Returns the XCell interface for the passed cell address. */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > - getCell( - const BinAddress& rBinAddress, - ::com::sun::star::table::CellAddress* opAddress = 0 ) const; - /** Returns the XCellRange interface for the passed cell range address. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > getCellRange( const ::com::sun::star::table::CellRangeAddress& rRange ) const; diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx index 335aae5273af..e69cc44c8a1d 100644 --- a/oox/source/xls/defnamesbuffer.cxx +++ b/oox/source/xls/defnamesbuffer.cxx @@ -276,22 +276,22 @@ Any DefinedNameBase::getReference( const CellAddress& rBaseAddr ) const return Any(); } -ApiTokenSequence DefinedNameBase::importOoxFormula( const CellAddress& rBaseAddr ) +ApiTokenSequence DefinedNameBase::importOoxFormula( sal_Int16 nBaseSheet ) { return (maModel.maFormula.getLength() > 0) ? - getFormulaParser().importFormula( rBaseAddr, maModel.maFormula ) : + getFormulaParser().importFormula( CellAddress( nBaseSheet, 0, 0 ), maModel.maFormula ) : getFormulaParser().convertErrorToFormula( BIFF_ERR_NAME ); } -ApiTokenSequence DefinedNameBase::importBiff12Formula( const CellAddress& rBaseAddr, SequenceInputStream& rStrm ) +ApiTokenSequence DefinedNameBase::importBiff12Formula( sal_Int16 nBaseSheet, SequenceInputStream& rStrm ) { - return getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_DEFINEDNAME, rStrm ); + return getFormulaParser().importFormula( CellAddress( nBaseSheet, 0, 0 ), FORMULATYPE_DEFINEDNAME, rStrm ); } -ApiTokenSequence DefinedNameBase::importBiffFormula( const CellAddress& rBaseAddr, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) +ApiTokenSequence DefinedNameBase::importBiffFormula( sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) { return (!pnFmlaSize || (*pnFmlaSize > 0)) ? - getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_DEFINEDNAME, rStrm, pnFmlaSize ) : + getFormulaParser().importFormula( CellAddress( nBaseSheet, 0, 0 ), FORMULATYPE_DEFINEDNAME, rStrm, pnFmlaSize ) : getFormulaParser().convertErrorToFormula( BIFF_ERR_NAME ); } @@ -460,8 +460,7 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcShee these names contain a simple cell reference or range reference. Other regular defined names and external names rely on existence of this reference. */ - CellAddress aBaseAddr( mnCalcSheet, 0, 0 ); - ApiTokenSequence aTokens = importBiffFormula( aBaseAddr, rStrm, &mnFmlaSize ); + ApiTokenSequence aTokens = importBiffFormula( mnCalcSheet, rStrm, &mnFmlaSize ); extractReference( aTokens ); } else @@ -521,7 +520,6 @@ void DefinedName::convertFormula() // convert and set formula of the defined name ApiTokenSequence aTokens; - CellAddress aBaseAddr( mnCalcSheet, 0, 0 ); switch( getFilterType() ) { case FILTER_OOXML: @@ -529,10 +527,10 @@ void DefinedName::convertFormula() if( mxFormula.get() ) { SequenceInputStream aStrm( *mxFormula ); - aTokens = importBiff12Formula( aBaseAddr, aStrm ); + aTokens = importBiff12Formula( mnCalcSheet, aStrm ); } else - aTokens = importOoxFormula( aBaseAddr ); + aTokens = importOoxFormula( mnCalcSheet ); } break; case FILTER_BIFF: @@ -543,7 +541,7 @@ void DefinedName::convertFormula() BiffInputStream& rStrm = mxBiffStrm->getStream(); BiffInputStreamPosGuard aStrmGuard( rStrm ); if( mxBiffStrm->restorePosition() ) - aTokens = importBiffFormula( aBaseAddr, rStrm, &mnFmlaSize ); + aTokens = importBiffFormula( mnCalcSheet, rStrm, &mnFmlaSize ); } } break; diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index fe527f35f634..aa4d7a068530 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -242,8 +242,7 @@ void ExternalName::importExternalName( BiffInputStream& rStrm ) // cell references to other internal sheets are stored in hidden external names if( bHiddenRef && (getBiff() == BIFF4) && isWorkbookFile() ) { - CellAddress aBaseAddr( mrParentLink.getCalcSheetIndex(), 0, 0 ); - ApiTokenSequence aTokens = importBiffFormula( aBaseAddr, rStrm ); + ApiTokenSequence aTokens = importBiffFormula( mrParentLink.getCalcSheetIndex(), rStrm ); extractReference( aTokens ); } break; @@ -252,7 +251,7 @@ void ExternalName::importExternalName( BiffInputStream& rStrm ) // cell references to other documents are stored in hidden external names if( bHiddenRef ) { - ApiTokenSequence aTokens = importBiffFormula( CellAddress(), rStrm ); + ApiTokenSequence aTokens = importBiffFormula( 0, rStrm ); extractExternalReference( aTokens ); } break; diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx index 88935a679c83..2c4d55b089f1 100644 --- a/oox/source/xls/pivotcachebuffer.cxx +++ b/oox/source/xls/pivotcachebuffer.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "oox/core/filterbase.hxx" #include "oox/helper/attributelist.hxx" @@ -938,7 +937,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie void PivotCacheField::writeSourceHeaderCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const { CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); - rSheetHelper.getSheetData().setStringCell( rSheetHelper.getCell( aCellAddr ), aCellAddr, maFieldModel.maName ); + rSheetHelper.getSheetData().setStringCell( aCellAddr, maFieldModel.maName ); } void PivotCacheField::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const @@ -986,15 +985,14 @@ void PivotCacheField::writeItemToSourceDataCell( WorksheetHelper& rSheetHelper, { CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); SheetDataBuffer& rSheetData = rSheetHelper.getSheetData(); - Reference< XCell > xCell = rSheetHelper.getCell( aCellAddr ); - if( xCell.is() ) switch( rItem.getType() ) + switch( rItem.getType() ) { - case XML_s: rSheetData.setStringCell( xCell, aCellAddr, rItem.getValue().get< OUString >() ); break; - case XML_n: rSheetData.setValueCell( xCell, aCellAddr, rItem.getValue().get< double >() ); break; - case XML_i: rSheetData.setValueCell( xCell, aCellAddr, rItem.getValue().get< sal_Int16 >() ); break; - case XML_d: rSheetData.setDateTimeCell( xCell, aCellAddr, rItem.getValue().get< DateTime >() ); break; - case XML_b: rSheetData.setBooleanCell( xCell, aCellAddr, rItem.getValue().get< bool >() ); break; - case XML_e: rSheetData.setErrorCell( xCell, aCellAddr, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; + case XML_s: rSheetData.setStringCell( aCellAddr, rItem.getValue().get< OUString >() ); break; + case XML_n: rSheetData.setValueCell( aCellAddr, rItem.getValue().get< double >() ); break; + case XML_i: rSheetData.setValueCell( aCellAddr, rItem.getValue().get< sal_Int16 >() ); break; + case XML_d: rSheetData.setDateTimeCell( aCellAddr, rItem.getValue().get< DateTime >() ); break; + case XML_b: rSheetData.setBooleanCell( aCellAddr, rItem.getValue().get< bool >() ); break; + case XML_e: rSheetData.setErrorCell( aCellAddr, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; default: OSL_ENSURE( false, "PivotCacheField::writeItemToSourceDataCell - unexpected item data type" ); } } diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx index e63e9fbb61b5..0cfe741cb135 100755 --- a/oox/source/xls/sheetdatabuffer.cxx +++ b/oox/source/xls/sheetdatabuffer.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -66,147 +67,116 @@ using ::rtl::OUStringBuffer; // ============================================================================ -namespace { - -bool lclContains( const CellRangeAddress& rRange, const CellAddress& rAddr ) +CellModel::CellModel() : + mnCellType( XML_TOKEN_INVALID ), + mnXfId( -1 ), + mbShowPhonetic( false ) { - return - (rRange.Sheet == rAddr.Sheet) && - (rRange.StartColumn <= rAddr.Column) && (rAddr.Column <= rRange.EndColumn) && - (rRange.StartRow <= rAddr.Row) && (rAddr.Row <= rRange.EndRow); } -} // namespace +// ---------------------------------------------------------------------------- -// ============================================================================ +CellFormulaModel::CellFormulaModel() : + mnFormulaType( XML_TOKEN_INVALID ), + mnSharedId( -1 ) +{ +} -SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) : - WorksheetHelper( rHelper ), - mbPendingSharedFmla( false ) +bool CellFormulaModel::isValidArrayRef( const CellAddress& rCellAddr ) { + return + (maFormulaRef.Sheet == rCellAddr.Sheet) && + (maFormulaRef.StartColumn == rCellAddr.Column) && + (maFormulaRef.StartRow == rCellAddr.Row); } -void SheetDataBuffer::importSharedFmla( const OUString& rFormula, const OUString& rSharedRange, sal_Int32 nSharedId, const CellAddress& rBaseAddr ) +bool CellFormulaModel::isValidSharedRef( const CellAddress& rCellAddr ) { - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, rSharedRange, getSheetIndex(), true, true ) ) try - { - // get or create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); - Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( nSharedId, 0 ) ); - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); - // convert the formula definition - ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, rFormula ); - xTokens->setTokens( aTokens ); - // retry to insert a pending shared formula cell - retryPendingSharedFormulaCell(); - } - catch( Exception& ) - { - } + return + (maFormulaRef.Sheet == rCellAddr.Sheet) && + (maFormulaRef.StartColumn <= rCellAddr.Column) && (rCellAddr.Column <= maFormulaRef.EndColumn) && + (maFormulaRef.StartRow <= rCellAddr.Row) && (rCellAddr.Row <= maFormulaRef.EndRow); } -void SheetDataBuffer::importSharedFmla( SequenceInputStream& rStrm, const CellAddress& rBaseAddr ) +// ---------------------------------------------------------------------------- + +DataTableModel::DataTableModel() : + mb2dTable( false ), + mbRowTable( false ), + mbRef1Deleted( false ), + mbRef2Deleted( false ) { - BinRange aRange; - rStrm >> aRange; - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) try - { - // get or create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); - Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( rBaseAddr ) ); - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); - // load the formula definition - ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); - xTokens->setTokens( aTokens ); - // retry to insert a pending shared formula cell - retryPendingSharedFormulaCell(); - } - catch( Exception& ) - { - } } -void SheetDataBuffer::importSharedFmla( BiffInputStream& rStrm, const CellAddress& rBaseAddr ) +// ============================================================================ + +SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) : + WorksheetHelper( rHelper ), + mbPendingSharedFmla( false ) { - BinRange aRange; - aRange.read( rStrm, false ); // always 8bit column indexes - CellRangeAddress aFmlaRange; - if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) ) try - { - // get or create the defined name representing the shared formula - OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SheetDataBuffer::importSharedFmla - invalid range for shared formula" ); - Reference< XNamedRange > xNamedRange = createSharedFormulaName( BinAddress( rBaseAddr ) ); - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); - // load the formula definition - rStrm.skip( 2 ); // flags - ApiTokenSequence aTokens = getFormulaParser().importFormula( rBaseAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); - xTokens->setTokens( aTokens ); - // retry to insert a pending shared formula cell - retryPendingSharedFormulaCell(); - } - catch( Exception& ) - { - } } -void SheetDataBuffer::setValueCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, double fValue ) +void SheetDataBuffer::setValueCell( const CellAddress& rCellAddr, double fValue ) { - OSL_ENSURE( rxCell.is(), "SheetDataBuffer::setDateTimeCell - missing cell interface" ); - if( rxCell.is() ) - rxCell->setValue( fValue ); + Reference< XCell > xCell = getCell( rCellAddr ); + OSL_ENSURE( xCell.is(), "SheetDataBuffer::setValueCell - missing cell interface" ); + if( xCell.is() ) + xCell->setValue( fValue ); } -void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, const OUString& rText ) +void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, const OUString& rText ) { - Reference< XText > xText( rxCell, UNO_QUERY ); + Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); if( xText.is() ) xText->setString( rText ); } -void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, const RichString& rString, sal_Int32 nXfId ) +void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, const RichString& rString, sal_Int32 nXfId ) { - Reference< XText > xText( rxCell, UNO_QUERY ); + Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); rString.convert( xText, nXfId ); + (void)rString; + (void)nXfId; } -void SheetDataBuffer::setStringCell( const Reference< XCell >& rxCell, const CellAddress& /*rCellAddr*/, sal_Int32 nStringId, sal_Int32 nXfId ) +void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, sal_Int32 nStringId, sal_Int32 nXfId ) { - Reference< XText > xText( rxCell, UNO_QUERY ); + Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); getSharedStrings().convertString( xText, nStringId, nXfId ); + (void)nStringId; + (void)nXfId; } -void SheetDataBuffer::setDateTimeCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const DateTime& rDateTime ) +void SheetDataBuffer::setDateTimeCell( const CellAddress& rCellAddr, const DateTime& rDateTime ) { // write serial date/time value into the cell double fSerial = getUnitConverter().calcSerialFromDateTime( rDateTime ); - setValueCell( rxCell, rCellAddr, fSerial ); + setValueCell( rCellAddr, fSerial ); // set appropriate number format using namespace ::com::sun::star::util::NumberFormat; sal_Int16 nStdFmt = (fSerial < 1.0) ? TIME : (((rDateTime.Hours > 0) || (rDateTime.Minutes > 0) || (rDateTime.Seconds > 0)) ? DATETIME : DATE); setStandardNumFmt( rCellAddr, nStdFmt ); } -void SheetDataBuffer::setBooleanCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, bool bValue ) +void SheetDataBuffer::setBooleanCell( const CellAddress& rCellAddr, bool bValue ) { - setFormulaCell( rxCell, rCellAddr, getFormulaParser().convertBoolToFormula( bValue ) ); + setFormulaCell( rCellAddr, getFormulaParser().convertBoolToFormula( bValue ) ); } -void SheetDataBuffer::setErrorCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const OUString& rErrorCode ) +void SheetDataBuffer::setErrorCell( const CellAddress& rCellAddr, const OUString& rErrorCode ) { - setErrorCell( rxCell, rCellAddr, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); + setErrorCell( rCellAddr, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); } -void SheetDataBuffer::setErrorCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, sal_uInt8 nErrorCode ) +void SheetDataBuffer::setErrorCell( const CellAddress& rCellAddr, sal_uInt8 nErrorCode ) { - setFormulaCell( rxCell, rCellAddr, getFormulaParser().convertErrorToFormula( nErrorCode ) ); + setFormulaCell( rCellAddr, getFormulaParser().convertErrorToFormula( nErrorCode ) ); } -void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) +void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) { mbPendingSharedFmla = false; ApiTokenSequence aTokens; @@ -234,11 +204,12 @@ void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const Ce array formula. In this case, the cell will be remembered. After reading the formula definition it will be retried to insert the formula via retryPendingSharedFormulaCell(). */ - aTokens = resolveSharedFormula( aTokenInfo.First ); + BinAddress aBaseAddr( aTokenInfo.First ); + aTokens = resolveSharedFormula( aBaseAddr ); if( !aTokens.hasElements() ) { maSharedFmlaAddr = rCellAddr; - maSharedBaseAddr = aTokenInfo.First; + maSharedBaseAddr = aBaseAddr; mbPendingSharedFmla = true; } } @@ -251,89 +222,42 @@ void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const Ce if( aTokens.hasElements() ) { - Reference< XFormulaTokens > xTokens( rxCell, UNO_QUERY ); + Reference< XFormulaTokens > xTokens( getCell( rCellAddr ), UNO_QUERY ); OSL_ENSURE( xTokens.is(), "SheetDataBuffer::setFormulaCell - missing formula interface" ); if( xTokens.is() ) xTokens->setTokens( aTokens ); } } -void SheetDataBuffer::setFormulaCell( const Reference< XCell >& rxCell, const CellAddress& rCellAddr, sal_Int32 nSharedId ) +void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, sal_Int32 nSharedId ) { - setFormulaCell( rxCell, rCellAddr, resolveSharedFormula( nSharedId ) ); + setFormulaCell( rCellAddr, resolveSharedFormula( BinAddress( nSharedId, 0 ) ) ); } -void SheetDataBuffer::setArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) +void SheetDataBuffer::createArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) { - try - { - Reference< XArrayFormulaTokens > xTokens( getCellRange( rRange ), UNO_QUERY_THROW ); - xTokens->setArrayTokens( rTokens ); - } - catch( Exception& ) - { - } + /* Array formulas will be inserted later in finalizeImport(). This is + needed to not disturb collecting all the cells, which will be put into + the sheet in large blocks to increase performance. */ + maArrayFormulas.push_back( ArrayFormula( rRange, rTokens ) ); } -void SheetDataBuffer::setTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) +void SheetDataBuffer::createTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) { - OSL_ENSURE( getAddressConverter().checkCellRange( rRange, true, false ), "SheetDataBuffer::setTableOperation - invalid range" ); - sal_Int16 nSheet = getSheetIndex(); - bool bOk = false; - if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) - { - CellRangeAddress aOpRange = rRange; - CellAddress aRef1, aRef2; - if( getAddressConverter().convertToCellAddress( aRef1, rModel.maRef1, nSheet, true ) ) try - { - if( rModel.mb2dTable ) - { - if( !rModel.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rModel.maRef2, nSheet, true ) ) - { - // API call expects input values inside operation range - --aOpRange.StartColumn; - --aOpRange.StartRow; - // formula range is top-left cell of operation range - CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow, aOpRange.StartColumn, aOpRange.StartRow ); - // set multiple operation - Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, TableOperationMode_BOTH, aRef2, aRef1 ); - bOk = true; - } - } - else if( rModel.mbRowTable ) - { - // formula range is column to the left of operation range - CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn - 1, aOpRange.StartRow, aOpRange.StartColumn - 1, aOpRange.EndRow ); - // API call expects input values (top row) inside operation range - --aOpRange.StartRow; - // set multiple operation - Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, TableOperationMode_ROW, aRef1, aRef1 ); - bOk = true; - } - else - { - // formula range is row above operation range - CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow - 1, aOpRange.EndColumn, aOpRange.StartRow - 1 ); - // API call expects input values (left column) inside operation range - --aOpRange.StartColumn; - // set multiple operation - Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); - xMultOp->setTableOperation( aFormulaRange, TableOperationMode_COLUMN, aRef1, aRef1 ); - bOk = true; - } - } - catch( Exception& ) - { - } - } + /* Table operations will be inserted later in finalizeImport(). This is + needed to not disturb collecting all the cells, which will be put into + the sheet in large blocks to increase performance. */ + maTableOperations.push_back( TableOperation( rRange, rModel ) ); +} + +void SheetDataBuffer::createSharedFormula( sal_Int32 nSharedId, const ApiTokenSequence& rTokens ) +{ + createSharedFormula( BinAddress( nSharedId, 0 ), rTokens ); +} - // on error: fill cell range with error codes - if( !bOk ) - for( CellAddress aPos( nSheet, rRange.StartColumn, rRange.StartRow ); aPos.Row <= rRange.EndRow; ++aPos.Row ) - for( aPos.Column = rRange.StartColumn; aPos.Column <= rRange.EndColumn; ++aPos.Column ) - setErrorCell( getCell( aPos ), aPos, BIFF_ERR_REF ); +void SheetDataBuffer::createSharedFormula( const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) +{ + createSharedFormula( BinAddress( rCellAddr ), rTokens ); } void SheetDataBuffer::setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ) @@ -356,9 +280,9 @@ void SheetDataBuffer::setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal } } -void SheetDataBuffer::setCellFormat( const CellModel& rModel ) +void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId ) { - if( rModel.mxCell.is() && ((rModel.mnXfId >= 0) || (rModel.mnNumFmtId >= 0)) ) + if( (rModel.mnXfId >= 0) || (nNumFmtId >= 0) ) { // try to merge existing ranges and to write some formatting properties if( !maXfIdRanges.empty() ) @@ -366,7 +290,7 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) // get row index of last inserted cell sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; // row changed - try to merge ranges of last row with existing ranges - if( rModel.maAddress.Row != nLastRow ) + if( rModel.maCellAddr.Row != nLastRow ) { mergeXfIdRanges(); // write format properties of all ranges above last row and remove them @@ -386,8 +310,8 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) } // try to expand last existing range, or create new range entry - if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel ) ) - maXfIdRanges[ BinAddress( rModel.maAddress ) ].set( rModel ); + if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel, nNumFmtId ) ) + maXfIdRanges[ BinAddress( rModel.maCellAddr ) ].set( rModel, nNumFmtId ); // update merged ranges for 'center across selection' and 'fill' if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() ) @@ -398,9 +322,9 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) /* start new merged range, if cell is not empty (#108781#), or try to expand last range with empty cell */ if( rModel.mnCellType != XML_TOKEN_INVALID ) - maCenterFillRanges.push_back( MergedRange( rModel.maAddress, nHorAlign ) ); + maCenterFillRanges.push_back( MergedRange( rModel.maCellAddr, nHorAlign ) ); else if( !maCenterFillRanges.empty() ) - maCenterFillRanges.rbegin()->tryExpand( rModel.maAddress, nHorAlign ); + maCenterFillRanges.rbegin()->tryExpand( rModel.maCellAddr, nHorAlign ); } } } @@ -428,6 +352,14 @@ void SheetDataBuffer::setStandardNumFmt( const CellAddress& rCellAddr, sal_Int16 void SheetDataBuffer::finalizeImport() { + // create all array formulas + for( ArrayFormulaList::iterator aIt = maArrayFormulas.begin(), aEnd = maArrayFormulas.end(); aIt != aEnd; ++aIt ) + finalizeArrayFormula( aIt->first, aIt->second ); + + // create all table operations + for( TableOperationList::iterator aIt = maTableOperations.begin(), aEnd = maTableOperations.end(); aIt != aEnd; ++aIt ) + finalizeTableOperation( aIt->first, aIt->second ); + // write default formatting of remaining row range writeXfIdRowRangeProperties( maXfIdRowRange ); @@ -438,10 +370,9 @@ void SheetDataBuffer::finalizeImport() writeXfIdRangeProperties( aIt->second ); // merge all cached merged ranges and update right/bottom cell borders - MergedRangeList::const_iterator aIt, aEnd; - for( aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) + for( MergedRangeList::iterator aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) finalizeMergedRange( aIt->maRange ); - for( aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) + for( MergedRangeList::iterator aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) finalizeMergedRange( aIt->maRange ); } @@ -484,21 +415,21 @@ bool SheetDataBuffer::XfIdRowRange::tryExpand( sal_Int32 nFirstRow, sal_Int32 nL return false; } -void SheetDataBuffer::XfIdRange::set( const CellModel& rModel ) +void SheetDataBuffer::XfIdRange::set( const CellModel& rModel, sal_Int32 nNumFmtId ) { - maRange.Sheet = rModel.maAddress.Sheet; - maRange.StartColumn = maRange.EndColumn = rModel.maAddress.Column; - maRange.StartRow = maRange.EndRow = rModel.maAddress.Row; + maRange.Sheet = rModel.maCellAddr.Sheet; + maRange.StartColumn = maRange.EndColumn = rModel.maCellAddr.Column; + maRange.StartRow = maRange.EndRow = rModel.maCellAddr.Row; mnXfId = rModel.mnXfId; - mnNumFmtId = rModel.mnNumFmtId; + mnNumFmtId = nNumFmtId; } -bool SheetDataBuffer::XfIdRange::tryExpand( const CellModel& rModel ) +bool SheetDataBuffer::XfIdRange::tryExpand( const CellModel& rModel, sal_Int32 nNumFmtId ) { - if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == rModel.mnNumFmtId) && - (maRange.StartRow == rModel.maAddress.Row) && - (maRange.EndRow == rModel.maAddress.Row) && - (maRange.EndColumn + 1 == rModel.maAddress.Column) ) + if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == nNumFmtId) && + (maRange.StartRow == rModel.maCellAddr.Row) && + (maRange.EndRow == rModel.maCellAddr.Row) && + (maRange.EndColumn + 1 == rModel.maCellAddr.Column) ) { ++maRange.EndColumn; return true; @@ -544,7 +475,83 @@ bool SheetDataBuffer::MergedRange::tryExpand( const CellAddress& rAddress, sal_I return false; } -Reference< XNamedRange > SheetDataBuffer::createSharedFormulaName( const BinAddress& rMapKey ) +void SheetDataBuffer::finalizeArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) +{ + Reference< XArrayFormulaTokens > xTokens( getCellRange( rRange ), UNO_QUERY ); + OSL_ENSURE( xTokens.is(), "SheetDataBuffer::finalizeArrayFormula - missing formula token interface" ); + if( xTokens.is() ) + xTokens->setArrayTokens( rTokens ); +} + +void SheetDataBuffer::finalizeTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) +{ + sal_Int16 nSheet = getSheetIndex(); + bool bOk = false; + if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) ) + { + CellRangeAddress aOpRange = rRange; + CellAddress aRef1; + if( getAddressConverter().convertToCellAddress( aRef1, rModel.maRef1, nSheet, true ) ) try + { + if( rModel.mb2dTable ) + { + CellAddress aRef2; + if( !rModel.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rModel.maRef2, nSheet, true ) ) + { + // API call expects input values inside operation range + --aOpRange.StartColumn; + --aOpRange.StartRow; + // formula range is top-left cell of operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow, aOpRange.StartColumn, aOpRange.StartRow ); + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_BOTH, aRef2, aRef1 ); + bOk = true; + } + } + else if( rModel.mbRowTable ) + { + // formula range is column to the left of operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn - 1, aOpRange.StartRow, aOpRange.StartColumn - 1, aOpRange.EndRow ); + // API call expects input values (top row) inside operation range + --aOpRange.StartRow; + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_ROW, aRef1, aRef1 ); + bOk = true; + } + else + { + // formula range is row above operation range + CellRangeAddress aFormulaRange( nSheet, aOpRange.StartColumn, aOpRange.StartRow - 1, aOpRange.EndColumn, aOpRange.StartRow - 1 ); + // API call expects input values (left column) inside operation range + --aOpRange.StartColumn; + // set multiple operation + Reference< XMultipleOperation > xMultOp( getCellRange( aOpRange ), UNO_QUERY_THROW ); + xMultOp->setTableOperation( aFormulaRange, TableOperationMode_COLUMN, aRef1, aRef1 ); + bOk = true; + } + } + catch( Exception& ) + { + } + } + + // on error: fill cell range with #REF! error codes + if( !bOk ) try + { + Reference< XCellRangeData > xCellRangeData( getCellRange( rRange ), UNO_QUERY_THROW ); + size_t nWidth = static_cast< size_t >( rRange.EndColumn - rRange.StartColumn + 1 ); + size_t nHeight = static_cast< size_t >( rRange.EndRow - rRange.StartRow + 1 ); + Matrix< Any > aErrorCells( nWidth, nHeight, Any( getFormulaParser().convertErrorToFormula( BIFF_ERR_REF ) ) ); + xCellRangeData->setDataArray( ContainerHelper::matrixToSequenceSequence( aErrorCells ) ); + } + catch( Exception& ) + { + } +} + +void SheetDataBuffer::createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens ) { // create the defined name that will represent the shared formula OUString aName = OUStringBuffer().appendAscii( RTL_CONSTASCII_STRINGPARAM( "__shared_" ) ). @@ -552,40 +559,39 @@ Reference< XNamedRange > SheetDataBuffer::createSharedFormulaName( const BinAddr append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ). append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear(); Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName ); + OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" ); PropertySet aNameProps( xNamedRange ); aNameProps.setProperty( PROP_IsSharedFormula, true ); // get and store the token index of the defined name - OSL_ENSURE( maTokenIndexes.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormulaName - key exists already" ); + OSL_ENSURE( maSharedFormulas.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormula - shared formula exists already" ); sal_Int32 nTokenIndex = 0; - if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) ) - maTokenIndexes[ rMapKey ] = nTokenIndex; - - return xNamedRange; -} - -ApiTokenSequence SheetDataBuffer::resolveSharedFormula( sal_Int32 nSharedId ) const -{ - sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maTokenIndexes, BinAddress( nSharedId, 0 ), -1 ); - return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); + if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) try + { + // store the token index in the map + maSharedFormulas[ rMapKey ] = nTokenIndex; + // set the formula definition + Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); + xTokens->setTokens( rTokens ); + // retry to insert a pending shared formula cell + if( mbPendingSharedFmla ) + { + ApiTokenSequence aTokens = resolveSharedFormula( maSharedBaseAddr ); + setFormulaCell( maSharedFmlaAddr, aTokens ); + } + } + catch( Exception& ) + { + } + mbPendingSharedFmla = false; } -ApiTokenSequence SheetDataBuffer::resolveSharedFormula( const CellAddress& rBaseAddr ) const +ApiTokenSequence SheetDataBuffer::resolveSharedFormula( const BinAddress& rMapKey ) const { - sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maTokenIndexes, BinAddress( rBaseAddr ), -1 ); + sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maSharedFormulas, rMapKey, -1 ); return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); } -void SheetDataBuffer::retryPendingSharedFormulaCell() -{ - if( mbPendingSharedFmla ) - { - ApiTokenSequence aTokens = resolveSharedFormula( maSharedBaseAddr ); - setFormulaCell( getCell( maSharedFmlaAddr ), maSharedFmlaAddr, aTokens ); - mbPendingSharedFmla = false; - } -} - void SheetDataBuffer::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const { if( (rXfIdRowRange.mnLastRow >= 0) && (rXfIdRowRange.mnXfId >= 0) ) diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index f387257eaaf0..63db3286cff6 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -37,7 +37,6 @@ #include "oox/xls/biffinputstream.hxx" #include "oox/xls/formulaparser.hxx" #include "oox/xls/richstringcontext.hxx" -#include "oox/xls/sheetdatabuffer.hxx" #include "oox/xls/unitconverter.hxx" namespace oox { @@ -102,9 +101,25 @@ const sal_Int32 BIFF2_CELL_USEIXFE = 63; // ============================================================================ +SheetDataContextBase::SheetDataContextBase( const WorksheetHelper& rHelper ) : + mrAddressConv( rHelper.getAddressConverter() ), + mrFormulaParser( rHelper.getFormulaParser() ), + mrSheetData( rHelper.getSheetData() ), + mnSheet( rHelper.getSheetIndex() ) +{ +} + +SheetDataContextBase::~SheetDataContextBase() +{ +} + +// ============================================================================ + SheetDataContext::SheetDataContext( WorksheetFragmentBase& rFragment ) : WorksheetContextBase( rFragment ), - mrSheetData( getSheetData() ) + SheetDataContextBase( rFragment ), + mbHasFormula( false ), + mbValidRange( false ) { } @@ -117,11 +132,13 @@ ContextHandlerRef SheetDataContext::onCreateContext( sal_Int32 nElement, const A break; case XLS_TOKEN( row ): - if( nElement == XLS_TOKEN( c ) ) { importCell( rAttribs ); return this; } + // do not process cell elements with invalid (out-of-range) address + if( nElement == XLS_TOKEN( c ) && importCell( rAttribs ) ) + return this; break; case XLS_TOKEN( c ): - if( maCurrCell.mxCell.is() ) switch( nElement ) + switch( nElement ) { case XLS_TOKEN( is ): mxInlineStr.reset( new RichString( *this ) ); @@ -142,112 +159,84 @@ void SheetDataContext::onCharacters( const OUString& rChars ) switch( getCurrentElement() ) { case XLS_TOKEN( v ): - maCurrCell.maValue = rChars; + maCellValue = rChars; break; case XLS_TOKEN( f ): - maCurrCell.maFormula = rChars; + if( maFmlaData.mnFormulaType != XML_TOKEN_INVALID ) + maTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, rChars ); break; } } void SheetDataContext::onEndElement() { - switch( getCurrentElement() ) + if( getCurrentElement() == XLS_TOKEN( c ) ) { - case XLS_TOKEN( c ): - if( maCurrCell.mxCell.is() ) - { - // try to create a formula cell - if( maCurrCell.mxCell->getType() == CellContentType_EMPTY ) - { - switch( maCurrCell.mnFormulaType ) - { - case XML_normal: - if( maCurrCell.maFormula.getLength() > 0 ) - { - ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, maCurrCell.maFormula ); - mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); - } - break; - - case XML_array: - if( (maCurrCell.maFormula.getLength() > 0) && (maCurrCell.maFormulaRef.getLength() > 0) ) - { - CellRangeAddress aArrayRange; - if( getAddressConverter().convertToCellRange( aArrayRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) - { - CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); - ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, maCurrCell.maFormula ); - mrSheetData.setArrayFormula( aArrayRange, aTokens ); - } - } - break; - - case XML_shared: - if( maCurrCell.mnSharedId >= 0 ) - { - if( maCurrCell.maFormula.getLength() > 0 ) - mrSheetData.importSharedFmla( maCurrCell.maFormula, maCurrCell.maFormulaRef, maCurrCell.mnSharedId, maCurrCell.maAddress ); - mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.mnSharedId ); - } - break; - - case XML_dataTable: - if( maCurrCell.maFormulaRef.getLength() > 0 ) - { - CellRangeAddress aTableRange; - if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) - mrSheetData.setTableOperation( aTableRange, maTableData ); - } - break; - - default: - OSL_ENSURE( maCurrCell.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onCharacters - unknown formula type" ); - } - } - - // no formula created: try to set the cell value - if( maCurrCell.mxCell->getType() == CellContentType_EMPTY ) + // try to create a formula cell + if( mbHasFormula ) switch( maFmlaData.mnFormulaType ) + { + case XML_normal: + mrSheetData.setFormulaCell( maCellData.maCellAddr, maTokens ); + break; + case XML_shared: + if( maFmlaData.mnSharedId >= 0 ) { - if( maCurrCell.maValue.getLength() > 0 ) - { - switch( maCurrCell.mnCellType ) - { - case XML_n: - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toDouble() ); - break; - case XML_b: - mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toDouble() != 0.0 ); - // #108770# set 'Standard' number format for all Boolean cells - maCurrCell.mnNumFmtId = 0; - break; - case XML_e: - mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue ); - break; - case XML_str: - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue ); - break; - case XML_s: - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, maCurrCell.maValue.toInt32(), maCurrCell.mnXfId ); - break; - } - } - else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() ) - { - mxInlineStr->finalizeImport(); - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, *mxInlineStr, maCurrCell.mnXfId ); - } - else - { - // empty cell, update cell type - maCurrCell.mnCellType = XML_TOKEN_INVALID; - } + if( mbValidRange && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) + mrSheetData.createSharedFormula( maFmlaData.mnSharedId, maTokens ); + mrSheetData.setFormulaCell( maCellData.maCellAddr, maFmlaData.mnSharedId ); } + break; + case XML_array: + if( mbValidRange && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) + mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, maTokens ); + break; + case XML_dataTable: + if( mbValidRange ) + mrSheetData.createTableOperation( maFmlaData.maFormulaRef, maTableData ); + break; + default: + OSL_ENSURE( maFmlaData.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onEndElement - unknown formula type" ); + mbHasFormula = false; + } - // store the cell formatting data - mrSheetData.setCellFormat( maCurrCell ); + if( !mbHasFormula ) + { + // no formula created: try to set the cell value + if( maCellValue.getLength() > 0 ) switch( maCellData.mnCellType ) + { + case XML_n: + mrSheetData.setValueCell( maCellData.maCellAddr, maCellValue.toDouble() ); + break; + case XML_b: + mrSheetData.setBooleanCell( maCellData.maCellAddr, maCellValue.toDouble() != 0.0 ); + break; + case XML_e: + mrSheetData.setErrorCell( maCellData.maCellAddr, maCellValue ); + break; + case XML_str: + mrSheetData.setStringCell( maCellData.maCellAddr, maCellValue ); + break; + case XML_s: + mrSheetData.setStringCell( maCellData.maCellAddr, maCellValue.toInt32(), maCellData.mnXfId ); + break; } - break; + else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr.get() ) + { + mxInlineStr->finalizeImport(); + mrSheetData.setStringCell( maCellData.maCellAddr, *mxInlineStr, maCellData.mnXfId ); + } + else + { + // empty cell, update cell type + maCellData.mnCellType = XML_TOKEN_INVALID; + } + } + + // #108770# set 'Standard' number format for all Boolean cells + bool bBoolCell = !mbHasFormula && (maCellData.mnCellType == XML_b); + sal_Int32 nNumFmtId = bBoolCell ? 0 : -1; + // store the cell formatting data + mrSheetData.setCellFormat( maCellData, nNumFmtId ); } } @@ -311,37 +300,73 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) setRowModel( aModel ); } -void SheetDataContext::importCell( const AttributeList& rAttribs ) +bool SheetDataContext::importCell( const AttributeList& rAttribs ) { - maCurrCell.reset(); - maCurrCell.mxCell = getCell( rAttribs.getString( XML_r, OUString() ), &maCurrCell.maAddress ); - maCurrCell.mnCellType = rAttribs.getToken( XML_t, XML_n ); - maCurrCell.mnXfId = rAttribs.getInteger( XML_s, -1 ); - maCurrCell.mbShowPhonetic = rAttribs.getBool( XML_ph, false ); - mxInlineStr.reset(); + bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, rAttribs.getString( XML_r, OUString() ), mnSheet, true ); + if( bValidAddr ) + { + maCellData.mnCellType = rAttribs.getToken( XML_t, XML_n ); + maCellData.mnXfId = rAttribs.getInteger( XML_s, -1 ); + maCellData.mbShowPhonetic = rAttribs.getBool( XML_ph, false ); - // update used area of the sheet - if( maCurrCell.mxCell.is() ) - extendUsedArea( maCurrCell.maAddress ); + // reset cell value, formula settings, and inline string + maCellValue = OUString(); + mxInlineStr.reset(); + mbHasFormula = false; + + // update used area of the sheet + extendUsedArea( maCellData.maCellAddr ); + } + return bValidAddr; } void SheetDataContext::importFormula( const AttributeList& rAttribs ) { - maCurrCell.maFormulaRef = rAttribs.getString( XML_ref, OUString() ); - maCurrCell.mnFormulaType = rAttribs.getToken( XML_t, XML_normal ); - maCurrCell.mnSharedId = rAttribs.getInteger( XML_si, -1 ); - maTableData.maRef1 = rAttribs.getString( XML_r1, OUString() ); - maTableData.maRef2 = rAttribs.getString( XML_r2, OUString() ); - maTableData.mb2dTable = rAttribs.getBool( XML_dt2D, false ); - maTableData.mbRowTable = rAttribs.getBool( XML_dtr, false ); - maTableData.mbRef1Deleted = rAttribs.getBool( XML_del1, false ); - maTableData.mbRef2Deleted = rAttribs.getBool( XML_del2, false ); + mbHasFormula = true; + mbValidRange = mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, rAttribs.getString( XML_ref, OUString() ), mnSheet, true, true ); + + maFmlaData.mnFormulaType = rAttribs.getToken( XML_t, XML_normal ); + maFmlaData.mnSharedId = rAttribs.getInteger( XML_si, -1 ); + + if( maFmlaData.mnFormulaType == XML_dataTable ) + { + maTableData.maRef1 = rAttribs.getString( XML_r1, OUString() ); + maTableData.maRef2 = rAttribs.getString( XML_r2, OUString() ); + maTableData.mb2dTable = rAttribs.getBool( XML_dt2D, false ); + maTableData.mbRowTable = rAttribs.getBool( XML_dtr, false ); + maTableData.mbRef1Deleted = rAttribs.getBool( XML_del1, false ); + maTableData.mbRef2Deleted = rAttribs.getBool( XML_del2, false ); + } + + // clear token array, will be regenerated from element text + maTokens = ApiTokenSequence(); } -void SheetDataContext::importCellHeader( SequenceInputStream& rStrm, CellType eCellType ) +void SheetDataContext::importRow( SequenceInputStream& rStrm ) { - maCurrCell.reset(); + RowModel aModel; + sal_uInt16 nHeight, nFlags1; + sal_uInt8 nFlags2; + rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2; + // row index is 0-based in BIFF12, but RowModel expects 1-based + aModel.mnFirstRow = aModel.mnLastRow = maCurrPos.mnRow + 1; + // row height is in twips in BIFF12, convert to points + aModel.mfHeight = nHeight / 20.0; + aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 ); + aModel.mbCustomHeight = getFlag( nFlags1, BIFF12_ROW_CUSTOMHEIGHT ); + aModel.mbCustomFormat = getFlag( nFlags1, BIFF12_ROW_CUSTOMFORMAT ); + aModel.mbShowPhonetic = getFlag( nFlags2, BIFF12_ROW_SHOWPHONETIC ); + aModel.mbHidden = getFlag( nFlags1, BIFF12_ROW_HIDDEN ); + aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED ); + aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP ); + aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM ); + // set row properties in the current sheet + setRowModel( aModel ); +} + +bool SheetDataContext::readCellHeader( SequenceInputStream& rStrm, CellType eCellType ) +{ switch( eCellType ) { case CELLTYPE_VALUE: @@ -352,194 +377,166 @@ void SheetDataContext::importCellHeader( SequenceInputStream& rStrm, CellType eC sal_uInt32 nXfId; rStrm >> nXfId; - maCurrCell.mxCell = getCell( maCurrPos, &maCurrCell.maAddress ); - maCurrCell.mnXfId = extractValue< sal_Int32 >( nXfId, 0, 24 ); - maCurrCell.mbShowPhonetic = getFlag( nXfId, BIFF12_CELL_SHOWPHONETIC ); + bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, maCurrPos, mnSheet, true ); + maCellData.mnXfId = extractValue< sal_Int32 >( nXfId, 0, 24 ); + maCellData.mbShowPhonetic = getFlag( nXfId, BIFF12_CELL_SHOWPHONETIC ); // update used area of the sheet - if( maCurrCell.mxCell.is() ) - extendUsedArea( maCurrCell.maAddress ); + if( bValidAddr ) + extendUsedArea( maCellData.maCellAddr ); + return bValidAddr; +} + +ApiTokenSequence SheetDataContext::readCellFormula( SequenceInputStream& rStrm ) +{ + rStrm.skip( 2 ); + return mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); +} + +bool SheetDataContext::readFormulaRef( SequenceInputStream& rStrm ) +{ + BinRange aRange; + rStrm >> aRange; + return mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, aRange, mnSheet, true, true ); } void SheetDataContext::importCellBool( SequenceInputStream& rStrm, CellType eCellType ) { - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_b; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( readCellHeader( rStrm, eCellType ) ) { + maCellData.mnCellType = XML_b; bool bValue = rStrm.readuInt8() != 0; if( eCellType == CELLTYPE_FORMULA ) - { - importCellFormula( rStrm ); - } + mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); else - { - mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, bValue ); - // #108770# set 'Standard' number format for all Boolean cells - maCurrCell.mnNumFmtId = 0; - } + mrSheetData.setBooleanCell( maCellData.maCellAddr, bValue ); + // #108770# set 'Standard' number format for all Boolean cells + sal_Int32 nNumFmtId = (eCellType != CELLTYPE_FORMULA) ? 0 : -1; + mrSheetData.setCellFormat( maCellData, nNumFmtId ); } - mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellBlank( SequenceInputStream& rStrm, CellType eCellType ) { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" ); - importCellHeader( rStrm, eCellType ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, eCellType ) ) + mrSheetData.setCellFormat( maCellData ); } void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eCellType ) { - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_n; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( readCellHeader( rStrm, eCellType ) ) { + maCellData.mnCellType = XML_n; double fValue = rStrm.readDouble(); if( eCellType == CELLTYPE_FORMULA ) - importCellFormula( rStrm ); + mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); else - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, fValue ); + mrSheetData.setValueCell( maCellData.maCellAddr, fValue ); + mrSheetData.setCellFormat( maCellData ); } - mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellError( SequenceInputStream& rStrm, CellType eCellType ) { - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_e; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( readCellHeader( rStrm, eCellType ) ) { + maCellData.mnCellType = XML_e; sal_uInt8 nErrorCode = rStrm.readuInt8(); if( eCellType == CELLTYPE_FORMULA ) - importCellFormula( rStrm ); + mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); else - mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, nErrorCode ); + mrSheetData.setErrorCell( maCellData.maCellAddr, nErrorCode ); + mrSheetData.setCellFormat( maCellData ); } - mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellRk( SequenceInputStream& rStrm, CellType eCellType ) { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRk - no formula cells supported" ); - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_n; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, eCellType ) ) + { + maCellData.mnCellType = XML_n; + mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); + mrSheetData.setCellFormat( maCellData ); + } } void SheetDataContext::importCellRString( SequenceInputStream& rStrm, CellType eCellType ) { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRString - no formula cells supported" ); - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_inlineStr; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( readCellHeader( rStrm, eCellType ) ) { + maCellData.mnCellType = XML_inlineStr; RichString aString( *this ); aString.importString( rStrm, true ); aString.finalizeImport(); - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); + mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); + mrSheetData.setCellFormat( maCellData ); } - mrSheetData.setCellFormat( maCurrCell ); } void SheetDataContext::importCellSi( SequenceInputStream& rStrm, CellType eCellType ) { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellSi - no formula cells supported" ); - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_s; - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readInt32(), maCurrCell.mnXfId ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, eCellType ) ) + { + maCellData.mnCellType = XML_s; + mrSheetData.setStringCell( maCellData.maCellAddr, rStrm.readInt32(), maCellData.mnXfId ); + mrSheetData.setCellFormat( maCellData ); + } } void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eCellType ) { - importCellHeader( rStrm, eCellType ); - maCurrCell.mnCellType = XML_inlineStr; - Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY ); - if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) ) + if( readCellHeader( rStrm, eCellType ) ) { + maCellData.mnCellType = XML_inlineStr; + // always import the string, stream will point to formula afterwards, if existing RichString aString( *this ); aString.importString( rStrm, false ); aString.finalizeImport(); if( eCellType == CELLTYPE_FORMULA ) - importCellFormula( rStrm ); + mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); else - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); + mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); + mrSheetData.setCellFormat( maCellData ); } - mrSheetData.setCellFormat( maCurrCell ); -} - -void SheetDataContext::importCellFormula( SequenceInputStream& rStrm ) -{ - rStrm.skip( 2 ); - ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, FORMULATYPE_CELL, rStrm ); - mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); -} - -void SheetDataContext::importRow( SequenceInputStream& rStrm ) -{ - RowModel aModel; - - sal_uInt16 nHeight, nFlags1; - sal_uInt8 nFlags2; - rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2; - - // row index is 0-based in BIFF12, but RowModel expects 1-based - aModel.mnFirstRow = aModel.mnLastRow = maCurrPos.mnRow + 1; - // row height is in twips in BIFF12, convert to points - aModel.mfHeight = nHeight / 20.0; - aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 ); - aModel.mbCustomHeight = getFlag( nFlags1, BIFF12_ROW_CUSTOMHEIGHT ); - aModel.mbCustomFormat = getFlag( nFlags1, BIFF12_ROW_CUSTOMFORMAT ); - aModel.mbShowPhonetic = getFlag( nFlags2, BIFF12_ROW_SHOWPHONETIC ); - aModel.mbHidden = getFlag( nFlags1, BIFF12_ROW_HIDDEN ); - aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED ); - aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP ); - aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM ); - // set row properties in the current sheet - setRowModel( aModel ); } void SheetDataContext::importArray( SequenceInputStream& rStrm ) { - BinRange aRange; - rStrm >> aRange; - CellRangeAddress aArrayRange; - if( getAddressConverter().convertToCellRange( aArrayRange, aRange, getSheetIndex(), true, true ) ) + if( readFormulaRef( rStrm ) && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) { rStrm.skip( 1 ); - CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); - ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_ARRAY, rStrm ); - mrSheetData.setArrayFormula( aArrayRange, aTokens ); + ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); + mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, aTokens ); } } -void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm ) -{ - mrSheetData.importSharedFmla( rStrm, maCurrCell.maAddress ); -} - void SheetDataContext::importDataTable( SequenceInputStream& rStrm ) { - BinRange aRange; - rStrm >> aRange; - CellRangeAddress aTableRange; - if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true, true ) ) + if( readFormulaRef( rStrm ) ) { - DataTableModel aModel; BinAddress aRef1, aRef2; sal_uInt8 nFlags; rStrm >> aRef1 >> aRef2 >> nFlags; - aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false ); - aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false ); - aModel.mbRowTable = getFlag( nFlags, BIFF12_DATATABLE_ROW ); - aModel.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D ); - aModel.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL ); - aModel.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL ); - mrSheetData.setTableOperation( aTableRange, aModel ); + maTableData.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false ); + maTableData.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false ); + maTableData.mbRowTable = getFlag( nFlags, BIFF12_DATATABLE_ROW ); + maTableData.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D ); + maTableData.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL ); + maTableData.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL ); + mrSheetData.createTableOperation( maFmlaData.maFormulaRef, maTableData ); + } +} + +void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm ) +{ + if( readFormulaRef( rStrm ) && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) + { + ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); + mrSheetData.createSharedFormula( maCellData.maCellAddr, aTokens ); } } @@ -547,7 +544,7 @@ void SheetDataContext::importDataTable( SequenceInputStream& rStrm ) BiffSheetDataContext::BiffSheetDataContext( const WorksheetHelper& rHelper ) : BiffWorksheetContextBase( rHelper ), - mrSheetData( getSheetData() ), + SheetDataContextBase( rHelper ), mnBiff2XfId( 0 ) { switch( getBiff() ) @@ -656,109 +653,160 @@ void BiffSheetDataContext::importRecord( BiffInputStream& rStrm ) // private -------------------------------------------------------------------- -void BiffSheetDataContext::setCurrCell( const BinAddress& rAddr ) +void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) { - maCurrCell.reset(); - maCurrCell.mxCell = getCell( rAddr, &maCurrCell.maAddress ); - // update used area of the sheet - if( maCurrCell.mxCell.is() ) - extendUsedArea( maCurrCell.maAddress ); -} - -void BiffSheetDataContext::importXfId( BiffInputStream& rStrm, bool bBiff2 ) -{ - if( bBiff2 ) - { - /* #i71453# On first call, check if the file contains XF records (by - trying to access the first XF with index 0). If there are no XFs, - the explicit formatting information contained in each cell record - will be used instead. */ - if( !mobBiff2HasXfs ) - mobBiff2HasXfs = getStyles().getCellXf( 0 ).get() != 0; - // read formatting information (includes the XF identifier) - sal_uInt8 nFlags1, nFlags2, nFlags3; - rStrm >> nFlags1 >> nFlags2 >> nFlags3; - /* If the file contains XFs, extract and set the XF identifier, - otherwise get the explicit formatting. */ - if( mobBiff2HasXfs.get() ) - { - maCurrCell.mnXfId = extractValue< sal_Int32 >( nFlags1, 0, 6 ); - /* If the identifier is equal to 63, then the real identifier is - contained in the preceding IXFE record (stored in mnBiff2XfId). */ - if( maCurrCell.mnXfId == BIFF2_CELL_USEIXFE ) - maCurrCell.mnXfId = mnBiff2XfId; - } - else + RowModel aModel; + sal_uInt16 nRow, nHeight; + rStrm >> nRow; + rStrm.skip( 4 ); + rStrm >> nHeight; + if( getBiff() == BIFF2 ) + { + rStrm.skip( 2 ); + aModel.mbCustomFormat = rStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT; + if( aModel.mbCustomFormat ) { - /* Let the Xf class do the API conversion. Keeping the member - maCurrCell.mnXfId untouched will prevent to trigger the usual - XF formatting conversion later on. */ - PropertySet aPropSet( maCurrCell.mxCell ); - Xf::writeBiff2CellFormatToPropertySet( *this, aPropSet, nFlags1, nFlags2, nFlags3 ); + rStrm.skip( 5 ); + aModel.mnXfId = rStrm.readuInt16(); } } else { - maCurrCell.mnXfId = rStrm.readuInt16(); + rStrm.skip( 4 ); + sal_uInt32 nFlags = rStrm.readuInt32(); + aModel.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 ); + aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 ); + aModel.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT ); + aModel.mbCustomHeight = getFlag( nFlags, BIFF_ROW_CUSTOMHEIGHT ); + aModel.mbShowPhonetic = getFlag( nFlags, BIFF_ROW_SHOWPHONETIC ); + aModel.mbHidden = getFlag( nFlags, BIFF_ROW_HIDDEN ); + aModel.mbCollapsed = getFlag( nFlags, BIFF_ROW_COLLAPSED ); + aModel.mbThickTop = getFlag( nFlags, BIFF_ROW_THICKTOP ); + aModel.mbThickBottom = getFlag( nFlags, BIFF_ROW_THICKBOTTOM ); } + + // row index is 0-based in BIFF, but RowModel expects 1-based + aModel.mnFirstRow = aModel.mnLastRow = nRow + 1; + // row height is in twips in BIFF, convert to points + aModel.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0; + // set row properties in the current sheet + setRowModel( aModel ); } -void BiffSheetDataContext::importCellHeader( BiffInputStream& rStrm, bool bBiff2 ) +bool BiffSheetDataContext::readCellXfId( const BinAddress& rAddr, BiffInputStream& rStrm, bool bBiff2 ) +{ + bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, rAddr, mnSheet, true ); + if( bValidAddr ) + { + // update used area of the sheet + extendUsedArea( maCellData.maCellAddr ); + + // load the XF identifier according to current BIFF version + if( bBiff2 ) + { + /* #i71453# On first call, check if the file contains XF records + (by trying to access the first XF with index 0). If there are + no XFs, the explicit formatting information contained in each + cell record will be used instead. */ + if( !mobBiff2HasXfs ) + mobBiff2HasXfs = getStyles().getCellXf( 0 ).get() != 0; + // read formatting information (includes the XF identifier) + sal_uInt8 nFlags1, nFlags2, nFlags3; + rStrm >> nFlags1 >> nFlags2 >> nFlags3; + /* If the file contains XFs, extract and set the XF identifier, + otherwise get the explicit formatting. */ + if( mobBiff2HasXfs.get() ) + { + maCellData.mnXfId = extractValue< sal_Int32 >( nFlags1, 0, 6 ); + /* If the identifier is equal to 63, then the real identifier + is contained in the preceding IXFE record (stored in the + class member mnBiff2XfId). */ + if( maCellData.mnXfId == BIFF2_CELL_USEIXFE ) + maCellData.mnXfId = mnBiff2XfId; + } + else + { + /* Let the Xf class do the API conversion. Keeping the member + maCellData.mnXfId untouched will prevent to trigger the + usual XF formatting conversion later on. */ + PropertySet aPropSet( getCell( maCellData.maCellAddr ) ); + Xf::writeBiff2CellFormatToPropertySet( *this, aPropSet, nFlags1, nFlags2, nFlags3 ); + } + } + else + { + // BIFF3-BIFF8: 16-bit XF identifier + maCellData.mnXfId = rStrm.readuInt16(); + } + } + return bValidAddr; +} + +bool BiffSheetDataContext::readCellHeader( BiffInputStream& rStrm, bool bBiff2 ) { BinAddress aAddr; rStrm >> aAddr; - setCurrCell( aAddr ); - importXfId( rStrm, bBiff2 ); + return readCellXfId( aAddr, rStrm, bBiff2 ); +} + +bool BiffSheetDataContext::readFormulaRef( BiffInputStream& rStrm ) +{ + BinRange aRange; + aRange.read( rStrm, false ); // columns always 8-bit + return mrAddressConv.convertToCellRange( maFmlaData.maFormulaRef, aRange, mnSheet, true, true ); } void BiffSheetDataContext::importBlank( BiffInputStream& rStrm ) { - importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK ) ) + mrSheetData.setCellFormat( maCellData ); } void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) { - importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BOOLERR ); - if( maCurrCell.mxCell.is() ) + if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BOOLERR ) ) { sal_uInt8 nValue, nType; rStrm >> nValue >> nType; switch( nType ) { case BIFF_BOOLERR_BOOL: - maCurrCell.mnCellType = XML_b; - mrSheetData.setBooleanCell( maCurrCell.mxCell, maCurrCell.maAddress, nValue != 0 ); - // #108770# set 'Standard' number format for all Boolean cells - maCurrCell.mnNumFmtId = 0; + maCellData.mnCellType = XML_b; + mrSheetData.setBooleanCell( maCellData.maCellAddr, nValue != 0 ); break; case BIFF_BOOLERR_ERROR: - maCurrCell.mnCellType = XML_e; - mrSheetData.setErrorCell( maCurrCell.mxCell, maCurrCell.maAddress, nValue ); + maCellData.mnCellType = XML_e; + mrSheetData.setErrorCell( maCellData.maCellAddr, nValue ); break; default: OSL_ENSURE( false, "BiffSheetDataContext::importBoolErr - unknown cell type" ); } + // #108770# set 'Standard' number format for all Boolean cells + sal_Int32 nNumFmtId = (nType == BIFF_BOOLERR_BOOL) ? 0 : -1; + mrSheetData.setCellFormat( maCellData, nNumFmtId ); } - mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importFormula( BiffInputStream& rStrm ) { - importCellHeader( rStrm, getBiff() == BIFF2 ); - maCurrCell.mnCellType = XML_n; - rStrm.skip( mnFormulaSkipSize ); - ApiTokenSequence aTokens = getFormulaParser().importFormula( maCurrCell.maAddress, FORMULATYPE_CELL, rStrm ); - mrSheetData.setFormulaCell( maCurrCell.mxCell, maCurrCell.maAddress, aTokens ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, getBiff() == BIFF2 ) ) + { + maCellData.mnCellType = XML_n; + rStrm.skip( mnFormulaSkipSize ); + ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); + mrSheetData.setFormulaCell( maCellData.maCellAddr, aTokens ); + mrSheetData.setCellFormat( maCellData ); + } } void BiffSheetDataContext::importInteger( BiffInputStream& rStrm ) { - importCellHeader( rStrm, true ); - maCurrCell.mnCellType = XML_n; - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readuInt16() ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, true ) ) + { + maCellData.mnCellType = XML_n; + mrSheetData.setValueCell( maCellData.maCellAddr, rStrm.readuInt16() ); + mrSheetData.setCellFormat( maCellData ); + } } void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) @@ -771,143 +819,98 @@ void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) 0x0204 8 -> 2 byte 16-bit length, unicode string */ bool bBiff2Xf = rStrm.getRecId() == BIFF2_ID_LABEL; - importCellHeader( rStrm, bBiff2Xf ); - maCurrCell.mnCellType = XML_inlineStr; - RichString aString( *this ); - if( getBiff() == BIFF8 ) + if( readCellHeader( rStrm, bBiff2Xf ) ) { - aString.importUniString( rStrm ); - } - else - { - // #i63105# use text encoding from FONT record - rtl_TextEncoding eTextEnc = getTextEncoding(); - if( const Font* pFont = getStyles().getFontFromCellXf( maCurrCell.mnXfId ).get() ) - eTextEnc = pFont->getFontEncoding(); - BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT; - setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING ); - aString.importByteString( rStrm, eTextEnc, nFlags ); + maCellData.mnCellType = XML_inlineStr; + RichString aString( *this ); + if( getBiff() == BIFF8 ) + { + aString.importUniString( rStrm ); + } + else + { + // #i63105# use text encoding from FONT record + rtl_TextEncoding eTextEnc = getTextEncoding(); + if( const Font* pFont = getStyles().getFontFromCellXf( maCellData.mnXfId ).get() ) + eTextEnc = pFont->getFontEncoding(); + BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT; + setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING ); + aString.importByteString( rStrm, eTextEnc, nFlags ); + } + aString.finalizeImport(); + mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); + mrSheetData.setCellFormat( maCellData ); } - aString.finalizeImport(); - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, aString, maCurrCell.mnXfId ); - mrSheetData.setCellFormat( maCurrCell ); } void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm ) { - importCellHeader( rStrm, false ); - maCurrCell.mnCellType = XML_s; - mrSheetData.setStringCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readInt32(), maCurrCell.mnXfId ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, false ) ) + { + maCellData.mnCellType = XML_s; + mrSheetData.setStringCell( maCellData.maCellAddr, rStrm.readInt32(), maCellData.mnXfId ); + mrSheetData.setCellFormat( maCellData ); + } } void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm ) { BinAddress aAddr; - for( rStrm >> aAddr; rStrm.getRemaining() > 2; ++aAddr.mnCol ) - { - setCurrCell( aAddr ); - importXfId( rStrm, false ); - mrSheetData.setCellFormat( maCurrCell ); - } + bool bValidAddr = true; + for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) + if( (bValidAddr = readCellXfId( aAddr, rStrm, false )) == true ) + mrSheetData.setCellFormat( maCellData ); } void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm ) { BinAddress aAddr; - for( rStrm >> aAddr; rStrm.getRemaining() > 2; ++aAddr.mnCol ) + bool bValidAddr = true; + for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) { - setCurrCell( aAddr ); - maCurrCell.mnCellType = XML_n; - importXfId( rStrm, false ); - sal_Int32 nRkValue = rStrm.readInt32(); - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( nRkValue ) ); - mrSheetData.setCellFormat( maCurrCell ); + if( (bValidAddr = readCellXfId( aAddr, rStrm, false )) == true ) + { + maCellData.mnCellType = XML_n; + sal_Int32 nRkValue = rStrm.readInt32(); + mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( nRkValue ) ); + mrSheetData.setCellFormat( maCellData ); + } } } void BiffSheetDataContext::importNumber( BiffInputStream& rStrm ) { - importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER ); - maCurrCell.mnCellType = XML_n; - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, rStrm.readDouble() ); - mrSheetData.setCellFormat( maCurrCell ); + if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER ) ) + { + maCellData.mnCellType = XML_n; + mrSheetData.setValueCell( maCellData.maCellAddr, rStrm.readDouble() ); + mrSheetData.setCellFormat( maCellData ); + } } void BiffSheetDataContext::importRk( BiffInputStream& rStrm ) { - importCellHeader( rStrm, false ); - maCurrCell.mnCellType = XML_n; - mrSheetData.setValueCell( maCurrCell.mxCell, maCurrCell.maAddress, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - mrSheetData.setCellFormat( maCurrCell ); -} - -void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) -{ - RowModel aModel; - - sal_uInt16 nRow, nHeight; - rStrm >> nRow; - rStrm.skip( 4 ); - rStrm >> nHeight; - if( getBiff() == BIFF2 ) + if( readCellHeader( rStrm, false ) ) { - rStrm.skip( 2 ); - aModel.mbCustomFormat = rStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT; - if( aModel.mbCustomFormat ) - { - rStrm.skip( 5 ); - aModel.mnXfId = rStrm.readuInt16(); - } - } - else - { - rStrm.skip( 4 ); - sal_uInt32 nFlags = rStrm.readuInt32(); - aModel.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 ); - aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 ); - aModel.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT ); - aModel.mbCustomHeight = getFlag( nFlags, BIFF_ROW_CUSTOMHEIGHT ); - aModel.mbShowPhonetic = getFlag( nFlags, BIFF_ROW_SHOWPHONETIC ); - aModel.mbHidden = getFlag( nFlags, BIFF_ROW_HIDDEN ); - aModel.mbCollapsed = getFlag( nFlags, BIFF_ROW_COLLAPSED ); - aModel.mbThickTop = getFlag( nFlags, BIFF_ROW_THICKTOP ); - aModel.mbThickBottom = getFlag( nFlags, BIFF_ROW_THICKBOTTOM ); + maCellData.mnCellType = XML_n; + mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); + mrSheetData.setCellFormat( maCellData ); } - - // row index is 0-based in BIFF, but RowModel expects 1-based - aModel.mnFirstRow = aModel.mnLastRow = nRow + 1; - // row height is in twips in BIFF, convert to points - aModel.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0; - // set row properties in the current sheet - setRowModel( aModel ); } void BiffSheetDataContext::importArray( BiffInputStream& rStrm ) { - BinRange aRange; - aRange.read( rStrm, false ); // columns always 8-bit - CellRangeAddress aArrayRange; - if( getAddressConverter().convertToCellRange( aArrayRange, aRange, getSheetIndex(), true, true ) ) + if( readFormulaRef( rStrm ) && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) { rStrm.skip( mnArraySkipSize ); - CellAddress aBaseAddr( aArrayRange.Sheet, aArrayRange.StartColumn, aArrayRange.StartRow ); - ApiTokenSequence aTokens = getFormulaParser().importFormula( aBaseAddr, FORMULATYPE_ARRAY, rStrm ); - mrSheetData.setArrayFormula( aArrayRange, aTokens ); + ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); + mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, aTokens ); } } -void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm ) -{ - mrSheetData.importSharedFmla( rStrm, maCurrCell.maAddress ); -} - void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm ) { - BinRange aRange; - aRange.read( rStrm, false ); // columns always 8-bit - CellRangeAddress aTableRange; - if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true, true ) ) + if( readFormulaRef( rStrm ) ) { DataTableModel aModel; BinAddress aRef1, aRef2; @@ -939,7 +942,17 @@ void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm ) } aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false ); aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false ); - mrSheetData.setTableOperation( aTableRange, aModel ); + mrSheetData.createTableOperation( maFmlaData.maFormulaRef, aModel ); + } +} + +void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm ) +{ + if( readFormulaRef( rStrm ) && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) + { + rStrm.skip( 2 ); // flags + ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_SHAREDFORMULA, rStrm ); + mrSheetData.createSharedFormula( maCellData.maCellAddr, aTokens ); } } diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 778adcff24ab..bba52fb0d8f2 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -184,27 +184,6 @@ void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal // ============================================================================ // ============================================================================ -void CellModel::reset() -{ - mxCell.clear(); - maValue = maFormula = maFormulaRef = OUString(); - mnCellType = mnFormulaType = XML_TOKEN_INVALID; - mnSharedId = mnXfId = mnNumFmtId = -1; - mbShowPhonetic = false; -} - -// ---------------------------------------------------------------------------- - -DataTableModel::DataTableModel() : - mb2dTable( false ), - mbRowTable( false ), - mbRef1Deleted( false ), - mbRef2Deleted( false ) -{ -} - -// ---------------------------------------------------------------------------- - ColumnModel::ColumnModel() : mnFirstCol( -1 ), mnLastCol( -1 ), @@ -1430,28 +1409,6 @@ Reference< XCell > WorksheetHelper::getCell( const CellAddress& rAddress ) const return mrSheetGlob.getCell( rAddress ); } -Reference< XCell > WorksheetHelper::getCell( const OUString& rAddressStr, CellAddress* opAddress ) const -{ - CellAddress aAddress; - if( getAddressConverter().convertToCellAddress( aAddress, rAddressStr, mrSheetGlob.getSheetIndex(), true ) ) - { - if( opAddress ) *opAddress = aAddress; - return mrSheetGlob.getCell( aAddress ); - } - return Reference< XCell >(); -} - -Reference< XCell > WorksheetHelper::getCell( const BinAddress& rBinAddress, CellAddress* opAddress ) const -{ - CellAddress aAddress; - if( getAddressConverter().convertToCellAddress( aAddress, rBinAddress, mrSheetGlob.getSheetIndex(), true ) ) - { - if( opAddress ) *opAddress = aAddress; - return mrSheetGlob.getCell( aAddress ); - } - return Reference< XCell >(); -} - Reference< XCellRange > WorksheetHelper::getCellRange( const CellRangeAddress& rRange ) const { return mrSheetGlob.getCellRange( rRange ); -- cgit From 01fcebb5790e99aabf968d48d5915dbe736c3cb3 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 11 Feb 2011 19:12:45 +0100 Subject: dr78: #i107201# find word boundaries in ImpInsertText only if online spelling is active --- editeng/source/editeng/impedit2.cxx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index fe20464eb905..432ed35db2c8 100755 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2756,7 +2756,10 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS // get word boundaries in order to clear possible WrongList entries // and invalidate all the necessary text (everything after and including the // start of the word) - EditSelection aCurWord( SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ) ); + // #i107201# do the expensive SelectWord call only if online spelling is active + EditSelection aCurWord; + if ( GetStatus().DoOnlineSpelling() ) + aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ); XubString aText( rStr ); aText.ConvertLineEnd( LINEEND_LF ); @@ -2813,12 +2816,17 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() ); DBG_ASSERT( pPortion, "Blinde Portion in InsertText" ); - // now remove the Wrongs (red spell check marks) from both words... - WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList(); - if (pWrongs && pWrongs->HasWrongs()) - pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() ); - // ... and mark both words as 'to be checked again' - pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() ); + if ( GetStatus().DoOnlineSpelling() ) + { + // now remove the Wrongs (red spell check marks) from both words... + WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList(); + if (pWrongs && pWrongs->HasWrongs()) + pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() ); + // ... and mark both words as 'to be checked again' + pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() ); + } + else + pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() ); } if ( nEnd < aText.Len() ) aPaM = ImpInsertParaBreak( aPaM ); -- cgit From b2af58218250e3d39d1232dc373b428c13386473 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 14 Feb 2011 10:50:53 +0100 Subject: dr78: #i104716# don't include SC_LAYER_HIDDEN in ScDrawLayer::GetPrintArea --- sc/source/core/data/drwlayer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100755 => 100644 sc/source/core/data/drwlayer.cxx diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx old mode 100755 new mode 100644 index 4df709768279..ba417ee23689 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -767,7 +767,8 @@ BOOL ScDrawLayer::GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) co bFit = FALSE; if ( !bSetVer && ( aObjRect.Bottom() < nStartY || aObjRect.Top() > nEndY ) ) bFit = FALSE; - if ( bFit ) + // #i104716# don't include hidden note objects + if ( bFit && pObject->GetLayer() != SC_LAYER_HIDDEN ) { if (bSetHor) { -- cgit From 4b0358a8edfd003eaf054e1b333661b09213f708 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Mon, 14 Feb 2011 11:28:12 +0100 Subject: tkr38: fixed broken error text print out if nss init fails (PR_GetErrorText doesn't allow NULL parameter) --- .../source/xmlsec/nss/seinitializer_nssimpl.cxx | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 127d7fa43fe6..e42d97ebc756 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -171,6 +171,19 @@ void deleteRootsModule() } } +namespace{ + void getAndPrintPRErrorText() + { + char error[1024] = "Cannot get error text from function PR_GetErrorText()."; + PRInt32 size = PR_GetErrorTextLength(); + if (size < (int) sizeof(error)) + { + PR_GetErrorText(error); + } + xmlsec_trace("%s",error); + } +} + //Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write //the roots certificate module (libnssckbi.so), which they use, into the //profile. This module will then already be loaded during NSS_Init (and the @@ -206,11 +219,7 @@ bool nsscrypto_initialize( const char* token, bool & out_nss_init ) if( NSS_InitReadWrite( token ) != SECSuccess ) { xmlsec_trace("Initializing NSS with profile failed."); - char * error = NULL; - - PR_GetErrorText(error); - if (error) - xmlsec_trace("%s",error); + getAndPrintPRErrorText(); return false ; } } @@ -220,10 +229,7 @@ bool nsscrypto_initialize( const char* token, bool & out_nss_init ) if ( NSS_NoDB_Init(NULL) != SECSuccess ) { xmlsec_trace("Initializing NSS without profile failed."); - char * error = NULL; - PR_GetErrorText(error); - if (error) - xmlsec_trace("%s",error); + getAndPrintPRErrorText(); return false ; } } @@ -296,7 +302,6 @@ bool nsscrypto_initialize( const char* token, bool & out_nss_init ) return return_value; } - // must be extern "C" because we pass the function pointer to atexit extern "C" void nsscrypto_finalize() { @@ -410,19 +415,16 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL rtl::OUString ouCertDir; - if ( getMozillaCurrentProfile(mxMSF, ouCertDir) ) *pDefaultCertDir = rtl::OString(ouCertDir, ouCertDir.getLength(), RTL_TEXTENCODING_ASCII_US); } sCertDir = *pDefaultCertDir; } - if( ! *initNSS( sCertDir.getStr() ) ) { return NULL; } - pCertHandle = CERT_GetDefaultCertDB() ; try -- cgit From bd9e36ca495160994d9f2cd786b3abc44c3859a1 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Mon, 14 Feb 2011 11:58:31 +0100 Subject: tkr38: #i112307# fix nss test run and clean up sources --- xmlsecurity/qa/certext/SanCertExt.cxx | 214 +++++++++++++-------- xmlsecurity/qa/certext/makefile.mk | 130 ++----------- .../xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 6 - .../source/xmlsec/nss/sanextension_nssimpl.cxx | 44 ++--- .../source/xmlsec/nss/sanextension_nssimpl.hxx | 3 +- .../source/xmlsec/nss/x509certificate_nssimpl.cxx | 4 +- 6 files changed, 167 insertions(+), 234 deletions(-) diff --git a/xmlsecurity/qa/certext/SanCertExt.cxx b/xmlsecurity/qa/certext/SanCertExt.cxx index 6110f0f7645e..11d3fa62d5a5 100644 --- a/xmlsecurity/qa/certext/SanCertExt.cxx +++ b/xmlsecurity/qa/certext/SanCertExt.cxx @@ -27,15 +27,18 @@ #include "precompiled_xmlsecurity.hxx" #include "sal/config.h" +#include "test/officeconnection.hxx" -#include "../../source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx" #include #include #include +#include #include #include #include #include +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/Reference.hxx" #include "cppuhelper/bootstrap.hxx" #include "cppunit/TestAssert.h" @@ -49,49 +52,138 @@ #include using namespace com::sun::star; -using ::com::sun::star::lang::XMultiServiceFactory; #define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17" +#define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer" + namespace { -class Test: public CppUnit::TestFixture { + class Test: public CppUnit::TestFixture { -private: + private: + static uno::Sequence< security::CertAltNameEntry > altNames; + static bool runOnce; - static uno::Sequence< security::CertAltNameEntry > altNames; + uno::Reference< xml::crypto::XSecurityEnvironment > initUno(); + void init(); + rtl::OString getB64CertFromFile(const char filename[]); + test::OfficeConnection connection_; - void init(){ - if (altNames.getLength() == 0){ - cppu::defaultBootstrap_InitialComponentContext(); - ne_ssl_certificate* cert = ne_ssl_cert_read("User_35_Root_11.crt"); - char* certExportB64 = ne_ssl_cert_export(cert); + public: - uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv( new SecurityEnvironment_MSCryptImpl( uno::Reference< XMultiServiceFactory >() ) ); + Test(); - uno::Reference< security::XCertificate > xCert = xSecurityEnv->createCertificateFromAscii( - rtl::OStringToOUString( certExportB64, RTL_TEXTENCODING_ASCII_US ) ); + ~Test(); - uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = xCert->getExtensions(); - for (sal_Int32 i = 0 ; i < extensions.getLength(); i++) - { - uno::Reference< security::XCertificateExtension >element = extensions[i]; + virtual void setUp(); - rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength()); - if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME)) - { - uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY ); - altNames = sanExtension->getAlternativeNames(); - break; - } + virtual void tearDown(); + + void test_Others(); + + void test_RFC822(); + + void test_DNS(); + + void test_Direcory(); + + void test_URI(); + + void test_IP(); + + void test_RID(); + + void test_EDI(); + + void test_X400(); + + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test_Others); + CPPUNIT_TEST(test_RFC822); + CPPUNIT_TEST(test_DNS); + CPPUNIT_TEST(test_Direcory); + CPPUNIT_TEST(test_URI); + CPPUNIT_TEST(test_IP); + CPPUNIT_TEST(test_RID); + CPPUNIT_TEST(test_EDI); + CPPUNIT_TEST(test_X400); + CPPUNIT_TEST_SUITE_END(); + }; + + uno::Sequence< security::CertAltNameEntry > Test::altNames; + bool Test::runOnce = false; + + CPPUNIT_TEST_SUITE_REGISTRATION(Test); + + Test::Test() + { + if (runOnce) + return; + runOnce = true; + connection_.setUp(); + init(); + } + + Test::~Test() + { + if (runOnce) + { + connection_.tearDown(); + runOnce = false; + } + } + + + uno::Reference< xml::crypto::XSecurityEnvironment > Test::initUno() + { + uno::Reference< uno::XComponentContext > context(connection_.getComponentContext(), uno::UNO_QUERY_THROW); + uno::Reference< lang::XMultiServiceFactory > factory(context->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference< xml::crypto::XSEInitializer > xSEInitializer(factory->createInstance( + rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT )), uno::UNO_QUERY_THROW); + uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext( + xSEInitializer->createSecurityContext(rtl::OUString())); + return xSecurityContext->getSecurityEnvironment(); + } + + + void Test::init() + { + uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv = initUno(); + rtl::OString b64Cert(getB64CertFromFile("User_35_Root_11.crt")); + uno::Reference< security::XCertificate > xCert = xSecurityEnv->createCertificateFromAscii( + rtl::OStringToOUString( b64Cert, RTL_TEXTENCODING_ASCII_US ) ); + uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = xCert->getExtensions(); + for (sal_Int32 i = 0 ; i < extensions.getLength(); i++) + { + uno::Reference< security::XCertificateExtension >element = extensions[i]; + rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength()); + if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME)) + { + uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY ); + altNames = sanExtension->getAlternativeNames(); + break; } } + } + rtl::OString Test::getB64CertFromFile(const char filename[]) + { + ne_ssl_certificate* cert = ne_ssl_cert_read(filename); + char* certExportB64 = ne_ssl_cert_export(cert); + rtl::OString certB64( certExportB64 ); + return certB64; } -public: - void test_Others() { - init(); + + void Test::setUp() { + } + + void Test::tearDown() { + } + + void Test::test_Others() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_OTHER_NAME) @@ -99,10 +191,7 @@ public: ::com::sun::star::beans::NamedValue otherNameProp; if (altNames[n].Value >>= otherNameProp) { - //Name CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), otherNameProp.Name); - - //Value uno::Sequence< sal_Int8 > ipAddress; otherNameProp.Value >>= ipAddress; CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) ); @@ -111,117 +200,82 @@ public: } } - void test_RFC822() { - init(); + void Test::test_RFC822() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_RFC822_NAME) { rtl::OUString value; altNames[n].Value >>= value; - //Value CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("my@other.address"), value); } } } - void test_DNS() { - init(); + void Test::test_DNS() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_DNS_NAME) { rtl::OUString value; altNames[n].Value >>= value; - //Value CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("alt.openoffice.org"), value); } } } - void test_Direcory() { - init(); - for(int n = 1; n < altNames.getLength(); n++) - { - if (altNames[n].Type == security::ExtAltNameType_DIRECTORY_NAME) - { - uno::Sequence< sal_Int8 > value; - altNames[n].Value >>= value; - //Value - CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( value.getLength() > 0 ) ); - } - } + void Test::test_Direcory() { + // Not implemented } - void test_URI() { - init(); + void Test::test_URI() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_URL) { rtl::OUString value; altNames[n].Value >>= value; - //Value CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("http://my.url.here/"), value); } } } - void test_IP() { - init(); + void Test::test_IP() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_IP_ADDRESS) { uno::Sequence< sal_Int8 > ipAddress; altNames[n].Value >>= ipAddress; - //Value CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) ); } } } - void test_RID() { - init(); + void Test::test_RID() { + CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) ); for(int n = 1; n < altNames.getLength(); n++) { if (altNames[n].Type == security::ExtAltNameType_REGISTERED_ID) { rtl::OUString value; altNames[n].Value >>= value; - //Value - CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), value); + CPPUNIT_ASSERT( rtl::OUString::createFromAscii("1.2.3.4").equals(value)); } } - } - void test_EDI() { + void Test::test_EDI() { // Not implemented } - void test_X400() { + void Test::test_X400() { // Not implemented } - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test_Others); - CPPUNIT_TEST(test_RFC822); - CPPUNIT_TEST(test_DNS); - CPPUNIT_TEST(test_Direcory); - CPPUNIT_TEST(test_URI); - CPPUNIT_TEST(test_IP); - CPPUNIT_TEST(test_RID); - CPPUNIT_TEST(test_EDI); - CPPUNIT_TEST(test_X400); - CPPUNIT_TEST_SUITE_END(); -}; - -uno::Sequence< security::CertAltNameEntry > Test::altNames; - -CPPUNIT_TEST_SUITE_REGISTRATION(Test); - } - CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmlsecurity/qa/certext/makefile.mk b/xmlsecurity/qa/certext/makefile.mk index 36ebb954914c..8cf90b4b4750 100644 --- a/xmlsecurity/qa/certext/makefile.mk +++ b/xmlsecurity/qa/certext/makefile.mk @@ -24,6 +24,9 @@ # for a copy of the LGPLv3 License. # #***********************************************************************/ +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE PRJ = ../.. PRJNAME = xmlsecurity @@ -31,85 +34,9 @@ TARGET = qa_certext ENABLE_EXCEPTIONS = TRUE -.IF "$(OS)" == "WNT" -my_file = file:/// -.ELSE -my_file = file:// -.END - - .INCLUDE: settings.mk .INCLUDE : $(PRJ)$/util$/target.pmk -.IF "$(SYSTEM_LIBXML)" == "YES" -CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) -.ENDIF - -.IF "$(CRYPTO_ENGINE)" == "nss" - -.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES" -.IF "$(SYSTEM_MOZILLA)" != "YES" -@all: - @echo "No mozilla -> no nss -> no libxmlsec -> no xmlsecurity/nss" -.ENDIF -.ENDIF - -.IF "$(SYSTEM_MOZILLA)" != "YES" -MOZ_INC = $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla -NSS_INC = $(MOZ_INC)$/nss -NSPR_INC = $(MOZ_INC)$/nspr -.ELSE -# MOZ_INC already defined from environment -NSS_INC = $(MOZ_NSS_CFLAGS) -NSPR_INC = $(MOZ_INC)$/nspr -.ENDIF - -.IF "$(GUI)"=="UNX" -.IF "$(COMNAME)"=="sunpro5" -CFLAGS += -features=tmplife -#This flag is needed to build mozilla 1.7 code -.ENDIF # "$(COMNAME)"=="sunpro5" -.ENDIF - -.IF "$(GUI)" == "WNT" -.IF "$(DBG_LEVEL)" == "0" -INCPRE += \ --I$(MOZ_INC)$/profile \ --I$(MOZ_INC)$/string \ --I$(MOZ_INC)$/embed_base -CFLAGS += -GR- -W3 -Gy -MD -UDEBUG -.ELSE -INCPRE += \ --I$(MOZ_INC)$/profile \ --I$(MOZ_INC)$/string \ --I$(MOZ_INC)$/embed_base -CFLAGS += -Zi -GR- -W3 -Gy -MDd -UNDEBUG -.ENDIF -.ENDIF -.IF "$(GUI)" == "UNX" -INCPOST += \ -$(MOZ_INC)$/profile \ --I$(MOZ_INC)$/string \ --I$(MOZ_INC)$/embed_base -.ENDIF - -CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT - -SOLARINC += \ - -I$(MOZ_INC) \ --I$(NSPR_INC) \ --I$(PRJ)$/source$/xmlsec - -.IF "$(SYSTEM_MOZILLA)" == "YES" -SOLARINC += -DSYSTEM_MOZILLA $(NSS_INC) -.ELSE -SOLARINC += -I$(NSS_INC) -.ENDIF -.ENDIF - - - - CFLAGSCXX += $(CPPUNIT_CFLAGS) SHL1IMPLIB = i$(SHL1TARGET) @@ -123,44 +50,8 @@ SHL1STDLIBS = $(CPPUNITLIB) \ $(CPPUHELPERLIB) \ $(SVLLIB) \ $(TOOLSLIB) \ - $(COMPHELPERLIB) - - - -.IF "$(OS)"=="SOLARIS" -SHL1STDLIBS +=-ldl -.ENDIF - -.IF "$(SYSTEM_MOZILLA)" == "YES" -.IF "$(NSPR_LIB)" != "" -SHL1STDLIBS += $(NSPR_LIB) -.ENDIF -.IF "$(NSS_LIB)" != "" -SHL1STDLIBS += $(NSS_LIB) -.ENDIF -.ENDIF - -.IF "$(CRYPTO_ENGINE)" == "mscrypto" -SHL1STDLIBS+= $(MSCRYPTOLIBS) -.ELSE -CDEFS += -DNSS_ENGINE -SHL1STDLIBS+= $(NSSCRYPTOLIBS) -.ENDIF - -.IF "$(ENABLE_NSS_MODULE)"=="YES" || "$(SYSTEM_MOZILLA)" == "YES" - -SHL1LIBS= \ - $(SLB)$/xs_comm.lib - -.IF "$(CRYPTO_ENGINE)" == "mscrypto" -SHL1LIBS += \ - $(SLB)$/xs_mscrypt.lib -.ELSE -SHL1LIBS += \ - $(SLB)$/xs_nss.lib -.ENDIF - -.ENDIF + $(COMPHELPERLIB) \ + $(TESTLIB) SHL1TARGET = qa_CertExt SHL1VERSIONMAP = $(PRJ)/qa/certext/export.map @@ -169,9 +60,12 @@ DEF1NAME = $(SHL1TARGET) SLOFILES = $(SLO)/SanCertExt.obj .INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : cpptest + +cpptest : $(SHL1TARGETN) -ALLTAR : test +CPPTEST_LIBRARY = $(SHL1TARGETN) -test .PHONY : $(SHL1TARGETN) - $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/types.rdb +.END \ No newline at end of file diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx index bebc933701b7..d16fee4dd289 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx @@ -114,12 +114,6 @@ sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno: case CERT_ALT_NAME_DIRECTORY_NAME : { arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; - - Sequence< sal_Int8 > directoryName( pEntry->DirectoryName.cbData ) ; - for( unsigned int n = 0; n < pEntry->DirectoryName.cbData ; n++ ) - directoryName[n] = *( pEntry->DirectoryName.pbData + n ) ; - - arrCertAltNameEntry[i].Value <<= directoryName; break; } case CERT_ALT_NAME_URL : diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx index 14b01b69864d..2c66321121db 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -93,20 +93,6 @@ namespace { return length; } - static SECStatus DestroyGeneralName(CERTGeneralName *name) - { - CERTGeneralName *first; - CERTGeneralName *next = NULL; - - first = name; - do { - next = CERT_GetNextGeneralName(name); - PORT_Free(name); - name = next; - } while (name != first); - return SECSuccess; - - } } //Methods from XSanExtension @@ -160,23 +146,16 @@ namespace { case certX400Address: { // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS; - arrCertAltNameEntry[i].value <<= Any.VOID; break; } case certDirectoryName: { + // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; - - char * directoryName = CERT_NameToAscii(¤t->name.directoryName); - - arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(directoryName); - - PORT_Free(directoryName); break; } case certEDIPartyName: { // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME; - arrCertAltNameEntry[i].Value <<= Any.VOID; break; } case certURI: @@ -195,13 +174,13 @@ namespace { } case certRegisterID: arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID; - arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(CERT_GetOidString(¤t->name.other)); - break; - } - // break; - + rtl::OString nssOid = ::rtl::OString(CERT_GetOidString(¤t->name.other)); + rtl::OString unoOid = removeOIDFromString(nssOid); + arrCertAltNameEntry[i].Value <<= rtl::OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US ); + break; + } current = CERT_GetNextGeneralName(current); } @@ -217,6 +196,17 @@ namespace { return m_Entries; } +::rtl::OString SanExtensionImpl :: removeOIDFromString( const ::rtl::OString &oidString) + { + ::rtl::OString objID; + ::rtl::OString oid("OID."); + if (oidString.match(oid)) + objID = oidString.copy(oid.getLength()); + else + objID = oidString; + return objID; + + } //Helper method void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { m_critical = critical ; diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx index 153185c38c6a..88425aa8d125 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx @@ -46,9 +46,10 @@ class SanExtensionImpl : public ::cppu::WeakImplHelper1< sal_Bool m_critical ; ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ; ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ; - ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries; + ::rtl::OString removeOIDFromString( const ::rtl::OString &oid); + public : SanExtensionImpl() ; virtual ~SanExtensionImpl() ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index a9fb57c39769..c8a612fae7e0 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -217,7 +217,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s else objID = oidString; - if ( objId.equals("2.5.29.17") ) + if ( objID.equals("2.5.29.17") ) pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; else pExtn = new CertificateExtension_XmlSecImpl() ; @@ -226,7 +226,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s crit = sal_False ; else crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ; - pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objId.getStr(), objId.getLength(), crit ) ; + pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objID.getStr(), objID.getLength(), crit ) ; xExtns[len] = pExtn ; } -- cgit From b536656082077f58e14e1f730cb075471124d666 Mon Sep 17 00:00:00 2001 From: "Thomas Benisch [tbe]" Date: Wed, 16 Feb 2011 18:34:26 +0100 Subject: chart53: #i116943# Inserted Calc chart loses data --- sc/source/core/tool/charthelper.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index 6c091250c80d..cd8266c4596f 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -309,6 +309,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, if ( xEmbeddedObj.is() ) { bool bDisableDataTableDialog = false; + sal_Int32 nOldState = xEmbeddedObj->getCurrentState(); svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj ); uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY ); if ( xProps.is() && @@ -333,6 +334,10 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, } } } + if ( xEmbeddedObj->getCurrentState() != nOldState ) + { + xEmbeddedObj->changeState( nOldState ); + } } } } -- cgit From 2ec7d4b6d71c6689a32098894ae4ef1bfd637635 Mon Sep 17 00:00:00 2001 From: "Thomas Benisch [tbe]" Date: Wed, 16 Feb 2011 20:17:57 +0100 Subject: chart53: #i116486# Activated Chart has wrong position in RTL if Navigator is docked --- sc/source/ui/view/tabvwshb.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index c6d9b004b9ba..0a92c327dbd3 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -179,6 +179,8 @@ BOOL ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) bErrorShown = TRUE; // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an + SetNewVisArea(); + // attach listener to selection changes in chart that affect cell // ranges, so those can be highlighted // note: do that after DoVerb, so that the chart controller exists -- cgit From 915196492390c9cf1d5a93a4cb5508838a141e4e Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Thu, 17 Feb 2011 09:58:41 +0100 Subject: tkr38: this idl file hangs in odk autodoc build. Addional comments fixed. --- offapi/com/sun/star/security/ExtAltNameType.idl | 33 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/offapi/com/sun/star/security/ExtAltNameType.idl b/offapi/com/sun/star/security/ExtAltNameType.idl index 13ee63936df0..3910772c28c8 100644 --- a/offapi/com/sun/star/security/ExtAltNameType.idl +++ b/offapi/com/sun/star/security/ExtAltNameType.idl @@ -35,50 +35,60 @@ module com { module sun { module star { module security { /** - * Constant definiton of a single entry from Subject Alternative Name extension. - * + * Constant definiton of a certificate container status. */ enum ExtAltNameType { /** * Cutomize name/value pair - * The value of @see com::sun::star::security::CertAltNameEntry contains a NamedValue + * The value of CertAltNameEntry contains a NamedValue. + * + * @see com::sun::star::security::CertAltNameEntry */ OTHER_NAME, /** * The entry contains rfc822 name. - * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry */ RFC822_NAME, /** * The entry contains a dns name. - * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry */ DNS_NAME, /** - * The entry contains a directory name. - * The value of @see com::sun::star::security::CertAltNameEntry contains a Sequence of sal_Int8 + * Currently unsupported. */ DIRECTORY_NAME, /** * The entry contains an url. - * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry */ URL, /** * The entry contains a ip address. - * The value of @see com::sun::star::security::CertAltNameEntry contains a Sequence of sal_Int8 + * The value of CertAltNameEntry contains a Sequence of sal_Int8. + * + * @see com::sun::star::security::CertAltNameEntry */ IP_ADDRESS, /** * The entry contains a registered id. - * The value of @see com::sun::star::security::CertAltNameEntry contains a OUString + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry */ REGISTERED_ID, @@ -91,9 +101,10 @@ enum ExtAltNameType * Currently unsupported. */ X400_ADDRESS + }; } ; } ; } ; } ; #endif - \ No newline at end of file + -- cgit From c9200e42289d06c6335fa15befb0a003f4ad0689 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 18 Feb 2011 19:43:30 +0100 Subject: sw34bf04: #i117001#: txtexppr.cxx: clean up some duplication --- xmloff/source/text/txtexppr.cxx | 117 +++++++++++----------------------------- 1 file changed, 32 insertions(+), 85 deletions(-) diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 7b3c7e828683..1de027ec8623 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -27,8 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#include -#include + +#include "txtexppr.hxx" + #include #include #include @@ -37,7 +38,10 @@ #include #include #include -#include "txtexppr.hxx" + +#include + +#include #include #include "XMLSectionFootnoteConfigExport.hxx" @@ -302,6 +306,26 @@ void XMLTextExportPropertySetMapper::ContextFontHeightFilter( // helper method; implementation below bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&); +static void +lcl_checkMultiProperty(XMLPropertyState *const pState, + XMLPropertyState *const pRelState) +{ + if (pState && pRelState) + { + sal_Int32 nTemp = 0; + pRelState->maValue >>= nTemp; + if (100 == nTemp) + { + pRelState->mnIndex = -1; + pRelState->maValue.clear(); + } + else + { + pState->mnIndex = -1; + pState->maValue.clear(); + } + } +} void XMLTextExportPropertySetMapper::ContextFilter( ::std::vector< XMLPropertyState >& rProperties, @@ -605,88 +629,11 @@ void XMLTextExportPropertySetMapper::ContextFilter( } } - if( pParaLeftMarginState && pParaLeftMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaLeftMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaLeftMarginRelState->mnIndex = -1; - pParaLeftMarginRelState->maValue.clear(); - } - else - { - pParaLeftMarginState->mnIndex = -1; - pParaLeftMarginState->maValue.clear(); - } - - } - - if( pParaRightMarginState && pParaRightMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaRightMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaRightMarginRelState->mnIndex = -1; - pParaRightMarginRelState->maValue.clear(); - } - else - { - pParaRightMarginState->mnIndex = -1; - pParaRightMarginState->maValue.clear(); - } - } - - if( pParaFirstLineState && pParaFirstLineRelState ) - { - sal_Int32 nTemp = 0; - pParaFirstLineRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaFirstLineRelState->mnIndex = -1; - pParaFirstLineRelState->maValue.clear(); - } - else - { - pParaFirstLineState->mnIndex = -1; - pParaFirstLineState->maValue.clear(); - } - } - - if( pParaTopMarginState && pParaTopMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaTopMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaTopMarginRelState->mnIndex = -1; - pParaTopMarginRelState->maValue.clear(); - } - else - { - pParaTopMarginState->mnIndex = -1; - pParaTopMarginState->maValue.clear(); - } - - } - - if( pParaBottomMarginState && pParaBottomMarginRelState ) - { - sal_Int32 nTemp = 0; - pParaBottomMarginRelState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pParaBottomMarginRelState->mnIndex = -1; - pParaBottomMarginRelState->maValue.clear(); - } - else - { - pParaBottomMarginState->mnIndex = -1; - pParaBottomMarginState->maValue.clear(); - } - - } + lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState); + lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState); + lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState); + lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); + lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); if( pAllBorderWidthState ) { -- cgit From 3c5facfce42a0dbe362d6b9fa5ac374fd76f51a1 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 18 Feb 2011 19:47:04 +0100 Subject: sw34bf04: #i117001#: xmloff: support fo:margin --- xmloff/inc/xmloff/PageMasterStyleMap.hxx | 17 +++++ xmloff/inc/xmloff/txtprmap.hxx | 8 +++ xmloff/inc/xmloff/xmltoken.hxx | 2 + xmloff/source/core/xmltoken.cxx | 2 + xmloff/source/style/PageMasterExportPropMapper.cxx | 46 ++++++++++++- xmloff/source/style/PageMasterImportPropMapper.cxx | 79 +++++++++++++++++++--- xmloff/source/style/PageMasterStyleMap.cxx | 28 ++++---- xmloff/source/text/txtexppr.cxx | 16 +++++ xmloff/source/text/txtimppr.cxx | 78 +++++++++++++++++++-- xmloff/source/text/txtprmap.cxx | 27 ++++---- 10 files changed, 263 insertions(+), 40 deletions(-) diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx index 6ca1ba29f2cb..592949ca2b82 100644 --- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx +++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx @@ -83,6 +83,11 @@ #define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017)) #define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018)) #define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019)) +#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A) +#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B) +#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C) +#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D) +#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E) #define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031) #define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032) @@ -118,6 +123,12 @@ #define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) + // footer #define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) #define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) @@ -140,6 +151,12 @@ #define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034)) #define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035)) #define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) + #define CTF_PM_FTN_HEIGTH (XML_PM_CTF_START + 0x0060) #define CTF_PM_FTN_LINE_WEIGTH (XML_PM_CTF_START + 0x0061) #define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx index d64cc1266ef9..a02151cd0993 100644 --- a/xmloff/inc/xmloff/txtprmap.hxx +++ b/xmloff/inc/xmloff/txtprmap.hxx @@ -178,6 +178,14 @@ #define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143) #define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144) #define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145) +#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146) +#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147) +#define CTF_MARGINALL (XML_TEXT_CTF_START + 148) +#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149) +#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150) +#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151) +#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152) + #define TEXT_PROP_MAP_TEXT 0 #define TEXT_PROP_MAP_PARA 1 #define TEXT_PROP_MAP_FRAME 2 diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index ecadbbdc196f..06663cc5e0f3 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3124,6 +3124,8 @@ namespace xmloff { namespace token { XML_MIN_VALUE, XML_MAX_VALUE, + XML_MARGIN, // #i117001# + XML_TOKEN_END }; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 824d28a51a5c..97754ae1e919 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3124,6 +3124,8 @@ namespace xmloff { namespace token { TOKEN( "min-value", XML_MIN_VALUE ), TOKEN( "max-value", XML_MAX_VALUE ), + TOKEN( "margin", XML_MARGIN), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index fe14231e51c4..d803b79b50a1 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -31,9 +31,7 @@ #include #include #include -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include -#endif #include #include #include @@ -84,6 +82,12 @@ void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nInde struct XMLPropertyStateBuffer { + XMLPropertyState* pPMMarginAll; + XMLPropertyState* pPMMarginTop; + XMLPropertyState* pPMMarginBottom; + XMLPropertyState* pPMMarginLeft; + XMLPropertyState* pPMMarginRight; + XMLPropertyState* pPMBorderAll; XMLPropertyState* pPMBorderTop; XMLPropertyState* pPMBorderBottom; @@ -106,7 +110,13 @@ struct XMLPropertyStateBuffer void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); }; -XMLPropertyStateBuffer::XMLPropertyStateBuffer() : +XMLPropertyStateBuffer::XMLPropertyStateBuffer() + : pPMMarginAll( NULL ) + , pPMMarginTop( NULL ) + , pPMMarginBottom( NULL ) + , pPMMarginLeft( NULL ) + , pPMMarginRight( NULL ) + , pPMBorderAll( NULL ), pPMBorderTop( NULL ), pPMBorderBottom( NULL ), @@ -129,6 +139,31 @@ XMLPropertyStateBuffer::XMLPropertyStateBuffer() : void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& ) { + if (pPMMarginAll) + { + if (pPMMarginTop && pPMMarginBottom && pPMMarginLeft && pPMMarginRight) + { + sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0; + + pPMMarginTop->maValue >>= nTop; + pPMMarginBottom->maValue >>= nBottom; + pPMMarginLeft->maValue >>= nLeft; + pPMMarginRight->maValue >>= nRight; + + if ((nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight)) + { + lcl_RemoveState( pPMMarginTop ); + lcl_RemoveState( pPMMarginBottom ); + lcl_RemoveState( pPMMarginLeft ); + lcl_RemoveState( pPMMarginRight ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + else + lcl_RemoveState( pPMMarginAll ); + } + if( pPMBorderAll ) { if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight ) @@ -348,6 +383,11 @@ void XMLPageMasterExportPropMapper::ContextFilter( switch( nSimpleId ) { + case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break; + case CTF_PM_MARGINTOP: pBuffer->pPMMarginTop = pProp; break; + case CTF_PM_MARGINBOTTOM: pBuffer->pPMMarginBottom = pProp; break; + case CTF_PM_MARGINLEFT: pBuffer->pPMMarginLeft = pProp; break; + case CTF_PM_MARGINRIGHT: pBuffer->pPMMarginRight = pProp; break; case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break; case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break; case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break; diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index 59cff11d65cc..4af6e1ce16e1 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -28,14 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" - #include "PageMasterImportPropMapper.hxx" -#ifndef _XMLOFF_PAGEMASTERPROPMAPPER_HXX #include "PageMasterPropMapper.hxx" -#endif -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include -#endif #include #include #include @@ -129,7 +124,15 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& XMLPropertyState* pFooterHeight = NULL; XMLPropertyState* pFooterMinHeight = NULL; XMLPropertyState* pFooterDynamic = NULL; - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllMarginProperty = NULL; + XMLPropertyState* pMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr pNewMargins[4]; + XMLPropertyState* pAllHeaderMarginProperty = NULL; + XMLPropertyState* pHeaderMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr pNewHeaderMargins[4]; + XMLPropertyState* pAllFooterMarginProperty = NULL; + XMLPropertyState* pFooterMargins[4] = { NULL, NULL, NULL, NULL }; + ::std::auto_ptr pNewFooterMargins[4]; ::std::vector< XMLPropertyState >::iterator aEnd = rProperties.end(); for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter) @@ -189,12 +192,60 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& case CTF_PM_HEADERMINHEIGHT : pHeaderMinHeight = property; break; case CTF_PM_FOOTERHEIGHT : pFooterHeight = property; break; case CTF_PM_FOOTERMINHEIGHT : pFooterMinHeight = property; break; + case CTF_PM_MARGINALL : + pAllMarginProperty = property; break; + case CTF_PM_MARGINTOP : + pMargins[XML_LINE_TOP] = property; break; + case CTF_PM_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_MARGINLEFT : + pMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_MARGINRIGHT : + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_HEADERMARGINALL : + pAllHeaderMarginProperty = property; break; + case CTF_PM_HEADERMARGINTOP : + pHeaderMargins[XML_LINE_TOP] = property; break; + case CTF_PM_HEADERMARGINBOTTOM: + pHeaderMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_HEADERMARGINLEFT : + pHeaderMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_HEADERMARGINRIGHT : + pHeaderMargins[XML_LINE_RIGHT] = property; break; + case CTF_PM_FOOTERMARGINALL : + pAllFooterMarginProperty = property; break; + case CTF_PM_FOOTERMARGINTOP : + pFooterMargins[XML_LINE_TOP] = property; break; + case CTF_PM_FOOTERMARGINBOTTOM: + pFooterMargins[XML_LINE_BOTTOM] = property; break; + case CTF_PM_FOOTERMARGINLEFT : + pFooterMargins[XML_LINE_LEFT] = property; break; + case CTF_PM_FOOTERMARGINRIGHT : + pFooterMargins[XML_LINE_RIGHT] = property; break; } } } - for ( i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllMarginProperty && !pMargins[i]) + { + pNewMargins[i].reset(new XMLPropertyState( + pAllMarginProperty->mnIndex + 1 + i, + pAllMarginProperty->maValue)); + } + if (pAllHeaderMarginProperty && !pHeaderMargins[i]) + { + pNewHeaderMargins[i].reset(new XMLPropertyState( + pAllHeaderMarginProperty->mnIndex + 1 + i, + pAllHeaderMarginProperty->maValue)); + } + if (pAllFooterMarginProperty && !pFooterMargins[i]) + { + pNewFooterMargins[i].reset(new XMLPropertyState( + pAllFooterMarginProperty->mnIndex + 1 + i, + pAllFooterMarginProperty->maValue)); + } if (pAllPaddingProperty && !pPadding[i]) pNewPadding[i] = new XMLPropertyState(pAllPaddingProperty->mnIndex + 1 + i, pAllPaddingProperty->maValue); if (pAllBorderProperty && !pBorders[i]) @@ -294,8 +345,20 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& aAny.setValue( &bValue, ::getBooleanCppuType() ); pFooterDynamic = new XMLPropertyState(pFooterMinHeight->mnIndex + 1, aAny); } - for (i = 0; i < 4; i++) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } + if (pNewHeaderMargins[i].get()) + { + rProperties.push_back(*pNewHeaderMargins[i]); + } + if (pNewFooterMargins[i].get()) + { + rProperties.push_back(*pNewFooterMargins[i]); + } if (pNewPadding[i]) { rProperties.push_back(*pNewPadding[i]); diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 6dbda70f5125..41d2172ab4fa 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -28,10 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX #include -#endif -#include "xmloff/xmlnmspe.hxx" + +#include #include using namespace ::xmloff::token; @@ -54,10 +53,11 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ), PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ), PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ), - PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), - PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, 0 ), - PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ), + PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ), + PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ), + PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ), PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ), PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ), @@ -130,9 +130,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ), HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ), HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ), - HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ), + HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ), + HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ), HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ), HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ), @@ -160,9 +161,10 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ), HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ), HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ), - HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ), + HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ), + HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ), HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ), HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ), diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 1de027ec8623..6bca8e8f4e20 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -468,6 +468,9 @@ void XMLTextExportPropertySetMapper::ContextFilter( XMLPropertyState* pClip11State = NULL; XMLPropertyState* pClipState = NULL; + XMLPropertyState* pAllParaMargin = NULL; + XMLPropertyState* pAllMargin = NULL; + sal_Bool bNeedsAnchor = sal_False; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); @@ -584,6 +587,8 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break; case CTF_TEXT_CLIP11: pClip11State = propertie; break; case CTF_TEXT_CLIP: pClipState = propertie; break; + case CTF_PARAMARGINALL: pAllParaMargin = propertie; break; + case CTF_MARGINALL: pAllMargin = propertie; break; } } @@ -635,6 +640,17 @@ void XMLTextExportPropertySetMapper::ContextFilter( lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState); lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState); + if (pAllParaMargin) + { + pAllParaMargin->mnIndex = -1; // just export individual attributes... + pAllParaMargin->maValue.clear(); + } + if (pAllMargin) + { + pAllMargin->mnIndex = -1; // just export individual attributes... + pAllMargin->maValue.clear(); + } + if( pAllBorderWidthState ) { if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState ) diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index dceac7a26890..93e8750b8fb2 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -316,7 +316,12 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pVertOrientRelAsChar = 0; XMLPropertyState* pBackTransparency = NULL; // transparency in % XMLPropertyState* pBackTransparent = NULL; // transparency as boolean - sal_uInt16 i; // for the "for" loop + XMLPropertyState* pAllParaMargin = 0; + XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr pNewParaMargins[4]; + XMLPropertyState* pAllMargin = 0; + XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; + ::std::auto_ptr pNewMargins[4]; for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); @@ -384,7 +389,31 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = sal_True; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; - + case CTF_PARAMARGINALL: + case CTF_PARAMARGINALL_REL: + pAllParaMargin = property; break; + case CTF_PARALEFTMARGIN: + case CTF_PARALEFTMARGIN_REL: + pParaMargins[XML_LINE_LEFT] = property; break; + case CTF_PARARIGHTMARGIN: + case CTF_PARARIGHTMARGIN_REL: + pParaMargins[XML_LINE_RIGHT] = property; break; + case CTF_PARATOPMARGIN: + case CTF_PARATOPMARGIN_REL: + pParaMargins[XML_LINE_TOP] = property; break; + case CTF_PARABOTTOMMARGIN: + case CTF_PARABOTTOMMARGIN_REL: + pParaMargins[XML_LINE_BOTTOM] = property; break; + case CTF_MARGINALL: + pAllMargin = property; break; + case CTF_MARGINLEFT: + pMargins[XML_LINE_LEFT] = property; break; + case CTF_MARGINRIGHT: + pMargins[XML_LINE_RIGHT] = property; break; + case CTF_MARGINTOP: + pMargins[XML_LINE_TOP] = property; break; + case CTF_MARGINBOTTOM: + pMargins[XML_LINE_BOTTOM] = property; break; } } @@ -401,8 +430,31 @@ void XMLTextImportPropertyMapper::finished( FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL ); - for( i = 0; i < 4; i++ ) + for (sal_uInt16 i = 0; i < 4; i++) { + if (pAllParaMargin && !pParaMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllParaMargin->mnIndex + (2*i) + 2 ); + OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN && + nTmp <= CTF_PARABOTTOMMARGIN_REL, + "wrong property context id" ); +#endif + pNewParaMargins[i].reset(new XMLPropertyState( + pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue)); + } + if (pAllMargin && !pMargins[i]) + { +#ifdef DBG_UTIL + sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( + pAllMargin->mnIndex + i + 1 ); + OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM, + "wrong property context id" ); +#endif + pNewMargins[i].reset(new XMLPropertyState( + pAllMargin->mnIndex + i + 1, pAllMargin->maValue)); + } if( pAllBorderDistance && !pBorderDistances[i] ) { #ifdef DBG_UTIL @@ -506,6 +558,16 @@ void XMLTextImportPropertyMapper::finished( } #endif } + + if (pAllParaMargin) + { + pAllParaMargin->mnIndex = -1; + } + if (pAllMargin) + { + pAllMargin->mnIndex = -1; + } + if( pAllBorderDistance ) pAllBorderDistance->mnIndex = -1; @@ -649,8 +711,16 @@ void XMLTextImportPropertyMapper::finished( delete pNewFontCharSetCTL; } - for( i=0; i<4; i++ ) + for (sal_uInt16 i=0; i<4; i++) { + if (pNewParaMargins[i].get()) + { + rProperties.push_back(*pNewParaMargins[i]); + } + if (pNewMargins[i].get()) + { + rProperties.push_back(*pNewMargins[i]); + } if( pNewBorderDistances[i] ) { rProperties.push_back( *pNewBorderDistances[i] ); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index fbc53ef3e16e..ff49ecd234f9 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -27,15 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + +#include + #include -#include "xmloff/xmlnmspe.hxx" + +#include #include -#ifndef _XMLOFF_TXTPRHDL_HXX #include "txtprhdl.hxx" -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX -#include -#endif using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -91,6 +90,9 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // RES_UNKNOWNATR_CONTAINER MP_E( "ParaUserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), // RES_LR_SPACE + // !!! DO NOT REORDER THE MARGINS !!! + MP_E( "ParaLeftMargin", FO, MARGIN, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ), + MP_E( "ParaLeftMarginRelative", FO, MARGIN, XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ), MP_E( "ParaLeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ), MP_E( "ParaLeftMarginRelative", FO, MARGIN_LEFT, XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ), MP_E( "ParaRightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ), @@ -578,11 +580,12 @@ XMLPropertyMapEntry aXMLFramePropMap[] = MG_ED( "VertOrientPosition", SVG, Y, XML_TYPE_MEASURE, 0 ), // ***** The map for automatic styles starts here ***** // RES_LR_SPACE - MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, 0), - MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, 0 ), + MG_E( "LeftMargin", FO, MARGIN, XML_TYPE_MEASURE, CTF_MARGINALL ), + MG_E( "LeftMargin", FO, MARGIN_LEFT, XML_TYPE_MEASURE, CTF_MARGINLEFT ), + MG_E( "RightMargin", FO, MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_MARGINRIGHT ), // RES_UL_SPACE - MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, 0 ), - MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, 0 ), + MG_E( "TopMargin", FO, MARGIN_TOP, XML_TYPE_MEASURE, CTF_MARGINTOP ), + MG_E( "BottomMargin", FO, MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_MARGINBOTTOM ), // RES_PAGEDESC // not required // RES_BREAK @@ -852,7 +855,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_SHAPE_PARA: pMap = &(aXMLParaPropMap[1]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "shape para map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "shape para map changed" ); break; case TEXT_PROP_MAP_PARA: pMap = aXMLParaPropMap; @@ -862,7 +865,7 @@ XMLPropertyMapEntry *lcl_txtprmap_getMap( sal_uInt16 nType ) break; case TEXT_PROP_MAP_AUTO_FRAME: pMap = &(aXMLFramePropMap[13]); - DBG_ASSERT( pMap->meXMLName == XML_MARGIN_LEFT, "frame map changed" ); + OSL_ENSURE( pMap->meXMLName == XML_MARGIN, "frame map changed" ); break; case TEXT_PROP_MAP_SHAPE: pMap = aXMLShapePropMap; -- cgit From f62a54978fd25efb22e0289ce39f85d343b69956 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 18 Feb 2011 19:49:32 +0100 Subject: sw34bf04: #i117001#: sw: support fo:margin on table styles --- sw/source/filter/xml/xmlbrshi.hxx | 8 +- sw/source/filter/xml/xmlimp.hxx | 6 ++ sw/source/filter/xml/xmlimpit.cxx | 17 ++-- sw/source/filter/xml/xmlimpit.hxx | 17 ++-- sw/source/filter/xml/xmlitem.cxx | 5 +- sw/source/filter/xml/xmlitem.hxx | 2 +- sw/source/filter/xml/xmlitemi.cxx | 165 +++++++++++++++++++++++++++++++++----- sw/source/filter/xml/xmlitemm.cxx | 11 ++- 8 files changed, 184 insertions(+), 47 deletions(-) diff --git a/sw/source/filter/xml/xmlbrshi.hxx b/sw/source/filter/xml/xmlbrshi.hxx index eb7f68c56703..c20a323262cf 100644 --- a/sw/source/filter/xml/xmlbrshi.hxx +++ b/sw/source/filter/xml/xmlbrshi.hxx @@ -25,8 +25,12 @@ * ************************************************************************/ -#ifndef _XMLBRSHI_HXX -#define _XMLBRSHI_HXX +#ifndef SW_XMLBRSHI_HXX +#define SW_XMLBRSHI_HXX + +#include + +#include class SvXMLImport; class SvXMLUnitConverter; diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index 7a6a8d9e26c3..c670aaad9073 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -182,6 +182,7 @@ public: inline const SvXMLUnitConverter& GetTwipUnitConverter() const; inline const SvXMLImportItemMapper& GetTableItemMapper() const; + inline SvXMLImportItemMapper& GetTableItemMapper(); SvXMLImportContext *CreateTableItemImportContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< @@ -222,6 +223,11 @@ inline const SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() const return *pTableItemMapper; } +inline SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() +{ + return *pTableItemMapper; +} + inline void SwXMLImport::SetProgressValue( sal_Int32 nValue ) { if ( bShowProgress ) diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index c7e50f9fe8b1..21807917efb3 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -78,11 +78,17 @@ SvXMLImportItemMapper::~SvXMLImportItemMapper() { } +void +SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries ) +{ + mrMapEntries = rMapEntries; +} + /** fills the given itemset with the attributes in the given list */ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, uno::Reference< xml::sax::XAttributeList > xAttrList, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const + const SvXMLNamespaceMap& rNamespaceMap ) { sal_Int16 nAttr = xAttrList->getLength(); @@ -193,7 +199,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet, delete pUnknownItem; } - finished( rSet ); + finished(rSet, rUnitConverter); } /** this method is called for every item that has the @@ -204,7 +210,7 @@ SvXMLImportItemMapper::handleSpecialItem( const SvXMLItemMapEntry& /*rEntry*/, SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { DBG_ERROR( "unsuported special item in xml import" ); return sal_False; @@ -216,13 +222,14 @@ sal_Bool SvXMLImportItemMapper::handleNoItem( const SvXMLItemMapEntry& /*rEntry* SfxItemSet& /*rSet*/, const OUString& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/, - const SvXMLNamespaceMap& /*rNamespaceMap*/ ) const + const SvXMLNamespaceMap& /*rNamespaceMap*/ ) { DBG_ERROR( "unsuported no item in xml import" ); return sal_False; } -void SvXMLImportItemMapper::finished( SfxItemSet& ) const +void +SvXMLImportItemMapper::finished(SfxItemSet &, SvXMLUnitConverter const&) const { // nothing to do here } diff --git a/sw/source/filter/xml/xmlimpit.hxx b/sw/source/filter/xml/xmlimpit.hxx index 703c0372392a..5fb93a33513e 100644 --- a/sw/source/filter/xml/xmlimpit.hxx +++ b/sw/source/filter/xml/xmlimpit.hxx @@ -58,7 +58,7 @@ public: void importXML( SfxItemSet& rSet, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** this method is called for every item that has the MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */ @@ -67,7 +67,7 @@ public: SfxItemSet& rSet, const ::rtl::OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** this method is called for every item that has the MID_SW_FLAG_NO_ITEM_IMPORT flag set */ @@ -75,13 +75,14 @@ public: SfxItemSet& rSet, const ::rtl::OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; + const SvXMLNamespaceMap& rNamespaceMap ); /** This method is called when all attributes have benn processed. It * may be used to remove items that are incomplete */ - virtual void finished( SfxItemSet& rSet ) const; + virtual void finished(SfxItemSet & rSet, + SvXMLUnitConverter const& rUnitConverter) const; - inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); + virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); inline SvXMLItemMapEntriesRef getMapEntries() const; @@ -94,12 +95,6 @@ public: const SvXMLUnitConverter& rUnitConverter ); }; -inline void -SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries ) -{ - mrMapEntries = rMapEntries; -} - inline SvXMLItemMapEntriesRef SvXMLImportItemMapper::getMapEntries() const { diff --git a/sw/source/filter/xml/xmlitem.cxx b/sw/source/filter/xml/xmlitem.cxx index bc040877cee6..86d1880df0b9 100644 --- a/sw/source/filter/xml/xmlitem.cxx +++ b/sw/source/filter/xml/xmlitem.cxx @@ -39,15 +39,14 @@ SvXMLItemSetContext::SvXMLItemSetContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList >& xAttrList, SfxItemSet& rISet, - const SvXMLImportItemMapper& rIMap, + SvXMLImportItemMapper& rIMap, const SvXMLUnitConverter& rUnitConverter ): SvXMLImportContext( rImp, nPrfx, rLName ), rItemSet( rISet ), rIMapper( rIMap ), rUnitConv( rUnitConverter ) - { - rIMapper.importXML( rItemSet, xAttrList, rUnitConv, + rIMap.importXML( rItemSet, xAttrList, rUnitConv, GetImport().GetNamespaceMap() ); } diff --git a/sw/source/filter/xml/xmlitem.hxx b/sw/source/filter/xml/xmlitem.hxx index 2d3e06bec48e..3329c421a658 100644 --- a/sw/source/filter/xml/xmlitem.hxx +++ b/sw/source/filter/xml/xmlitem.hxx @@ -53,7 +53,7 @@ public: const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, SfxItemSet& rItemSet, - const SvXMLImportItemMapper& rIMappper, + SvXMLImportItemMapper& rIMap, const SvXMLUnitConverter& rUnitConv ); virtual ~SvXMLItemSetContext(); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 1a421e6ca5ba..ebb70b49fdae 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -28,37 +28,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - - -#include #include + #include -#include "xmlitmap.hxx" -#include "xmlimpit.hxx" -#include "xmlitem.hxx" + #include #include -#ifndef _XMLOFF_FAMILIES_HXX #include -#endif -#include +#include +#include + #include #include #include #include #include #include +#include -#ifndef _XMLOFF_XMLTABI_HXX -//#include -#endif -#include "xmlbrshi.hxx" +#include + +#include #include #include -#ifndef _UNOMID_H #include -#endif +#include "xmlbrshi.hxx" #include "xmlimp.hxx" +#include "xmlitmap.hxx" +#include "xmlimpit.hxx" +#include "xmlitem.hxx" using ::rtl::OUString; using namespace ::com::sun::star; @@ -82,32 +80,93 @@ public: SfxItemSet& rSet, const OUString& rValue, const SvXMLUnitConverter& rUnitConverter, - const SvXMLNamespaceMap& rNamespaceMap ) const; - virtual void finished( SfxItemSet& rSet ) const; + const SvXMLNamespaceMap& rNamespaceMap ); + + virtual sal_Bool + handleNoItem(SvXMLItemMapEntry const& rEntry, + SfxItemSet & rSet, + ::rtl::OUString const& rValue, + SvXMLUnitConverter const& rUnitConverter, + SvXMLNamespaceMap const& rNamespaceMap); + + virtual void finished(SfxItemSet & rSet, + SvXMLUnitConverter const& rUnitConverter) const; + + virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries ); + +private: + void Reset(); + + ::rtl::OUString m_FoMarginValue; + enum { LEFT = 0, RIGHT = 1, TOP = 2, BOTTOM = 3 }; + bool m_bHaveMargin[4]; }; SwXMLImportTableItemMapper_Impl::SwXMLImportTableItemMapper_Impl( SvXMLItemMapEntriesRef rMapEntries ) : SvXMLImportItemMapper( rMapEntries, RES_UNKNOWNATR_CONTAINER) { + Reset(); } SwXMLImportTableItemMapper_Impl::~SwXMLImportTableItemMapper_Impl() { } +void SwXMLImportTableItemMapper_Impl::Reset() +{ + m_FoMarginValue = ::rtl::OUString(); + for (int i = 0; i < 3; ++i) + { + m_bHaveMargin[i] = false; + } +} + +void SwXMLImportTableItemMapper_Impl::setMapEntries( + SvXMLItemMapEntriesRef rMapEntries ) +{ + Reset(); + SvXMLImportItemMapper::setMapEntries(rMapEntries); +} + sal_Bool SwXMLImportTableItemMapper_Impl::handleSpecialItem( const SvXMLItemMapEntry& rEntry, SfxPoolItem& rItem, SfxItemSet& rItemSet, const OUString& rValue, const SvXMLUnitConverter& rUnitConv, - const SvXMLNamespaceMap& ) const + const SvXMLNamespaceMap& ) { sal_Bool bRet = sal_False; sal_uInt16 nMemberId = static_cast< sal_Int16 >(rEntry.nMemberId & MID_SW_FLAG_MASK); switch( rItem.Which() ) { + case RES_LR_SPACE: + switch (nMemberId) + { + case MID_L_MARGIN: + m_bHaveMargin[LEFT] = true; + break; + case MID_R_MARGIN: + m_bHaveMargin[RIGHT] = true; + break; + } + bRet = SvXMLImportItemMapper::PutXMLValue( + rItem, rValue, nMemberId, rUnitConv); + break; + case RES_UL_SPACE: + switch (nMemberId) + { + case MID_UP_MARGIN: + m_bHaveMargin[TOP] = true; + break; + case MID_LO_MARGIN: + m_bHaveMargin[BOTTOM] = true; + break; + } + bRet = SvXMLImportItemMapper::PutXMLValue( + rItem, rValue, nMemberId, rUnitConv); + break; case RES_FRM_SIZE: switch( nMemberId ) { @@ -125,8 +184,72 @@ sal_Bool SwXMLImportTableItemMapper_Impl::handleSpecialItem( return bRet; } -void SwXMLImportTableItemMapper_Impl::finished( SfxItemSet& /*rSet*/ ) const + +sal_Bool SwXMLImportTableItemMapper_Impl::handleNoItem( + SvXMLItemMapEntry const& rEntry, + SfxItemSet & rSet, + ::rtl::OUString const& rValue, + SvXMLUnitConverter const& rUnitConverter, + SvXMLNamespaceMap const& rNamespaceMap) +{ + if ((XML_NAMESPACE_FO == rEntry.nNameSpace) && + (xmloff::token::XML_MARGIN == rEntry.eLocalName)) + { + m_FoMarginValue = rValue; + return true; + } + else + { + return SvXMLImportItemMapper::handleNoItem( + rEntry, rSet, rValue, rUnitConverter, rNamespaceMap); + } +} + +void SwXMLImportTableItemMapper_Impl::finished( + SfxItemSet & rSet, SvXMLUnitConverter const& rUnitConverter) const { + if (m_FoMarginValue.getLength()) + { + sal_uInt16 const Ids[4][2] = { + { RES_LR_SPACE, MID_L_MARGIN }, + { RES_LR_SPACE, MID_R_MARGIN }, + { RES_UL_SPACE, MID_UP_MARGIN }, + { RES_UL_SPACE, MID_LO_MARGIN }, + }; + for (int i = 0; i < 4; ++i) + { + if (m_bHaveMargin[i]) + { + continue; // already read fo:margin-top etc. + } + // first get item from itemset + SfxPoolItem const* pItem = 0; + SfxItemState eState = + rSet.GetItemState(Ids[i][0], sal_True, &pItem); + + // if not set, try the pool + if ((SFX_ITEM_SET != eState) && (SFX_WHICH_MAX > Ids[i][0])) + { + pItem = &rSet.GetPool()->GetDefaultItem(Ids[i][0]); + } + + // do we have an item? + if (eState >= SFX_ITEM_DEFAULT && pItem) + { + SfxPoolItem *const pNewItem = pItem->Clone(); + bool const bPut = PutXMLValue( + *pNewItem, m_FoMarginValue, Ids[i][1], rUnitConverter); + if (bPut) + { + rSet.Put(*pNewItem); + } + } + else + { + OSL_ENSURE(false, "could not get item"); + } + } + } } // --------------------------------------------------------------------- @@ -142,7 +265,7 @@ public: const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SfxItemSet& rItemSet, - const SvXMLImportItemMapper& rIMapper, + SvXMLImportItemMapper & rIMapper, const SvXMLUnitConverter& rUnitConv ); virtual ~SwXMLItemSetContext_Impl(); @@ -159,7 +282,7 @@ SwXMLItemSetContext_Impl::SwXMLItemSetContext_Impl( const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SfxItemSet& _rItemSet, - const SvXMLImportItemMapper& _rIMapper, + SvXMLImportItemMapper & _rIMapper, const SvXMLUnitConverter& _rUnitConv ) : SvXMLItemSetContext( rImport, nPrfx, rLName, xAttrList, _rItemSet, _rIMapper, _rUnitConv ) diff --git a/sw/source/filter/xml/xmlitemm.cxx b/sw/source/filter/xml/xmlitemm.cxx index e830601fcd18..6e28e9dbb9a0 100644 --- a/sw/source/filter/xml/xmlitemm.cxx +++ b/sw/source/filter/xml/xmlitemm.cxx @@ -48,6 +48,8 @@ using namespace ::xmloff::token; { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m } #define M_E_SE( p, l, w, m ) \ { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|m } +#define M_E_SIE( p, l, w, m ) \ + { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m } #define M_END { 0, XML_TOKEN_INVALID, 0, 0 } @@ -61,11 +63,12 @@ SvXMLItemMapEntry aXMLTableItemMap[] = // RES_PAPER_BIN // not required // TODO: RES_LR_SPACE - M_E_SE( FO, MARGIN_LEFT, RES_LR_SPACE, MID_L_MARGIN ), - M_E_SE( FO, MARGIN_RIGHT, RES_LR_SPACE, MID_R_MARGIN ), + M_E_SE( FO, MARGIN, -1, MID_SW_FLAG_NO_ITEM_IMPORT), + M_E_SIE( FO, MARGIN_LEFT, RES_LR_SPACE, MID_L_MARGIN ), + M_E_SIE( FO, MARGIN_RIGHT, RES_LR_SPACE, MID_R_MARGIN ), // RES_UL_SPACE - MAP_ENTRY( FO, MARGIN_TOP, RES_UL_SPACE, MID_UP_MARGIN ), - MAP_ENTRY( FO, MARGIN_BOTTOM, RES_UL_SPACE, MID_LO_MARGIN ), + M_E_SI( FO, MARGIN_TOP, RES_UL_SPACE, MID_UP_MARGIN ), + M_E_SI( FO, MARGIN_BOTTOM, RES_UL_SPACE, MID_LO_MARGIN ), // RES_PAGEDESC MAP_ENTRY( STYLE, PAGE_NUMBER, RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET), // RES_BREAK -- cgit From 154b8f5a322f94509ec8724ed0f9fb63f8069641 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Tue, 22 Feb 2011 09:21:09 +0100 Subject: cws dba34c: the celldescription control is visible at all database types --- testautomation/dbaccess/tools/tabletools.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testautomation/dbaccess/tools/tabletools.inc b/testautomation/dbaccess/tools/tabletools.inc index 461ef8ff2da3..132671e3bfe9 100644 --- a/testautomation/dbaccess/tools/tabletools.inc +++ b/testautomation/dbaccess/tools/tabletools.inc @@ -340,7 +340,9 @@ function fCreateTable(aFieldTypeContent(),sTableName,optional sCatalog,optional sleep 1 FieldType.TypeKeys "" , TRUE Description.TypeKeys "" , TRUE - CellDescription.TypeKeys "" , TRUE + if( CellDescription.isVisible() ) then + CellDescription.TypeKeys "" , TRUE + endif printlog "-------------------------------" next sleep(1) -- cgit From 307556af7f3802f71b9c28643021513d6256f084 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 22 Feb 2011 09:47:59 +0100 Subject: dba34c: #i117036# call getFrom clause before getSelect --- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index e088fb75641f..966da2722ff0 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -286,8 +286,9 @@ public class SQLQueryComposer bincludeGrouping = _bincludeGrouping; if (addQuery) { + StringBuilder fromClause = getFromClause(); String sSelectClause = getSelectClause(_baddAliasFieldNames); - StringBuilder queryclause = new StringBuilder(sSelectClause).append(" ").append(getFromClause()); + StringBuilder queryclause = new StringBuilder(sSelectClause).append(" ").append(fromClause); m_xQueryAnalyzer.setQuery(queryclause.toString()); if (CurDBMetaData.getFilterConditions() != null && CurDBMetaData.getFilterConditions().length > 0) { -- cgit From 6b0f29593fd4753cc32e7a955d79642cf868e43f Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Tue, 22 Feb 2011 10:17:34 +0100 Subject: tkr38: #i112307# build errors on mingw fixed --- xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx index d16fee4dd289..9c47a853d470 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx @@ -105,11 +105,11 @@ sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno: } case CERT_ALT_NAME_RFC822_NAME : arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME; - arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszRfc822Name); + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszRfc822Name); break; case CERT_ALT_NAME_DNS_NAME : arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME; - arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszDNSName); + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszDNSName); break; case CERT_ALT_NAME_DIRECTORY_NAME : { @@ -118,7 +118,7 @@ sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno: } case CERT_ALT_NAME_URL : arrCertAltNameEntry[i].Type = ExtAltNameType_URL; - arrCertAltNameEntry[i].Value <<= ::rtl::OUString(pEntry->pwszURL); + arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszURL); break; case CERT_ALT_NAME_IP_ADDRESS : { -- cgit From 0ce16968e3dc0893462944b828195fbf14acbe9f Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 23 Feb 2011 09:40:45 +0100 Subject: dba34c: #i117046# check if query exists --- dbaccess/qa/complex/dbaccess/Query.java | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java index e78f6859fb88..2ea435bcd10c 100644 --- a/dbaccess/qa/complex/dbaccess/Query.java +++ b/dbaccess/qa/complex/dbaccess/Query.java @@ -90,23 +90,26 @@ public class Query extends TestCase { for ( int i = 0; i < queryNames.length; ++i ) { - final XPropertySet query = UnoRuntime.queryInterface( - XPropertySet.class, queries.getByName( queryNames[i] ) ); + if (queries.hasByName(queryNames[i])) + { + final XPropertySet query = UnoRuntime.queryInterface( + XPropertySet.class, queries.getByName( queryNames[i] ) ); - final XColumnsSupplier suppCols = UnoRuntime.queryInterface( - XColumnsSupplier.class, query); - final XIndexAccess columns = UnoRuntime.queryInterface( - XIndexAccess.class, suppCols.getColumns()); + final XColumnsSupplier suppCols = UnoRuntime.queryInterface( + XColumnsSupplier.class, query); + final XIndexAccess columns = UnoRuntime.queryInterface( + XIndexAccess.class, suppCols.getColumns()); - // check whether the columns supplied by the query match what we expected - assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"", - columns.getCount() == expectedColumnNames[i].length ); - for ( int col = 0; col < columns.getCount(); ++col ) - { - final XNamed columnName = UnoRuntime.queryInterface( - XNamed.class, columns.getByIndex(col) ); - assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching", - columnName.getName().equals( expectedColumnNames[i][col] ) ); + // check whether the columns supplied by the query match what we expected + assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"", + columns.getCount() == expectedColumnNames[i].length ); + for ( int col = 0; col < columns.getCount(); ++col ) + { + final XNamed columnName = UnoRuntime.queryInterface( + XNamed.class, columns.getByIndex(col) ); + assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching", + columnName.getName().equals( expectedColumnNames[i][col] ) ); + } } } } -- cgit From c3d9cd5435a4ff1d98fbd12482b04ccf5d322067 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 23 Feb 2011 11:36:11 +0100 Subject: dba34c: #i117043# fix modified state of rowset --- connectivity/source/commontools/FValue.cxx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 95aabb821b1a..2d9ef1a219f8 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -787,11 +787,8 @@ sal_Bool operator==(const DateTime& _rLH,const DateTime& _rRH) bool ORowSetValue::operator==(const ORowSetValue& _rRH) const { - if(m_eTypeKind != _rRH.m_eTypeKind) - return false; - if ( m_bSigned != _rRH.m_bSigned ) - return false; - if(m_bNull != _rRH.isNull()) + if ( m_eTypeKind != _rRH.m_eTypeKind || + m_bNull != _rRH.isNull()) return false; if(m_bNull && _rRH.isNull()) return true; @@ -802,16 +799,29 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const { case DataType::VARCHAR: case DataType::CHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: case DataType::LONGVARCHAR: { ::rtl::OUString aVal1(m_aValue.m_pString); ::rtl::OUString aVal2(_rRH.m_aValue.m_pString); - bRet = aVal1 == aVal2; + return aVal1 == aVal2; break; } + default: + if ( m_bSigned != _rRH.m_bSigned ) + return false; + break; + } + switch(m_eTypeKind) + { + case DataType::DECIMAL: + case DataType::NUMERIC: + { + ::rtl::OUString aVal1(m_aValue.m_pString); + ::rtl::OUString aVal2(_rRH.m_aValue.m_pString); + bRet = aVal1 == aVal2; + } + break; case DataType::FLOAT: bRet = *(float*)m_aValue.m_pValue == *(float*)_rRH.m_aValue.m_pValue; break; -- cgit From 9a2ce2d264be1ee44ac8406b39e821f7752d6947 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 23 Feb 2011 11:36:11 +0100 Subject: dba34c: #i117043# fix modified state of rowset --- dbaccess/qa/complex/dbaccess/Query.java | 16 +++--- dbaccess/qa/complex/dbaccess/RowSet.java | 4 ++ dbaccess/source/core/api/RowSet.cxx | 90 +++++++++++++++++--------------- dbaccess/source/core/api/RowSetBase.cxx | 9 +++- dbaccess/source/core/api/RowSetBase.hxx | 3 +- dbaccess/source/core/api/RowSetCache.cxx | 64 ++++++++++++++--------- 6 files changed, 110 insertions(+), 76 deletions(-) diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java index 2ea435bcd10c..40af4387bb5c 100644 --- a/dbaccess/qa/complex/dbaccess/Query.java +++ b/dbaccess/qa/complex/dbaccess/Query.java @@ -40,7 +40,8 @@ import org.junit.Test; import static org.junit.Assert.*; // ------------------------------------------ -public class Query extends TestCase { +public class Query extends TestCase +{ connectivity.tools.HsqlDatabase m_database; @@ -49,17 +50,17 @@ public class Query extends TestCase { { try { - if ( m_database == null ) + if (m_database == null) { - final CRMDatabase database = new CRMDatabase( getMSF(), false ); + final CRMDatabase database = new CRMDatabase(getMSF(), false); m_database = database.getDatabase(); } } - catch( Exception e ) + catch (Exception e) { - System.out.println( "could not create the test case, error message:\n" + e.getMessage() ); - e.printStackTrace( System.err ); - fail( "failed to created the test case"); + System.out.println("could not create the test case, error message:\n" + e.getMessage()); + e.printStackTrace(System.err); + fail("failed to created the test case"); } } @@ -68,7 +69,6 @@ public class Query extends TestCase { // { // return (XMultiServiceFactory)param.getMSF(); // } - // -------------------------------------------------------------------------------------------------------- @Test public void testQueryColumns() diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index 7716f7f30512..921aff2046ef 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -434,6 +434,10 @@ public class RowSet extends TestCase updRow.updateString(2, TEST21); testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null); + moves[RowSetEventListener.IS_MODIFIED] = false; + updRow.updateString(2, m_row.getString(2)); + testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null); + moves[RowSetEventListener.IS_MODIFIED] = false; final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate"); final XResultSetUpdate upd = UnoRuntime.queryInterface( XResultSetUpdate.class, m_resultSet ); diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 4118794d5b52..38220bcade48 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -595,6 +595,7 @@ void ORowSet::freeResources( bool _bComplete ) m_bAfterLast = sal_False; m_bNew = sal_False; m_bModified = sal_False; + m_bIsInsertRow = sal_False; m_bLastKnownRowCountFinal = sal_False; m_nLastKnownRowCount = 0; if ( m_aOldRow.isValid() ) @@ -707,6 +708,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } // ------------------------------------------------------------------------- @@ -722,6 +724,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, R ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } // ------------------------------------------------------------------------- @@ -819,6 +822,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } // ------------------------------------------------------------------------- @@ -862,6 +866,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } } @@ -875,6 +880,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } // ------------------------------------------------------------------------- @@ -892,52 +898,49 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) throwFunctionSequenceException(*this); - if(m_bModified) - { - // remember old value for fire - sal_Bool bOld = m_bNew; + // remember old value for fire + sal_Bool bOld = m_bNew; - ORowSetRow aOldValues; - if ( !m_aCurrentRow.isNull() ) - aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); - Sequence aChangedBookmarks; - RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks); - notifyAllListenersRowBeforeChange(aGuard,aEvt); + ORowSetRow aOldValues; + if ( !m_aCurrentRow.isNull() ) + aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); + Sequence aChangedBookmarks; + RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks); + notifyAllListenersRowBeforeChange(aGuard,aEvt); - ::std::vector< Any > aBookmarks; - sal_Bool bInserted = m_pCache->insertRow(aBookmarks); + ::std::vector< Any > aBookmarks; + sal_Bool bInserted = m_pCache->insertRow(aBookmarks); - // make sure that our row is set to the new inserted row before clearing the insert flags in the cache - m_pCache->resetInsertRow(bInserted); + // make sure that our row is set to the new inserted row before clearing the insert flags in the cache + m_pCache->resetInsertRow(bInserted); - // notification order - // - column values - setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here + // notification order + // - column values + setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here - // read-only flag restored - impl_restoreDataColumnsWriteable_throw(); + // read-only flag restored + impl_restoreDataColumnsWriteable_throw(); - // - rowChanged - notifyAllListenersRowChanged(aGuard,aEvt); + // - rowChanged + notifyAllListenersRowChanged(aGuard,aEvt); - if ( !aBookmarks.empty() ) - { - RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence(&(*aBookmarks.begin()),aBookmarks.size())); - notifyAllListenersRowChanged(aGuard,aUpEvt); - } + if ( !aBookmarks.empty() ) + { + RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence(&(*aBookmarks.begin()),aBookmarks.size())); + notifyAllListenersRowChanged(aGuard,aUpEvt); + } - // - IsModified - if(!m_bModified) - fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); - OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" ); + // - IsModified + if(!m_bModified) + fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" ); - // - IsNew - if(m_bNew != bOld) - fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld); + // - IsNew + if(m_bNew != bOld) + fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld); - // - RowCount/IsRowCountFinal - fireRowcount(); - } + // - RowCount/IsRowCountFinal + fireRowcount(); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) @@ -946,7 +949,7 @@ sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) checkCache(); // check if we are inserting a row - return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow(); + return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow(); } // ------------------------------------------------------------------------- void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) @@ -975,6 +978,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) aEvt.Rows += aBookmarks.size(); m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).isValid() ) { if ( m_pCache->isResultSetChanged() ) @@ -1085,6 +1089,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; m_aCurrentRow.setBookmark(m_aBookmark); // notification order @@ -1219,6 +1224,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) m_pCache->moveToInsertRow(); m_aCurrentRow = m_pCache->m_aInsertRow; + m_bIsInsertRow = sal_True; // set read-only flag to false impl_setDataColumnsWriteable_throw(); @@ -1829,6 +1835,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi } m_pCache->setFetchSize(m_nFetchSize); m_aCurrentRow = m_pCache->createIterator(this); + m_bIsInsertRow = sal_False; m_aOldRow = m_pCache->registerOldRow(); } @@ -2716,6 +2723,7 @@ void ORowSet::doCancelModification( ) m_pCache->cancelRowModification(); } m_bModified = sal_False; + m_bIsInsertRow = sal_False; } // ----------------------------------------------------------------------------- @@ -2739,14 +2747,12 @@ sal_Bool ORowSet::isNew( ) // ----------------------------------------------------------------------------- void ORowSet::checkUpdateIterator() { - if(!m_bModified && !m_bNew) + if(!m_bIsInsertRow) { m_pCache->setUpdateIterator(m_aCurrentRow); m_aCurrentRow = m_pCache->m_aInsertRow; - m_bModified = sal_True; - } // if(!m_bModified && !m_bNew) - else if ( m_bNew ) // here we are modifing a value - m_bModified = sal_True; + m_bIsInsertRow = sal_True; + } } // ----------------------------------------------------------------------------- void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 4cb218d628b6..b8f489d65728 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -112,6 +112,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp ,m_bIgnoreResult(sal_False) ,m_bBeforeFirst(sal_True) // changed from sal_False ,m_bAfterLast(sal_False) + ,m_bIsInsertRow(sal_False) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::ORowSetBase" ); DBG_CTOR(ORowSetBase,NULL); @@ -257,6 +258,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) // currentrow is null when the clone moves the window positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null."); bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); @@ -398,6 +400,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS { positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null."); bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); @@ -1121,6 +1124,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR m_aBookmark = m_pCache->getBookmark(); OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!"); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!"); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!"); @@ -1136,6 +1140,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR #endif OSL_ENSURE(nOldRow == nNewRow,"Old position is not equal to new postion"); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!"); #if OSL_DEBUG_LEVEL > 0 ORowSetRow rRow = (*m_aCurrentRow); @@ -1147,6 +1152,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR { positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!"); } } @@ -1574,7 +1580,8 @@ void ORowSetNotifier::firePropertyChange() { m_pRowSet->firePropertyChange((*aIter)-1 ,m_pImpl->aRow[(*aIter)-1], ORowSetBase::GrantNotifierAccess()); } - m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess()); + if ( !m_pImpl->aChangedColumns.empty() ) + m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess()); } } } // namespace dbaccess diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx index 9a7e9182e1d0..83b4d2fb74ef 100644 --- a/dbaccess/source/core/api/RowSetBase.hxx +++ b/dbaccess/source/core/api/RowSetBase.hxx @@ -158,6 +158,7 @@ namespace dbaccess sal_Bool m_bIgnoreResult ; sal_Bool m_bBeforeFirst : 1; sal_Bool m_bAfterLast : 1; + sal_Bool m_bIsInsertRow : 1; protected: ORowSetBase( @@ -383,7 +384,7 @@ namespace dbaccess inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); } inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); } inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); } - inline sal_Bool isInsertRow() { return isNew() || isModified(); } + inline sal_Bool isInsertRow() { return m_bIsInsertRow; } // isNew() || isModified(); } inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& ) { fireProperty( _nProperty, _bNew, _bOld ); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 2d4355edcaef..6f3ec5e53265 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -555,13 +555,16 @@ void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector& checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex].setNull(); - rInsert[columnIndex].setModified(); - io_aRow[columnIndex].setNull(); + if ( !rInsert[columnIndex].isNull() ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex].setNull(); + rInsert[columnIndex].setModified(); + io_aRow[columnIndex].setNull(); - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } // ----------------------------------------------------------------------------- void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x @@ -572,13 +575,16 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + if ( rInsert[columnIndex] != x ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = x; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } // ------------------------------------------------------------------------- void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x @@ -610,13 +616,18 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + ORowSetValue aTemp; + aTemp.fill(x); + if ( rInsert[columnIndex] != aTemp ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = aTemp; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } // ------------------------------------------------------------------------- void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ @@ -627,13 +638,18 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + ORowSetValue aTemp; + aTemp.fill(x); + if ( rInsert[columnIndex] != aTemp ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = aTemp; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } // ------------------------------------------------------------------------- // XResultSet -- cgit From e80d8ed59936df66e30c8dc7501caa18b711af16 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 23 Feb 2011 13:10:19 +0100 Subject: dba34c: #i108415# fix for strings --- connectivity/source/commontools/predicateinput.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 9d088c903dcc..dbac44b72424 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -406,7 +406,11 @@ namespace dbtools } else { - pOdbcSpec->getChild(1)->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); + OSQLParseNode* pValueNode = pOdbcSpec->getChild(1); + if ( SQL_NODE_STRING == pValueNode->getNodeType() ) + sReturn = pValueNode->getTokenValue(); + else + pValueNode->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True); // sReturn = pOdbcSpec->getChild(1)->getTokenValue(); } } -- cgit From 968263e4c26dd510afbf998cbaf970de92615691 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 23 Feb 2011 16:09:08 +0100 Subject: dba34c: special comparison of double values --- connectivity/source/commontools/FValue.cxx | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 2d9ef1a219f8..5ea0e601a9c3 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -787,9 +787,32 @@ sal_Bool operator==(const DateTime& _rLH,const DateTime& _rRH) bool ORowSetValue::operator==(const ORowSetValue& _rRH) const { - if ( m_eTypeKind != _rRH.m_eTypeKind || - m_bNull != _rRH.isNull()) + if ( m_eTypeKind != _rRH.m_eTypeKind ) + { + switch(m_eTypeKind) + { + case DataType::FLOAT: + case DataType::DOUBLE: + case DataType::REAL: + return getDouble() == _rRH.getDouble(); + break; + default: + switch(_rRH.m_eTypeKind) + { + case DataType::FLOAT: + case DataType::DOUBLE: + case DataType::REAL: + return getDouble() == _rRH.getDouble(); + break; + default: + break; + } + break; + } return false; + } + if ( m_bNull != _rRH.isNull() ) + return false; if(m_bNull && _rRH.isNull()) return true; -- cgit From 4f06bfae891d1b7b80e0e17be9623536f31ae9ac Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 25 Feb 2011 16:43:02 +0100 Subject: dr78: #164376# use XCellRangeData to increase import performance --- oox/inc/oox/helper/containerhelper.hxx | 48 ++- oox/inc/oox/xls/pivotcachebuffer.hxx | 11 +- oox/inc/oox/xls/pivotcachefragment.hxx | 6 +- oox/inc/oox/xls/richstring.hxx | 32 +- oox/inc/oox/xls/sharedstringsbuffer.hxx | 11 +- oox/inc/oox/xls/sheetdatabuffer.hxx | 217 +++++++++---- oox/inc/oox/xls/sheetdatacontext.hxx | 2 +- oox/inc/oox/xls/worksheethelper.hxx | 45 ++- oox/source/helper/containerhelper.cxx | 53 +++ oox/source/xls/autofilterbuffer.cxx | 2 +- oox/source/xls/commentsbuffer.cxx | 2 +- oox/source/xls/pivotcachebuffer.cxx | 73 +++-- oox/source/xls/pivotcachefragment.cxx | 26 +- oox/source/xls/richstring.cxx | 67 ++-- oox/source/xls/sharedstringsbuffer.cxx | 6 +- oox/source/xls/sheetdatabuffer.cxx | 552 +++++++++++++++++++++++--------- oox/source/xls/sheetdatacontext.cxx | 194 ++++++----- oox/source/xls/worksheetfragment.cxx | 42 +-- oox/source/xls/worksheethelper.cxx | 351 ++++++++++---------- 19 files changed, 1144 insertions(+), 596 deletions(-) diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx index d6c9721ef0a8..1f5874070a7b 100644 --- a/oox/inc/oox/helper/containerhelper.hxx +++ b/oox/inc/oox/helper/containerhelper.hxx @@ -28,8 +28,8 @@ #ifndef OOX_HELPER_CONTAINERHELPER_HXX #define OOX_HELPER_CONTAINERHELPER_HXX -#include #include +#include #include #include @@ -47,6 +47,52 @@ namespace oox { // ============================================================================ +/** A range of signed 32-bit integer values. */ +struct ValueRange +{ + sal_Int32 mnFirst; + sal_Int32 mnLast; + + inline explicit ValueRange( sal_Int32 nValue = 0 ) : mnFirst( nValue ), mnLast( nValue ) {} + inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {} + + inline bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); } + inline bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); } + inline bool contains( sal_Int32 nValue ) const { return (mnFirst <= nValue) && (nValue <= mnLast); } + inline bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); } + inline bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); } +}; + +// ---------------------------------------------------------------------------- + +typedef ::std::vector< ValueRange > ValueRangeVector; + +// ---------------------------------------------------------------------------- + +/** An ordered list of value ranges. The insertion operation will merge + consecutive value ranges. + */ +class ValueRangeSet +{ +public: + inline explicit ValueRangeSet() {} + + /** Inserts the passed value into the range list. */ + inline void insert( sal_Int32 nValue ) { insert( ValueRange( nValue ) ); } + /** Inserts the passed value range into the range list. */ + void insert( const ValueRange& rRange ); + + /** Returns the ordered list of all value ranges. */ + inline const ValueRangeVector& getRanges() const { return maRanges; } + /** Returns an intersection of the range list and the passed range. */ + ValueRangeVector getIntersection( const ValueRange& rRange ) const; + +private: + ValueRangeVector maRanges; +}; + +// ============================================================================ + /** Template for a 2-dimensional array of objects. This class template provides a similar interface to the ::std::vector diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx index 2e32d0faa7e5..eeb2d7a02dd9 100644 --- a/oox/inc/oox/xls/pivotcachebuffer.hxx +++ b/oox/inc/oox/xls/pivotcachebuffer.hxx @@ -31,6 +31,7 @@ #include #include #include +#include "oox/helper/containerhelper.hxx" #include "oox/helper/refvector.hxx" #include "oox/xls/workbookhelper.hxx" @@ -430,15 +431,15 @@ public: void writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const; /** Writes a source field item value into the passed sheet. */ void writeSourceDataCell( WorksheetHelper& rSheetHelper, - sal_Int32 nCol, sal_Int32 nRow, + sal_Int32 nColIdx, sal_Int32 nRowIdx, const PivotCacheItem& rItem ) const; /** Reads a PCRECORD record and writes all item values to the passed sheet. */ void importPCRecord( SequenceInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const; + WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; /** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */ void importPCItemIndexList( BiffInputStream& rStrm, - WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const; + WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const; private: /** Reads the worksheet source range from the DCONREF record. */ @@ -456,6 +457,8 @@ private: void finalizeExternalSheetSource(); /** Creates a dummy sheet that will be filled with the pivot cache data. */ void prepareSourceDataSheet(); + /** Checks, if the row index has changed since last call, and initializes the sheet data buffer. */ + void updateSourceDataRow( WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const; private: typedef RefVector< PivotCacheField > PivotCacheFieldVector; @@ -467,7 +470,9 @@ private: PCDefinitionModel maDefModel; /// Global pivot cache settings. PCSourceModel maSourceModel; /// Pivot cache source settings. PCWorksheetSourceModel maSheetSrcModel; /// Sheet source data if cache type is sheet. + ValueRangeSet maColSpans; /// Column spans used by SheetDataBuffer for optimized cell import. ::rtl::OUString maTargetUrl; /// URL of an external source document. + mutable sal_Int32 mnCurrRow; /// Current row index in dummy sheet. bool mbValidSource; /// True = pivot cache is based on supported data source. bool mbDummySheet; /// True = pivot cache is based on a dummy sheet. }; diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx index f82c1f5cfe29..8cb72b31a39c 100644 --- a/oox/inc/oox/xls/pivotcachefragment.hxx +++ b/oox/inc/oox/xls/pivotcachefragment.hxx @@ -97,8 +97,8 @@ private: private: const PivotCache& mrPivotCache; - sal_Int32 mnCol; - sal_Int32 mnRow; + sal_Int32 mnColIdx; /// Relative column index in source data. + sal_Int32 mnRowIdx; /// Relative row index in source data. bool mbInRecord; }; @@ -142,7 +142,7 @@ private: const PivotCache& mrPivotCache; ColumnIndexVector maUnsharedCols; /// Column indexes of all unshared cache fields. size_t mnColIdx; /// Current index into maUnsharedCols. - sal_Int32 mnRow; /// Current row in source data (0-based). + sal_Int32 mnRowIdx; /// Current row in source data (0-based). bool mbHasShared; /// True = pivot cache contains fields with shared items. bool mbInRow; /// True = a data row has been started. }; diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx index 4c4aecee2ec1..ab8313c35373 100644 --- a/oox/inc/oox/xls/richstring.hxx +++ b/oox/inc/oox/xls/richstring.hxx @@ -70,11 +70,13 @@ public: /** Returns the text data of this portion. */ inline const ::rtl::OUString& getText() const { return maText; } + /** Returns true, if the portion fontains font formatting. */ + inline bool hasFont() const { return mxFont.get() != 0; } - /** Converts the portion and appends it to the passed XText. */ + /** Converts the portion and replaces or appends to the passed XText. */ void convert( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - sal_Int32 nXfId, bool bReplaceOld = false ); + const Font* pFont, bool bReplace ); private: ::rtl::OUString maText; /// Portion text. @@ -256,10 +258,20 @@ public: /** Final processing after import of all strings. */ void finalizeImport(); - /** Converts the string and writes it into the passed XText. */ + /** Tries to extract a plain string from this object. Returns the string, + if there is only one unformatted portion. */ + bool extractPlainString( + ::rtl::OUString& orString, + const Font* pFirstPortionFont = 0 ) const; + + /** Converts the string and writes it into the passed XText. + @param rxText The XText interface of the target object. + @param bReplaceOld True = replace old contents of the text object. + @param pFirstPortionFont Optional font providing additional rich-text + formatting for the first text portion, e.g. font escapement. */ void convert( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - sal_Int32 nXfId, bool bReplaceOld = false ) const; + const Font* pFirstPortionFont = 0 ) const; private: /** Creates, appends, and returns a new empty string portion. */ @@ -268,19 +280,19 @@ private: RichStringPhoneticRef createPhonetic(); /** Create base text portions from the passed string and character formatting. */ - void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ); + void createTextPortions( const ::rtl::OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ); /** Create base text portions from the passed string and character formatting. */ - void createFontPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions ); + void createTextPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions ); /** Create phonetic text portions from the passed string and portion data. */ void createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen ); private: - typedef RefVector< RichStringPortion > PortionVec; - typedef RefVector< RichStringPhonetic > PhoneticVec; + typedef RefVector< RichStringPortion > PortionVector; + typedef RefVector< RichStringPhonetic > PhoneticVector; - PortionVec maFontPortions; /// String portions with font data. + PortionVector maTextPortions; /// String portions with font data. PhoneticSettings maPhonSettings; /// Phonetic settings for this string. - PhoneticVec maPhonPortions; /// Phonetic text portions. + PhoneticVector maPhonPortions; /// Phonetic text portions. }; typedef ::boost::shared_ptr< RichString > RichStringRef; diff --git a/oox/inc/oox/xls/sharedstringsbuffer.hxx b/oox/inc/oox/xls/sharedstringsbuffer.hxx index eff8ab4e7738..936eb6766ef4 100644 --- a/oox/inc/oox/xls/sharedstringsbuffer.hxx +++ b/oox/inc/oox/xls/sharedstringsbuffer.hxx @@ -49,15 +49,12 @@ public: /** Final processing after import of all strings. */ void finalizeImport(); - /** Converts the specified string table entry. */ - void convertString( - const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, - sal_Int32 nStringId, - sal_Int32 nXfId ) const; + /** Returns the specified string. */ + RichStringRef getString( sal_Int32 nStringId ) const; private: - typedef RefVector< RichString > StringVec; - StringVec maStrings; + typedef RefVector< RichString > StringVector; + StringVector maStrings; }; // ============================================================================ diff --git a/oox/inc/oox/xls/sheetdatabuffer.hxx b/oox/inc/oox/xls/sheetdatabuffer.hxx index 878d225ff81f..6f61c8432e15 100755 --- a/oox/inc/oox/xls/sheetdatabuffer.hxx +++ b/oox/inc/oox/xls/sheetdatabuffer.hxx @@ -30,6 +30,7 @@ #include #include +#include "oox/xls/richstring.hxx" #include "oox/xls/worksheethelper.hxx" namespace com { namespace sun { namespace star { @@ -89,6 +90,95 @@ struct DataTableModel // ============================================================================ +/** Stores position and contents of a range of cells for optimized import. */ +class CellBlock : public WorksheetHelper +{ +public: + explicit CellBlock( const WorksheetHelper& rHelper, const ValueRange& rColSpan, sal_Int32 nRow ); + + /** Returns true, if the end index of the passed colspan is greater than + the own column end index, or if the passed range has the same end index + but the start indexes do not match. */ + bool isBefore( const ValueRange& rColSpan ) const; + /** Returns true, if the cell block can be expanded with the passed colspan. */ + bool isExpandable( const ValueRange& rColSpan ) const; + /** Returns true, if the own colspan contains the passed column. */ + bool contains( sal_Int32 nCol ) const; + + /** Returns the specified cell from the last row in the cell buffer array. */ + ::com::sun::star::uno::Any& getCellAny( sal_Int32 nCol ); + /** Inserts a rich-string into the cell block. */ + void insertRichString( + const ::com::sun::star::table::CellAddress& rAddress, + const RichStringRef& rxString, + const Font* pFirstPortionFont ); + + /** Appends a new row to the cell buffer array. */ + void startNextRow(); + /** Writes all buffered cells into the Calc sheet. */ + void finalizeImport(); + +private: + /** Fills unused cells before passed index with empty strings. */ + void fillUnusedCells( sal_Int32 nIndex ); + +private: + /** Stores position and string data of a rich-string cell. */ + struct RichStringCell + { + ::com::sun::star::table::CellAddress + maCellAddr; /// The address of the rich-string cell. + RichStringRef mxString; /// The string with rich formatting. + const Font* mpFirstPortionFont; /// Font information from cell for first text portion. + + explicit RichStringCell( + const ::com::sun::star::table::CellAddress& rCellAddr, + const RichStringRef& rxString, + const Font* pFirstPortionFont ); + }; + typedef ::std::list< RichStringCell > RichStringCellList; + + ::com::sun::star::table::CellRangeAddress + maRange; /// Cell range covered by this cell block. + RichStringCellList maRichStrings; /// Cached rich-string cells. + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > + maCellArray; /// The array of cells of this cell block. + ::com::sun::star::uno::Any* + mpCurrCellRow; /// Pointer to first cell of current row (last row in maCellArray). + const sal_Int32 mnRowLength; /// Number of cells covered by row of this cell block. + sal_Int32 mnFirstFreeIndex; /// Relative index of first unused cell in current row. +}; + +// ============================================================================ + +/** Manages all cell blocks currently in use. */ +class CellBlockBuffer : public WorksheetHelper +{ +public: + explicit CellBlockBuffer( const WorksheetHelper& rHelper ); + + /** Sets column span information for a row. */ + void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ); + + /** Tries to find a cell block. Recalculates the map of cell blocks, if the + passed cell address is located in another row than the last cell. */ + CellBlock* getCellBlock( const ::com::sun::star::table::CellAddress& rCellAddr ); + + /** Inserts all cells of all open cell blocks into the Calc document. */ + void finalizeImport(); + +private: + typedef ::std::map< sal_Int32, ValueRangeVector > ColSpanVectorMap; + typedef RefMap< sal_Int32, CellBlock > CellBlockMap; + + ColSpanVectorMap maColSpans; /// Buffereed column spans, mapped by row index. + CellBlockMap maCellBlocks; /// All open cell blocks, mapped by last (!) column of the block span. + CellBlockMap::iterator maCellBlockIt; /// Pointer to cell block currently in use. + sal_Int32 mnCurrRow; /// Current row index used for buffered cell import. +}; + +// ============================================================================ + /** Manages the cell contents and cell formatting of a sheet. */ class SheetDataBuffer : public WorksheetHelper @@ -96,46 +186,31 @@ class SheetDataBuffer : public WorksheetHelper public: explicit SheetDataBuffer( const WorksheetHelper& rHelper ); - /** Sets the passed value to the cell. */ - void setValueCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - double fValue ); - /** Sets the passed string to the cell. */ - void setStringCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ::rtl::OUString& rText ); - /** Sets the passed rich-string to the cell. */ - void setStringCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const RichString& rString, sal_Int32 nXfId ); - /** Sets the shared string with the passed identifier to the cell. */ - void setStringCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - sal_Int32 nStringId, sal_Int32 nXfId ); - /** Sets the passed date/time value to the cell and adjusts number format. */ - void setDateTimeCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ::com::sun::star::util::DateTime& rDateTime ); - /** Sets the passed boolean value to the cell and adjusts number format. */ - void setBooleanCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - bool bValue ); - /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ - void setErrorCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ::rtl::OUString& rErrorCode ); - /** Sets the passed BIFF error code to the cell (by converting it to a formula). */ - void setErrorCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - sal_uInt8 nErrorCode ); - /** Sets the passed formula token sequence to the cell. */ - void setFormulaCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - const ApiTokenSequence& rTokens ); - /** Sets the shared formula with the passed identifier to the cell (OOXML only). */ - void setFormulaCell( - const ::com::sun::star::table::CellAddress& rCellAddr, - sal_Int32 nSharedId ); + /** Sets column span information for a row. */ + void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ); + + /** Inserts a blank cell (with formatting) into the sheet. */ + void setBlankCell( const CellModel& rModel ); + /** Inserts a value cell into the sheet. */ + void setValueCell( const CellModel& rModel, double fValue ); + /** Inserts a simple string cell into the sheet. */ + void setStringCell( const CellModel& rModel, const ::rtl::OUString& rText ); + /** Inserts a rich-string cell into the sheet. */ + void setStringCell( const CellModel& rModel, const RichStringRef& rxString ); + /** Inserts a shared string cell into the sheet. */ + void setStringCell( const CellModel& rModel, sal_Int32 nStringId ); + /** Inserts a date/time cell into the sheet and adjusts number format. */ + void setDateTimeCell( const CellModel& rModel, const ::com::sun::star::util::DateTime& rDateTime ); + /** Inserts a boolean cell into the sheet and adjusts number format. */ + void setBooleanCell( const CellModel& rModel, bool bValue ); + /** Inserts an error cell from the passed error code into the sheet. */ + void setErrorCell( const CellModel& rModel, const ::rtl::OUString& rErrorCode ); + /** Inserts an error cell from the passed BIFF error code into the sheet. */ + void setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode ); + /** Inserts a formula cell into the sheet. */ + void setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens ); + /** Inserts a shared formula cell into the sheet (OOXML only). */ + void setFormulaCell( const CellModel& rModel, sal_Int32 nSharedId ); /** Inserts the passed token array as array formula. */ void createArrayFormula( @@ -157,10 +232,7 @@ public: const ApiTokenSequence& rTokens ); /** Sets default cell formatting for the specified range of rows. */ - void setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ); - /** Processes the cell formatting data of the passed cell. - @param nNumFmtId If set, overrides number format of the cell XF. */ - void setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId = -1 ); + void setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat ); /** Merges the cells in the passed cell range. */ void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the specified cell. */ @@ -175,14 +247,10 @@ private: struct XfIdRowRange; struct XfIdRange; - /** Inserts the passed array formula into the sheet. */ - void finalizeArrayFormula( - const ::com::sun::star::table::CellRangeAddress& rRange, + /** Sets the passed formula token array into a cell. */ + void setCellFormula( + const ::com::sun::star::table::CellAddress& rCellAddr, const ApiTokenSequence& rTokens ); - /** Inserts the passed table operation into the sheet. */ - void finalizeTableOperation( - const ::com::sun::star::table::CellRangeAddress& rRange, - const DataTableModel& rModel ); /** Creates a named range with a special name for a shared formula with the specified base address and formula definition. */ @@ -191,6 +259,19 @@ private: passed identifier. */ ApiTokenSequence resolveSharedFormula( const BinAddress& rMapKey ) const; + /** Inserts the passed array formula into the sheet. */ + void finalizeArrayFormula( + const ::com::sun::star::table::CellRangeAddress& rRange, + const ApiTokenSequence& rTokens ) const; + /** Inserts the passed table operation into the sheet. */ + void finalizeTableOperation( + const ::com::sun::star::table::CellRangeAddress& rRange, + const DataTableModel& rModel ) const; + + /** Processes the cell formatting data of the passed cell. + @param nNumFmtId If set, overrides number format of the cell XF. */ + void setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId = -1 ); + /** Writes all cell formatting attributes to the passed row range. */ void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const; /** Writes all cell formatting attributes to the passed cell range. */ @@ -202,21 +283,29 @@ private: void finalizeMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange ); private: - typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula; - typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, DataTableModel > TableOperation; + /** Stores cell range address and formula token array of an array formula. */ + typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula; + typedef ::std::list< ArrayFormula > ArrayFormulaList; + + /** Stores cell range address and settings of a table operation. */ + typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, DataTableModel > TableOperation; + typedef ::std::list< TableOperation > TableOperationList; + + typedef ::std::map< BinAddress, sal_Int32 > SharedFormulaMap; + /** Stores information about a range of rows with equal cell formatting. */ struct XfIdRowRange { - sal_Int32 mnFirstRow; /// Index of first row. - sal_Int32 mnLastRow; /// Index of last row. + ValueRange maRowRange; /// Indexes of first and last row. sal_Int32 mnXfId; /// XF identifier for the row range. explicit XfIdRowRange(); bool intersects( const ::com::sun::star::table::CellRangeAddress& rRange ) const; - void set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); - bool tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ); + void set( sal_Int32 nRow, sal_Int32 nXfId ); + bool tryExpand( sal_Int32 nRow, sal_Int32 nXfId ); }; + /** Stores information about a range of cells with equal formatting. */ struct XfIdRange { ::com::sun::star::table::CellRangeAddress @@ -224,11 +313,13 @@ private: sal_Int32 mnXfId; /// XF identifier for the range. sal_Int32 mnNumFmtId; /// Number format overriding the XF. - void set( const CellModel& rModel, sal_Int32 nNumFmtId ); - bool tryExpand( const CellModel& rModel, sal_Int32 nNumFmtId ); + void set( const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId ); + bool tryExpand( const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId ); bool tryMerge( const XfIdRange& rXfIdRange ); }; + typedef ::std::map< BinAddress, XfIdRange > XfIdRangeMap; + /** Stores information about a merged cell range. */ struct MergedRange { ::com::sun::star::table::CellRangeAddress @@ -239,13 +330,9 @@ private: explicit MergedRange( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); bool tryExpand( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign ); }; + typedef ::std::list< MergedRange > MergedRangeList; - typedef ::std::list< ArrayFormula > ArrayFormulaList; - typedef ::std::list< TableOperation > TableOperationList; - typedef ::std::map< BinAddress, sal_Int32 > SharedFormulaMap; - typedef ::std::map< BinAddress, XfIdRange > XfIdRangeMap; - typedef ::std::list< MergedRange > MergedRangeList; - + CellBlockBuffer maCellBlocks; /// Manages all open cell blocks. ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet. TableOperationList maTableOperations; /// All table operations in the sheet. SharedFormulaMap maSharedFormulas; /// Maps shared formula base address to defined name token index. diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx index 60948ab9f70d..c5104dec8e8b 100644 --- a/oox/inc/oox/xls/sheetdatacontext.hxx +++ b/oox/inc/oox/xls/sheetdatacontext.hxx @@ -144,7 +144,7 @@ private: void importRow( BiffInputStream& rStrm ); /** Reads an XF identifier and initializes a new cell. */ - bool readCellXfId( const BinAddress& rAddr, BiffInputStream& rStrm, bool bBiff2 ); + bool readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 ); /** Reads a BIFF cell address and the following XF identifier. */ bool readCellHeader( BiffInputStream& rStrm, bool bBiff2 ); /** Reads the formula range used by shared formulas, arrays, and data tables. */ diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index 27754c898608..e87599409528 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -28,6 +28,7 @@ #ifndef OOX_XLS_WORKSHEETHELPER_HXX #define OOX_XLS_WORKSHEETHELPER_HXX +#include "oox/helper/containerhelper.hxx" #include "oox/helper/progressbar.hxx" #include "oox/ole/olehelper.hxx" #include "oox/xls/addressconverter.hxx" @@ -56,6 +57,7 @@ class BiffSheetDrawing; class BinRangeList; class CommentsBuffer; class CondFormatBuffer; +class Font; class PageSettings; class QueryTableBuffer; class RichString; @@ -80,11 +82,10 @@ enum WorksheetType // ============================================================================ -/** Stores formatting data about a range of columns. */ +/** Stores settings and formatting data about a range of sheet columns. */ struct ColumnModel { - sal_Int32 mnFirstCol; /// 1-based (!) index of first column. - sal_Int32 mnLastCol; /// 1-based (!) index of last column. + ValueRange maRange; /// 1-based (!) range of the described columns. double mfWidth; /// Column width in number of characters. sal_Int32 mnXfId; /// Column default formatting. sal_Int32 mnLevel; /// Column outline level. @@ -94,17 +95,17 @@ struct ColumnModel explicit ColumnModel(); - /** Expands this entry with the passed column range, if column settings are equal. */ - bool tryExpand( const ColumnModel& rModel ); + /** Returns true, if this entry can be merged with the passed column range (column settings are equal). */ + bool isMergeable( const ColumnModel& rModel ) const; }; // ---------------------------------------------------------------------------- -/** Stores formatting data about a range of rows. */ +/** Stores settings and formatting data about a sheet row. */ struct RowModel { - sal_Int32 mnFirstRow; /// 1-based (!) index of first row. - sal_Int32 mnLastRow; /// 1-based (!) index of last row. + sal_Int32 mnRow; /// 1-based (!) index of the described row. + ValueRangeSet maColSpans; /// 0-based (!) column ranges of used cells. double mfHeight; /// Row height in points. sal_Int32 mnXfId; /// Row default formatting (see mbIsFormatted). sal_Int32 mnLevel; /// Row outline level. @@ -118,8 +119,10 @@ struct RowModel explicit RowModel(); - /** Expands this entry with the passed row range, if row settings are equal. */ - bool tryExpand( const RowModel& rModel ); + /** Inserts the passed column span into the row model. */ + void insertColSpan( const ValueRange& rColSpan ); + /** Returns true, if this entry can be merged with the passed row range (row settings are equal). */ + bool isMergeable( const RowModel& rModel ) const; }; // ---------------------------------------------------------------------------- @@ -232,10 +235,10 @@ public: /** Returns the XTableColumns interface for a range of columns. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > - getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const; + getColumns( const ValueRange& rColRange ) const; /** Returns the XTableRows interface for a range of rows. */ ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > - getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const; + getRows( const ValueRange& rRowRange ) const; /** Returns the XDrawPage interface of the draw page of the current sheet. */ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > @@ -315,6 +318,24 @@ public: /** Specifies that the passed row needs to set its height manually. */ void setManualRowHeight( sal_Int32 nRow ); + /** Inserts a value cell directly into the Calc sheet. */ + void putValue( + const ::com::sun::star::table::CellAddress& rAddress, + double fValue ) const; + /** Inserts a string cell directly into the Calc sheet. */ + void putString( + const ::com::sun::star::table::CellAddress& rAddress, + const ::rtl::OUString& rText ) const; + /** Inserts a rich-string cell directly into the Calc sheet. */ + void putRichString( + const ::com::sun::star::table::CellAddress& rAddress, + const RichString& rString, + const Font* pFirstPortionFont ) const; + /** Inserts a formula cell directly into the Calc sheet. */ + void putFormulaTokens( + const ::com::sun::star::table::CellAddress& rAddress, + const ApiTokenSequence& rTokens ) const; + /** Initial conversion before importing the worksheet. */ void initializeWorksheetImport(); /** Final conversion after importing the worksheet. */ diff --git a/oox/source/helper/containerhelper.cxx b/oox/source/helper/containerhelper.cxx index 4fb0d93d6224..264deb366878 100644 --- a/oox/source/helper/containerhelper.cxx +++ b/oox/source/helper/containerhelper.cxx @@ -47,6 +47,59 @@ using ::rtl::OUStringBuffer; // ============================================================================ +namespace { + +struct ValueRangeComp +{ + inline bool operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return rRange.mnLast < nValue; } +}; + +} // namespace + +// ---------------------------------------------------------------------------- + +void ValueRangeSet::insert( const ValueRange& rRange ) +{ + // find the first range that contains or follows the starting point of the passed range + ValueRangeVector::iterator aBeg = maRanges.begin(); + ValueRangeVector::iterator aEnd = maRanges.end(); + ValueRangeVector::iterator aIt = ::std::lower_bound( aBeg, aEnd, rRange.mnFirst, ValueRangeComp() ); + // nothing to do if found range contains passed range + if( (aIt != aEnd) && aIt->contains( rRange ) ) return; + // check if previous range can be used to merge with the passed range + if( (aIt != aBeg) && ((aIt - 1)->mnLast + 1 == rRange.mnFirst) ) --aIt; + // check if current range (aIt) can be used to merge with passed range + if( (aIt != aEnd) && aIt->intersects( rRange ) ) + { + // set new start value to existing range + aIt->mnFirst = ::std::min( aIt->mnFirst, rRange.mnFirst ); + // search first range that cannot be merged anymore (aNext) + ValueRangeVector::iterator aNext = aIt + 1; + while( (aNext != aEnd) && aNext->intersects( rRange ) ) ++aNext; + // set new end value to existing range + aIt->mnLast = ::std::max( (aNext - 1)->mnLast, rRange.mnLast ); + // remove ranges covered by new existing range (aIt) + maRanges.erase( aIt + 1, aNext ); + } + else + { + // merging not possible: insert new range + maRanges.insert( aIt, rRange ); + } +} + +ValueRangeVector ValueRangeSet::getIntersection( const ValueRange& rRange ) const +{ + ValueRangeVector aRanges; + // find the range that contains nFirst or the first range that follows nFirst + ValueRangeVector::const_iterator aIt = ::std::lower_bound( maRanges.begin(), maRanges.end(), rRange.mnFirst, ValueRangeComp() ); + for( ValueRangeVector::const_iterator aEnd = maRanges.end(); (aIt != aEnd) && (aIt->mnFirst <= rRange.mnLast); ++aIt ) + aRanges.push_back( ValueRange( ::std::max( aIt->mnFirst, rRange.mnFirst ), ::std::min( aIt->mnLast, rRange.mnLast ) ) ); + return aRanges; +} + +// ============================================================================ + Reference< XIndexContainer > ContainerHelper::createIndexContainer( const Reference< XComponentContext >& rxContext ) { Reference< XIndexContainer > xContainer; diff --git a/oox/source/xls/autofilterbuffer.cxx b/oox/source/xls/autofilterbuffer.cxx index 7cf359f6d3c9..bfc33e82056b 100755 --- a/oox/source/xls/autofilterbuffer.cxx +++ b/oox/source/xls/autofilterbuffer.cxx @@ -842,7 +842,7 @@ bool AutoFilterBuffer::finalizeImport( const Reference< XDatabaseRange >& rxData AutoFilter* AutoFilterBuffer::getActiveAutoFilter() { // Excel expects not more than one auto filter per sheet or table - OSL_ENSURE( maAutoFilters.size() == 1, "AutoFilterBuffer::getActiveAutoFilter - too many auto filters" ); + OSL_ENSURE( maAutoFilters.size() <= 1, "AutoFilterBuffer::getActiveAutoFilter - too many auto filters" ); // stick to the last imported auto filter return maAutoFilters.empty() ? 0 : maAutoFilters.back().get(); } diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index f55dac0ca6f2..f11aa89bca53 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -170,7 +170,7 @@ void Comment::finalizeImport() // insert text and convert text formatting maModel.mxText->finalizeImport(); Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW ); - maModel.mxText->convert( xAnnoText, -1, true ); + maModel.mxText->convert( xAnnoText ); } catch( Exception& ) { diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx index 2c4d55b089f1..146f3b53df8a 100644 --- a/oox/source/xls/pivotcachebuffer.cxx +++ b/oox/source/xls/pivotcachebuffer.cxx @@ -936,8 +936,9 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie void PivotCacheField::writeSourceHeaderCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const { - CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); - rSheetHelper.getSheetData().setStringCell( aCellAddr, maFieldModel.maName ); + CellModel aModel; + aModel.maCellAddr = CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ); + rSheetHelper.getSheetData().setStringCell( aModel, maFieldModel.maName ); } void PivotCacheField::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const @@ -983,16 +984,17 @@ void PivotCacheField::writeItemToSourceDataCell( WorksheetHelper& rSheetHelper, { if( rItem.getType() != XML_m ) { - CellAddress aCellAddr( rSheetHelper.getSheetIndex(), nCol, nRow ); + CellModel aModel; + aModel.maCellAddr = CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ); SheetDataBuffer& rSheetData = rSheetHelper.getSheetData(); switch( rItem.getType() ) { - case XML_s: rSheetData.setStringCell( aCellAddr, rItem.getValue().get< OUString >() ); break; - case XML_n: rSheetData.setValueCell( aCellAddr, rItem.getValue().get< double >() ); break; - case XML_i: rSheetData.setValueCell( aCellAddr, rItem.getValue().get< sal_Int16 >() ); break; - case XML_d: rSheetData.setDateTimeCell( aCellAddr, rItem.getValue().get< DateTime >() ); break; - case XML_b: rSheetData.setBooleanCell( aCellAddr, rItem.getValue().get< bool >() ); break; - case XML_e: rSheetData.setErrorCell( aCellAddr, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; + case XML_s: rSheetData.setStringCell( aModel, rItem.getValue().get< OUString >() ); break; + case XML_n: rSheetData.setValueCell( aModel, rItem.getValue().get< double >() ); break; + case XML_i: rSheetData.setValueCell( aModel, rItem.getValue().get< sal_Int16 >() ); break; + case XML_d: rSheetData.setDateTimeCell( aModel, rItem.getValue().get< DateTime >() ); break; + case XML_b: rSheetData.setBooleanCell( aModel, rItem.getValue().get< bool >() ); break; + case XML_e: rSheetData.setErrorCell( aModel, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break; default: OSL_ENSURE( false, "PivotCacheField::writeItemToSourceDataCell - unexpected item data type" ); } } @@ -1044,6 +1046,7 @@ PCWorksheetSourceModel::PCWorksheetSourceModel() PivotCache::PivotCache( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ), + mnCurrRow( -1 ), mbValidSource( false ), mbDummySheet( false ) { @@ -1276,34 +1279,39 @@ void PivotCache::writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn; sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column; sal_Int32 nRow = maSheetSrcModel.maRange.StartRow; + mnCurrRow = -1; + updateSourceDataRow( rSheetHelper, nRow ); for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol ) (*aIt)->writeSourceHeaderCell( rSheetHelper, nCol, nRow ); } -void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const +void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nColIdx, sal_Int32 nRowIdx, const PivotCacheItem& rItem ) const { - OSL_ENSURE( (0 <= nCol) && (nCol <= maSheetSrcModel.maRange.EndColumn - maSheetSrcModel.maRange.StartColumn), "PivotCache::writeSourceDataCell - invalid column index" ); - OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::writeSourceDataCell - invalid row index" ); - if( const PivotCacheField* pCacheField = maDatabaseFields.get( nCol ).get() ) - pCacheField->writeSourceDataCell( rSheetHelper, maSheetSrcModel.maRange.StartColumn + nCol, maSheetSrcModel.maRange.StartRow + nRow, rItem ); + sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn + nColIdx; + OSL_ENSURE( (maSheetSrcModel.maRange.StartColumn <= nCol) && (nCol <= maSheetSrcModel.maRange.EndColumn), "PivotCache::writeSourceDataCell - invalid column index" ); + sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx; + OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::writeSourceDataCell - invalid row index" ); + updateSourceDataRow( rSheetHelper, nRow ); + if( const PivotCacheField* pCacheField = maDatabaseFields.get( nColIdx ).get() ) + pCacheField->writeSourceDataCell( rSheetHelper, nCol, nRow, rItem ); } -void PivotCache::importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const +void PivotCache::importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const { - OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::importPCRecord - invalid row index" ); + sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx; + OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::importPCRecord - invalid row index" ); sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn; sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column; - nRow += maSheetSrcModel.maRange.StartRow; for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol ) (*aIt)->importPCRecordItem( rStrm, rSheetHelper, nCol, nRow ); } -void PivotCache::importPCItemIndexList( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const +void PivotCache::importPCItemIndexList( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const { - OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::importPCItemIndexList - invalid row index" ); + sal_Int32 nRow = maSheetSrcModel.maRange.StartRow + nRowIdx; + OSL_ENSURE( (maSheetSrcModel.maRange.StartRow < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow), "PivotCache::importPCItemIndexList - invalid row index" ); sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn; sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column; - nRow += maSheetSrcModel.maRange.StartRow; for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol ) if( (*aIt)->hasSharedItems() ) (*aIt)->importPCItemIndex( rStrm, rSheetHelper, nCol, nRow ); @@ -1417,17 +1425,28 @@ void PivotCache::finalizeExternalSheetSource() void PivotCache::prepareSourceDataSheet() { + CellRangeAddress& rRange = maSheetSrcModel.maRange; // data will be inserted in top-left cell, sheet index is still set to 0 (will be set below) - maSheetSrcModel.maRange.EndColumn -= maSheetSrcModel.maRange.StartColumn; - maSheetSrcModel.maRange.StartColumn = 0; - maSheetSrcModel.maRange.EndRow -= maSheetSrcModel.maRange.StartRow; - maSheetSrcModel.maRange.StartRow = 0; + rRange.EndColumn -= rRange.StartColumn; + rRange.StartColumn = 0; + rRange.EndRow -= rRange.StartRow; + rRange.StartRow = 0; // check range location, do not allow ranges that overflow the sheet partly - if( getAddressConverter().checkCellRange( maSheetSrcModel.maRange, false, true ) ) + if( getAddressConverter().checkCellRange( rRange, false, true ) ) { + maColSpans.insert( ValueRange( rRange.StartColumn, rRange.EndColumn ) ); OUString aSheetName = CREATE_OUSTRING( "DPCache_" ) + maSheetSrcModel.maSheet; - maSheetSrcModel.maRange.Sheet = getWorksheets().insertEmptySheet( aSheetName, false ); - mbValidSource = mbDummySheet = maSheetSrcModel.maRange.Sheet >= 0; + rRange.Sheet = getWorksheets().insertEmptySheet( aSheetName, false ); + mbValidSource = mbDummySheet = rRange.Sheet >= 0; + } +} + +void PivotCache::updateSourceDataRow( WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const +{ + if( mnCurrRow != nRow ) + { + rSheetHelper.getSheetData().setColSpans( nRow, maColSpans ); + mnCurrRow = nRow; } } diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx index b28d3b64e8e3..f6948917701a 100644 --- a/oox/source/xls/pivotcachefragment.cxx +++ b/oox/source/xls/pivotcachefragment.cxx @@ -223,8 +223,8 @@ PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorksheetHelper& rHe const OUString& rFragmentPath, const PivotCache& rPivotCache ) : WorksheetFragmentBase( rHelper, rFragmentPath ), mrPivotCache( rPivotCache ), - mnCol( 0 ), - mnRow( 0 ), + mnColIdx( 0 ), + mnRowIdx( 0 ), mbInRecord( false ) { // prepare sheet: insert column header names into top row @@ -257,8 +257,8 @@ ContextHandlerRef PivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement case XLS_TOKEN( x ): aItem.readIndex( rAttribs ); break; default: OSL_ENSURE( false, "PivotCacheRecordsFragment::onCreateContext - unexpected element" ); } - mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem ); - ++mnCol; + mrPivotCache.writeSourceDataCell( *this, mnColIdx, mnRowIdx, aItem ); + ++mnColIdx; } break; } @@ -299,15 +299,15 @@ const RecordInfo* PivotCacheRecordsFragment::getRecordInfos() const void PivotCacheRecordsFragment::startCacheRecord() { - mnCol = 0; - ++mnRow; + mnColIdx = 0; + ++mnRowIdx; mbInRecord = true; } void PivotCacheRecordsFragment::importPCRecord( SequenceInputStream& rStrm ) { startCacheRecord(); - mrPivotCache.importPCRecord( rStrm, *this, mnRow ); + mrPivotCache.importPCRecord( rStrm, *this, mnRowIdx ); mbInRecord = false; } @@ -327,8 +327,8 @@ void PivotCacheRecordsFragment::importPCRecordItem( sal_Int32 nRecId, SequenceIn case BIFF12_ID_PCITEM_INDEX: aItem.readIndex( rStrm ); break; default: OSL_ENSURE( false, "PivotCacheRecordsFragment::importPCRecordItem - unexpected record" ); } - mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem ); - ++mnCol; + mrPivotCache.writeSourceDataCell( *this, mnColIdx, mnRowIdx, aItem ); + ++mnColIdx; } } @@ -398,7 +398,7 @@ BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorksheetHelpe BiffWorksheetContextBase( rHelper ), mrPivotCache( rPivotCache ), mnColIdx( 0 ), - mnRow( 0 ), + mnRowIdx( 0 ), mbHasShared( false ), mbInRow( false ) { @@ -427,7 +427,7 @@ void BiffPivotCacheRecordsContext::importRecord( BiffInputStream& rStrm ) OSL_ENSURE( mbHasShared, "BiffPivotCacheRecordsContext::importRecord - unexpected PCITEM_INDEXLIST record" ); // PCITEM_INDEXLIST record always in front of a new data row startNextRow(); - mrPivotCache.importPCItemIndexList( rStrm, *this, mnRow ); + mrPivotCache.importPCItemIndexList( rStrm, *this, mnRowIdx ); mbInRow = !maUnsharedCols.empty(); // mbInRow remains true, if unshared items are expected return; } @@ -458,14 +458,14 @@ void BiffPivotCacheRecordsContext::importRecord( BiffInputStream& rStrm ) // write the item data to the sheet cell OSL_ENSURE( mnColIdx < maUnsharedCols.size(), "BiffPivotCacheRecordsContext::importRecord - invalid column index" ); if( mnColIdx < maUnsharedCols.size() ) - mrPivotCache.writeSourceDataCell( *this, maUnsharedCols[ mnColIdx ], mnRow, aItem ); + mrPivotCache.writeSourceDataCell( *this, maUnsharedCols[ mnColIdx ], mnRowIdx, aItem ); ++mnColIdx; } void BiffPivotCacheRecordsContext::startNextRow() { mnColIdx = 0; - ++mnRow; + ++mnRowIdx; mbInRow = true; } diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 5f4288ed651e..859280ddd548 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -52,6 +52,11 @@ namespace { const sal_uInt8 BIFF12_STRINGFLAG_FONTS = 0x01; const sal_uInt8 BIFF12_STRINGFLAG_PHONETICS = 0x02; +inline bool lclNeedsRichTextFormat( const Font* pFont ) +{ + return pFont && pFont->needsRichTextFormat(); +} + } // namespace // ============================================================================ @@ -86,10 +91,10 @@ void RichStringPortion::finalizeImport() mxFont = getStyles().getFont( mnFontId ); } -void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXfId, bool bReplaceOld ) +void RichStringPortion::convert( const Reference< XText >& rxText, const Font* pFont, bool bReplace ) { Reference< XTextRange > xRange; - if( bReplaceOld ) + if( bReplace ) xRange.set( rxText, UNO_QUERY ); else xRange = rxText->getEnd(); @@ -103,13 +108,13 @@ void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXf PropertySet aPropSet( xRange ); mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); } - if( const Font* pFont = getStyles().getFontFromCellXf( nXfId ).get() ) + + /* Some font attributes cannot be set to cell formattiing in Calc but + require to use rich formatting, e.g. font escapement. */ + if( lclNeedsRichTextFormat( pFont ) ) { - if( pFont->needsRichTextFormat() ) - { - PropertySet aPropSet( xRange ); - pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); - } + PropertySet aPropSet( xRange ); + pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); } } } @@ -400,7 +405,7 @@ void RichString::importString( SequenceInputStream& rStrm, bool bRich ) { FontPortionModelList aPortions; aPortions.importPortions( rStrm ); - createFontPortions( aBaseText, aPortions ); + createTextPortions( aBaseText, aPortions ); } else { @@ -434,7 +439,7 @@ void RichString::importByteString( BiffInputStream& rStrm, rtl_TextEncoding eTex { FontPortionModelList aPortions; aPortions.importPortions( rStrm, false ); - createFontPortions( aBaseText, eTextEnc, aPortions ); + createTextPortions( aBaseText, eTextEnc, aPortions ); } else { @@ -468,7 +473,7 @@ void RichString::importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags { FontPortionModelList aPortions; aPortions.importPortions( rStrm, nFontCount, BIFF_FONTPORTION_16BIT ); - createFontPortions( aBaseText, aPortions ); + createTextPortions( aBaseText, aPortions ); } else { @@ -502,16 +507,34 @@ void RichString::importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags void RichString::finalizeImport() { - maFontPortions.forEachMem( &RichStringPortion::finalizeImport ); + maTextPortions.forEachMem( &RichStringPortion::finalizeImport ); +} + +bool RichString::extractPlainString( OUString& orString, const Font* pFirstPortionFont ) const +{ + if( !maPhonPortions.empty() ) + return false; + if( maTextPortions.empty() ) + { + orString = OUString(); + return true; + } + if( (maTextPortions.size() == 1) && !maTextPortions.front()->hasFont() && !lclNeedsRichTextFormat( pFirstPortionFont ) ) + { + orString = maTextPortions.front()->getText(); + return true; + } + return false; } -void RichString::convert( const Reference< XText >& rxText, sal_Int32 nXfId, bool bReplaceOld ) const +void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPortionFont ) const { - for( PortionVec::const_iterator aIt = maFontPortions.begin(), aEnd = maFontPortions.end(); aIt != aEnd; ++aIt ) + bool bReplace = true; + for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt ) { - (*aIt)->convert( rxText, nXfId, bReplaceOld ); - nXfId = -1; // use passed XF identifier for first portion only - bReplaceOld = false; // do not replace first portion text with following portions + (*aIt)->convert( rxText, pFirstPortionFont, bReplace ); + pFirstPortionFont = 0; // use passed font for first portion only + bReplace = false; // do not replace first portion text with following portions } } @@ -520,7 +543,7 @@ void RichString::convert( const Reference< XText >& rxText, sal_Int32 nXfId, boo RichStringPortionRef RichString::createPortion() { RichStringPortionRef xPortion( new RichStringPortion( *this ) ); - maFontPortions.push_back( xPortion ); + maTextPortions.push_back( xPortion ); return xPortion; } @@ -531,9 +554,9 @@ RichStringPhoneticRef RichString::createPhonetic() return xPhonetic; } -void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ) +void RichString::createTextPortions( const OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions ) { - maFontPortions.clear(); + maTextPortions.clear(); sal_Int32 nStrLen = rText.getLength(); if( nStrLen > 0 ) { @@ -562,9 +585,9 @@ void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eTex } } -void RichString::createFontPortions( const OUString& rText, FontPortionModelList& rPortions ) +void RichString::createTextPortions( const OUString& rText, FontPortionModelList& rPortions ) { - maFontPortions.clear(); + maTextPortions.clear(); sal_Int32 nStrLen = rText.getLength(); if( nStrLen > 0 ) { diff --git a/oox/source/xls/sharedstringsbuffer.cxx b/oox/source/xls/sharedstringsbuffer.cxx index 59d3a905bc40..c2464e1cf36f 100644 --- a/oox/source/xls/sharedstringsbuffer.cxx +++ b/oox/source/xls/sharedstringsbuffer.cxx @@ -73,11 +73,9 @@ void SharedStringsBuffer::finalizeImport() maStrings.forEachMem( &RichString::finalizeImport ); } -void SharedStringsBuffer::convertString( const Reference< XText >& rxText, sal_Int32 nStringId, sal_Int32 nXfId ) const +RichStringRef SharedStringsBuffer::getString( sal_Int32 nStringId ) const { - if( rxText.is() ) - if( const RichString* pString = maStrings.get( nStringId ).get() ) - pString->convert( rxText, nXfId ); + return maStrings.get( nStringId ); } // ============================================================================ diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx index 0cfe741cb135..8bdcccca10cf 100755 --- a/oox/source/xls/sheetdatabuffer.cxx +++ b/oox/source/xls/sheetdatabuffer.cxx @@ -110,73 +110,306 @@ DataTableModel::DataTableModel() : // ============================================================================ +namespace { + +const sal_Int32 CELLBLOCK_MAXROWS = 16; /// Number of rows in a cell block. + +} // namespace + +CellBlock::CellBlock( const WorksheetHelper& rHelper, const ValueRange& rColSpan, sal_Int32 nRow ) : + WorksheetHelper( rHelper ), + maRange( rHelper.getSheetIndex(), rColSpan.mnFirst, nRow, rColSpan.mnLast, nRow ), + mnRowLength( rColSpan.mnLast - rColSpan.mnFirst + 1 ), + mnFirstFreeIndex( 0 ) +{ + maCellArray.realloc( 1 ); + maCellArray[ 0 ].realloc( mnRowLength ); + mpCurrCellRow = maCellArray[ 0 ].getArray(); +} + +bool CellBlock::isExpandable( const ValueRange& rColSpan ) const +{ + return (maRange.StartColumn == rColSpan.mnFirst) && (maRange.EndColumn == rColSpan.mnLast); +} + +bool CellBlock::isBefore( const ValueRange& rColSpan ) const +{ + return (maRange.EndColumn < rColSpan.mnLast) || + ((maRange.EndColumn == rColSpan.mnLast) && (maRange.StartColumn != rColSpan.mnFirst)); +} + +bool CellBlock::contains( sal_Int32 nCol ) const +{ + return (maRange.StartColumn <= nCol) && (nCol <= maRange.EndColumn); +} + +void CellBlock::insertRichString( const CellAddress& rAddress, const RichStringRef& rxString, const Font* pFirstPortionFont ) +{ + maRichStrings.push_back( RichStringCell( rAddress, rxString, pFirstPortionFont ) ); +} + +void CellBlock::startNextRow() +{ + // fill last cells in current row with empty strings (placeholder for empty cells) + fillUnusedCells( mnRowLength ); + // flush if the cell block reaches maximum size + if( maCellArray.getLength() == CELLBLOCK_MAXROWS ) + { + finalizeImport(); + maRange.StartRow = ++maRange.EndRow; + maCellArray.realloc( 1 ); + mpCurrCellRow = maCellArray[ 0 ].getArray(); + } + else + { + // prepare next row + ++maRange.EndRow; + sal_Int32 nRowCount = maCellArray.getLength(); + maCellArray.realloc( nRowCount + 1 ); + maCellArray[ nRowCount ].realloc( mnRowLength ); + mpCurrCellRow = maCellArray[ nRowCount ].getArray(); + } + mnFirstFreeIndex = 0; +} + +Any& CellBlock::getCellAny( sal_Int32 nCol ) +{ + OSL_ENSURE( contains( nCol ), "CellBlock::getCellAny - invalid column" ); + // fill cells before passed column with empty strings (the placeholder for empty cells) + sal_Int32 nIndex = nCol - maRange.StartColumn; + fillUnusedCells( nIndex ); + mnFirstFreeIndex = nIndex + 1; + return mpCurrCellRow[ nIndex ]; +} + +void CellBlock::finalizeImport() +{ + // fill last cells in last row with empty strings (placeholder for empty cells) + fillUnusedCells( mnRowLength ); + // insert all buffered cells into the Calc sheet + try + { + Reference< XCellRangeData > xRangeData( getCellRange( maRange ), UNO_QUERY_THROW ); + xRangeData->setDataArray( maCellArray ); + } + catch( Exception& ) + { + } + // insert uncacheable cells separately + for( RichStringCellList::const_iterator aIt = maRichStrings.begin(), aEnd = maRichStrings.end(); aIt != aEnd; ++aIt ) + putRichString( aIt->maCellAddr, *aIt->mxString, aIt->mpFirstPortionFont ); +} + +// private -------------------------------------------------------------------- + +CellBlock::RichStringCell::RichStringCell( const CellAddress& rCellAddr, const RichStringRef& rxString, const Font* pFirstPortionFont ) : + maCellAddr( rCellAddr ), + mxString( rxString ), + mpFirstPortionFont( pFirstPortionFont ) +{ +} + +void CellBlock::fillUnusedCells( sal_Int32 nIndex ) +{ + if( mnFirstFreeIndex < nIndex ) + { + Any* pCellEnd = mpCurrCellRow + nIndex; + for( Any* pCell = mpCurrCellRow + mnFirstFreeIndex; pCell < pCellEnd; ++pCell ) + *pCell <<= OUString(); + } +} + +// ============================================================================ + +CellBlockBuffer::CellBlockBuffer( const WorksheetHelper& rHelper ) : + WorksheetHelper( rHelper ), + mnCurrRow( -1 ) +{ + maCellBlockIt = maCellBlocks.end(); +} + +void CellBlockBuffer::setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ) +{ + OSL_ENSURE( maColSpans.count( nRow ) == 0, "CellBlockBuffer::setColSpans - multiple column spans for the same row" ); + OSL_ENSURE( (mnCurrRow < nRow) && (maColSpans.empty() || (maColSpans.rbegin()->first < nRow)), "CellBlockBuffer::setColSpans - rows are unsorted" ); + if( (mnCurrRow < nRow) && (maColSpans.count( nRow ) == 0) ) + maColSpans[ nRow ] = rColSpans.getRanges(); +} + +CellBlock* CellBlockBuffer::getCellBlock( const CellAddress& rCellAddr ) +{ + OSL_ENSURE( rCellAddr.Row >= mnCurrRow, "CellBlockBuffer::getCellBlock - passed row out of order" ); + // prepare cell blocks, if row changes + if( rCellAddr.Row != mnCurrRow ) + { + // find colspans for the new row + ColSpanVectorMap::iterator aIt = maColSpans.find( rCellAddr.Row ); + + /* Gap between rows, or rows out of order, or no colspan + information for the new row found: flush all open cell blocks. */ + if( (aIt == maColSpans.end()) || (rCellAddr.Row != mnCurrRow + 1) ) + { + finalizeImport(); + maCellBlocks.clear(); + maCellBlockIt = maCellBlocks.end(); + } + + /* Prepare matching cell blocks, create new cell blocks, finalize + unmatching cell blocks, if colspan information is available. */ + if( aIt != maColSpans.end() ) + { + /* The colspan vector aIt points to is sorted by columns, as well + as the cell block map. In the folloing, this vector and the + list of cell blocks can be iterated simultanously. */ + CellBlockMap::iterator aMIt = maCellBlocks.begin(); + const ValueRangeVector& rColRanges = aIt->second; + for( ValueRangeVector::const_iterator aVIt = rColRanges.begin(), aVEnd = rColRanges.end(); aVIt != aVEnd; ++aVIt, ++aMIt ) + { + const ValueRange& rColSpan = *aVIt; + /* Finalize and remove all cell blocks up to end of the column + range (cell blocks are keyed by end column index). + CellBlock::isBefore() returns true, if the end index of the + passed colspan is greater than the column end index of the + cell block, or if the passed range has the same end index + but the start indexes do not match. */ + while( (aMIt != maCellBlocks.end()) && aMIt->second->isBefore( rColSpan ) ) + { + aMIt->second->finalizeImport(); + maCellBlocks.erase( aMIt++ ); + } + /* If the current cell block (aMIt) fits to the colspan, start + a new row there, otherwise create and insert a new cell block. */ + if( (aMIt != maCellBlocks.end()) && aMIt->second->isExpandable( rColSpan ) ) + aMIt->second->startNextRow(); + else + aMIt = maCellBlocks.insert( aMIt, CellBlockMap::value_type( rColSpan.mnLast, + CellBlockMap::mapped_type( new CellBlock( *this, rColSpan, rCellAddr.Row ) ) ) ); + } + // finalize and remove all remaining cell blocks + CellBlockMap::iterator aMEnd = maCellBlocks.end(); + for( CellBlockMap::iterator aMIt2 = aMIt; aMIt2 != aMEnd; ++aMIt2 ) + aMIt2->second->finalizeImport(); + maCellBlocks.erase( aMIt, aMEnd ); + + // remove cached colspan information (including current one aIt points to) + maColSpans.erase( maColSpans.begin(), ++aIt ); + } + maCellBlockIt = maCellBlocks.begin(); + mnCurrRow = rCellAddr.Row; + } + + // try to find a valid cell block (update maCellBlockIt) + if( ((maCellBlockIt != maCellBlocks.end()) && maCellBlockIt->second->contains( rCellAddr.Column )) || + (((maCellBlockIt = maCellBlocks.lower_bound( rCellAddr.Column )) != maCellBlocks.end()) && maCellBlockIt->second->contains( rCellAddr.Column )) ) + { + // maCellBlockIt points to valid cell block + return maCellBlockIt->second.get(); + } + + // no valid cell block found + return 0; +} + +void CellBlockBuffer::finalizeImport() +{ + maCellBlocks.forEachMem( &CellBlock::finalizeImport ); +} + +// ============================================================================ + SheetDataBuffer::SheetDataBuffer( const WorksheetHelper& rHelper ) : WorksheetHelper( rHelper ), + maCellBlocks( rHelper ), mbPendingSharedFmla( false ) { } -void SheetDataBuffer::setValueCell( const CellAddress& rCellAddr, double fValue ) +void SheetDataBuffer::setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans ) { - Reference< XCell > xCell = getCell( rCellAddr ); - OSL_ENSURE( xCell.is(), "SheetDataBuffer::setValueCell - missing cell interface" ); - if( xCell.is() ) - xCell->setValue( fValue ); + maCellBlocks.setColSpans( nRow, rColSpans ); } -void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, const OUString& rText ) +void SheetDataBuffer::setBlankCell( const CellModel& rModel ) { - Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); - OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); - if( xText.is() ) - xText->setString( rText ); + setCellFormat( rModel ); } -void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, const RichString& rString, sal_Int32 nXfId ) +void SheetDataBuffer::setValueCell( const CellModel& rModel, double fValue ) { - Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); - OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); - rString.convert( xText, nXfId ); - (void)rString; - (void)nXfId; + if( CellBlock* pCellBlock = maCellBlocks.getCellBlock( rModel.maCellAddr ) ) + pCellBlock->getCellAny( rModel.maCellAddr.Column ) <<= fValue; + else + putValue( rModel.maCellAddr, fValue ); + setCellFormat( rModel ); } -void SheetDataBuffer::setStringCell( const CellAddress& rCellAddr, sal_Int32 nStringId, sal_Int32 nXfId ) +void SheetDataBuffer::setStringCell( const CellModel& rModel, const OUString& rText ) { - Reference< XText > xText( getCell( rCellAddr ), UNO_QUERY ); - OSL_ENSURE( xText.is(), "SheetDataBuffer::setStringCell - missing text interface" ); - getSharedStrings().convertString( xText, nStringId, nXfId ); - (void)nStringId; - (void)nXfId; + if( CellBlock* pCellBlock = maCellBlocks.getCellBlock( rModel.maCellAddr ) ) + pCellBlock->getCellAny( rModel.maCellAddr.Column ) <<= rText; + else + putString( rModel.maCellAddr, rText ); + setCellFormat( rModel ); } -void SheetDataBuffer::setDateTimeCell( const CellAddress& rCellAddr, const DateTime& rDateTime ) +void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRef& rxString ) +{ + OSL_ENSURE( rxString.get(), "SheetDataBuffer::setStringCell - missing rich string object" ); + const Font* pFirstPortionFont = getStyles().getFontFromCellXf( rModel.mnXfId ).get(); + OUString aText; + if( rxString->extractPlainString( aText, pFirstPortionFont ) ) + { + setStringCell( rModel, aText ); + } + else + { + if( CellBlock* pCellBlock = maCellBlocks.getCellBlock( rModel.maCellAddr ) ) + pCellBlock->insertRichString( rModel.maCellAddr, rxString, pFirstPortionFont ); + else + putRichString( rModel.maCellAddr, *rxString, pFirstPortionFont ); + setCellFormat( rModel ); + } +} + +void SheetDataBuffer::setStringCell( const CellModel& rModel, sal_Int32 nStringId ) +{ + RichStringRef xString = getSharedStrings().getString( nStringId ); + if( xString.get() ) + setStringCell( rModel, xString ); + else + setBlankCell( rModel ); +} + +void SheetDataBuffer::setDateTimeCell( const CellModel& rModel, const DateTime& rDateTime ) { // write serial date/time value into the cell double fSerial = getUnitConverter().calcSerialFromDateTime( rDateTime ); - setValueCell( rCellAddr, fSerial ); + setValueCell( rModel, fSerial ); // set appropriate number format using namespace ::com::sun::star::util::NumberFormat; sal_Int16 nStdFmt = (fSerial < 1.0) ? TIME : (((rDateTime.Hours > 0) || (rDateTime.Minutes > 0) || (rDateTime.Seconds > 0)) ? DATETIME : DATE); - setStandardNumFmt( rCellAddr, nStdFmt ); + setStandardNumFmt( rModel.maCellAddr, nStdFmt ); } -void SheetDataBuffer::setBooleanCell( const CellAddress& rCellAddr, bool bValue ) +void SheetDataBuffer::setBooleanCell( const CellModel& rModel, bool bValue ) { - setFormulaCell( rCellAddr, getFormulaParser().convertBoolToFormula( bValue ) ); + setCellFormula( rModel.maCellAddr, getFormulaParser().convertBoolToFormula( bValue ) ); + // #108770# set 'Standard' number format for all Boolean cells + setCellFormat( rModel, 0 ); } -void SheetDataBuffer::setErrorCell( const CellAddress& rCellAddr, const OUString& rErrorCode ) +void SheetDataBuffer::setErrorCell( const CellModel& rModel, const OUString& rErrorCode ) { - setErrorCell( rCellAddr, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); + setErrorCell( rModel, getUnitConverter().calcBiffErrorCode( rErrorCode ) ); } -void SheetDataBuffer::setErrorCell( const CellAddress& rCellAddr, sal_uInt8 nErrorCode ) +void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode ) { - setFormulaCell( rCellAddr, getFormulaParser().convertErrorToFormula( nErrorCode ) ); + setCellFormula( rModel.maCellAddr, getFormulaParser().convertErrorToFormula( nErrorCode ) ); + setCellFormat( rModel ); } -void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) +void SheetDataBuffer::setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens ) { mbPendingSharedFmla = false; ApiTokenSequence aTokens; @@ -208,7 +441,7 @@ void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, const ApiTok aTokens = resolveSharedFormula( aBaseAddr ); if( !aTokens.hasElements() ) { - maSharedFmlaAddr = rCellAddr; + maSharedFmlaAddr = rModel.maCellAddr; maSharedBaseAddr = aBaseAddr; mbPendingSharedFmla = true; } @@ -220,18 +453,14 @@ void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, const ApiTok aTokens = rTokens; } - if( aTokens.hasElements() ) - { - Reference< XFormulaTokens > xTokens( getCell( rCellAddr ), UNO_QUERY ); - OSL_ENSURE( xTokens.is(), "SheetDataBuffer::setFormulaCell - missing formula interface" ); - if( xTokens.is() ) - xTokens->setTokens( aTokens ); - } + setCellFormula( rModel.maCellAddr, aTokens ); + setCellFormat( rModel ); } -void SheetDataBuffer::setFormulaCell( const CellAddress& rCellAddr, sal_Int32 nSharedId ) +void SheetDataBuffer::setFormulaCell( const CellModel& rModel, sal_Int32 nSharedId ) { - setFormulaCell( rCellAddr, resolveSharedFormula( BinAddress( nSharedId, 0 ) ) ); + setCellFormula( rModel.maCellAddr, resolveSharedFormula( BinAddress( nSharedId, 0 ) ) ); + setCellFormat( rModel ); } void SheetDataBuffer::createArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) @@ -260,73 +489,23 @@ void SheetDataBuffer::createSharedFormula( const CellAddress& rCellAddr, const A createSharedFormula( BinAddress( rCellAddr ), rTokens ); } -void SheetDataBuffer::setRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId, bool bCustomFormat ) +void SheetDataBuffer::setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat ) { // set row formatting if( bCustomFormat ) { // try to expand cached row range, if formatting is equal - if( (maXfIdRowRange.mnLastRow < 0) || !maXfIdRowRange.tryExpand( nFirstRow, nLastRow, nXfId ) ) + if( (maXfIdRowRange.maRowRange.mnLast < 0) || !maXfIdRowRange.tryExpand( nRow, nXfId ) ) { writeXfIdRowRangeProperties( maXfIdRowRange ); - maXfIdRowRange.set( nFirstRow, nLastRow, nXfId ); + maXfIdRowRange.set( nRow, nXfId ); } } - else if( maXfIdRowRange.mnLastRow >= 0 ) + else if( maXfIdRowRange.maRowRange.mnLast >= 0 ) { // finish last cached row range writeXfIdRowRangeProperties( maXfIdRowRange ); - maXfIdRowRange.set( -1, -1, -1 ); - } -} - -void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId ) -{ - if( (rModel.mnXfId >= 0) || (nNumFmtId >= 0) ) - { - // try to merge existing ranges and to write some formatting properties - if( !maXfIdRanges.empty() ) - { - // get row index of last inserted cell - sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; - // row changed - try to merge ranges of last row with existing ranges - if( rModel.maCellAddr.Row != nLastRow ) - { - mergeXfIdRanges(); - // write format properties of all ranges above last row and remove them - XfIdRangeMap::iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); - while( aIt != aEnd ) - { - // check that range cannot be merged with current row, and that range is not in cached row range - if( (aIt->second.maRange.EndRow < nLastRow) && !maXfIdRowRange.intersects( aIt->second.maRange ) ) - { - writeXfIdRangeProperties( aIt->second ); - maXfIdRanges.erase( aIt++ ); - } - else - ++aIt; - } - } - } - - // try to expand last existing range, or create new range entry - if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel, nNumFmtId ) ) - maXfIdRanges[ BinAddress( rModel.maCellAddr ) ].set( rModel, nNumFmtId ); - - // update merged ranges for 'center across selection' and 'fill' - if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() ) - { - sal_Int32 nHorAlign = pXf->getAlignment().getModel().mnHorAlign; - if( (nHorAlign == XML_centerContinuous) || (nHorAlign == XML_fill) ) - { - /* start new merged range, if cell is not empty (#108781#), - or try to expand last range with empty cell */ - if( rModel.mnCellType != XML_TOKEN_INVALID ) - maCenterFillRanges.push_back( MergedRange( rModel.maCellAddr, nHorAlign ) ); - else if( !maCenterFillRanges.empty() ) - maCenterFillRanges.rbegin()->tryExpand( rModel.maCellAddr, nHorAlign ); - } - } + maXfIdRowRange.set( -1, -1 ); } } @@ -352,6 +531,9 @@ void SheetDataBuffer::setStandardNumFmt( const CellAddress& rCellAddr, sal_Int16 void SheetDataBuffer::finalizeImport() { + // insert all cells of all open cell blocks + maCellBlocks.finalizeImport(); + // create all array formulas for( ArrayFormulaList::iterator aIt = maArrayFormulas.begin(), aEnd = maArrayFormulas.end(); aIt != aEnd; ++aIt ) finalizeArrayFormula( aIt->first, aIt->second ); @@ -379,57 +561,55 @@ void SheetDataBuffer::finalizeImport() // private -------------------------------------------------------------------- SheetDataBuffer::XfIdRowRange::XfIdRowRange() : - mnFirstRow( -1 ), - mnLastRow( -1 ), + maRowRange( -1 ), mnXfId( -1 ) { } bool SheetDataBuffer::XfIdRowRange::intersects( const CellRangeAddress& rRange ) const { - return (rRange.StartRow <= mnLastRow) && (mnFirstRow <= rRange.EndRow); + return (rRange.StartRow <= maRowRange.mnLast) && (maRowRange.mnFirst <= rRange.EndRow); } -void SheetDataBuffer::XfIdRowRange::set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) +void SheetDataBuffer::XfIdRowRange::set( sal_Int32 nRow, sal_Int32 nXfId ) { - mnFirstRow = nFirstRow; - mnLastRow = nLastRow; + maRowRange = ValueRange( nRow ); mnXfId = nXfId; } -bool SheetDataBuffer::XfIdRowRange::tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) +bool SheetDataBuffer::XfIdRowRange::tryExpand( sal_Int32 nRow, sal_Int32 nXfId ) { if( mnXfId == nXfId ) { - if( mnLastRow + 1 == nFirstRow ) + if( maRowRange.mnLast + 1 == nRow ) { - mnLastRow = nLastRow; + ++maRowRange.mnLast; return true; } - if( mnFirstRow == nLastRow + 1 ) + if( maRowRange.mnFirst == nRow + 1 ) { - mnFirstRow = nFirstRow; + --maRowRange.mnFirst; return true; } } return false; } -void SheetDataBuffer::XfIdRange::set( const CellModel& rModel, sal_Int32 nNumFmtId ) +void SheetDataBuffer::XfIdRange::set( const CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId ) { - maRange.Sheet = rModel.maCellAddr.Sheet; - maRange.StartColumn = maRange.EndColumn = rModel.maCellAddr.Column; - maRange.StartRow = maRange.EndRow = rModel.maCellAddr.Row; - mnXfId = rModel.mnXfId; + maRange.Sheet = rCellAddr.Sheet; + maRange.StartColumn = maRange.EndColumn = rCellAddr.Column; + maRange.StartRow = maRange.EndRow = rCellAddr.Row; + mnXfId = nXfId; mnNumFmtId = nNumFmtId; } -bool SheetDataBuffer::XfIdRange::tryExpand( const CellModel& rModel, sal_Int32 nNumFmtId ) +bool SheetDataBuffer::XfIdRange::tryExpand( const CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId ) { - if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == nNumFmtId) && - (maRange.StartRow == rModel.maCellAddr.Row) && - (maRange.EndRow == rModel.maCellAddr.Row) && - (maRange.EndColumn + 1 == rModel.maCellAddr.Column) ) + if( (mnXfId == nXfId) && (mnNumFmtId == nNumFmtId) && + (maRange.StartRow == rCellAddr.Row) && + (maRange.EndRow == rCellAddr.Row) && + (maRange.EndColumn + 1 == rCellAddr.Column) ) { ++maRange.EndColumn; return true; @@ -475,7 +655,58 @@ bool SheetDataBuffer::MergedRange::tryExpand( const CellAddress& rAddress, sal_I return false; } -void SheetDataBuffer::finalizeArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) +// ---------------------------------------------------------------------------- + +void SheetDataBuffer::setCellFormula( const CellAddress& rCellAddr, const ApiTokenSequence& rTokens ) +{ + if( rTokens.hasElements() ) + { + if( CellBlock* pCellBlock = maCellBlocks.getCellBlock( rCellAddr ) ) + pCellBlock->getCellAny( rCellAddr.Column ) <<= rTokens; + else + putFormulaTokens( rCellAddr, rTokens ); + } +} + +void SheetDataBuffer::createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens ) +{ + // create the defined name that will represent the shared formula + OUString aName = OUStringBuffer().appendAscii( RTL_CONSTASCII_STRINGPARAM( "__shared_" ) ). + append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ). + append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ). + append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear(); + Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName ); + OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" ); + PropertySet aNameProps( xNamedRange ); + aNameProps.setProperty( PROP_IsSharedFormula, true ); + + // get and store the token index of the defined name + OSL_ENSURE( maSharedFormulas.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormula - shared formula exists already" ); + sal_Int32 nTokenIndex = 0; + if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) try + { + // store the token index in the map + maSharedFormulas[ rMapKey ] = nTokenIndex; + // set the formula definition + Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); + xTokens->setTokens( rTokens ); + // retry to insert a pending shared formula cell + if( mbPendingSharedFmla ) + setCellFormula( maSharedFmlaAddr, resolveSharedFormula( maSharedBaseAddr ) ); + } + catch( Exception& ) + { + } + mbPendingSharedFmla = false; +} + +ApiTokenSequence SheetDataBuffer::resolveSharedFormula( const BinAddress& rMapKey ) const +{ + sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maSharedFormulas, rMapKey, -1 ); + return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); +} + +void SheetDataBuffer::finalizeArrayFormula( const CellRangeAddress& rRange, const ApiTokenSequence& rTokens ) const { Reference< XArrayFormulaTokens > xTokens( getCellRange( rRange ), UNO_QUERY ); OSL_ENSURE( xTokens.is(), "SheetDataBuffer::finalizeArrayFormula - missing formula token interface" ); @@ -483,7 +714,7 @@ void SheetDataBuffer::finalizeArrayFormula( const CellRangeAddress& rRange, cons xTokens->setArrayTokens( rTokens ); } -void SheetDataBuffer::finalizeTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) +void SheetDataBuffer::finalizeTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) const { sal_Int16 nSheet = getSheetIndex(); bool bOk = false; @@ -551,53 +782,62 @@ void SheetDataBuffer::finalizeTableOperation( const CellRangeAddress& rRange, co } } -void SheetDataBuffer::createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens ) +void SheetDataBuffer::setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId ) { - // create the defined name that will represent the shared formula - OUString aName = OUStringBuffer().appendAscii( RTL_CONSTASCII_STRINGPARAM( "__shared_" ) ). - append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ). - append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ). - append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear(); - Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName ); - OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" ); - PropertySet aNameProps( xNamedRange ); - aNameProps.setProperty( PROP_IsSharedFormula, true ); - - // get and store the token index of the defined name - OSL_ENSURE( maSharedFormulas.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormula - shared formula exists already" ); - sal_Int32 nTokenIndex = 0; - if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) try + if( (rModel.mnXfId >= 0) || (nNumFmtId >= 0) ) { - // store the token index in the map - maSharedFormulas[ rMapKey ] = nTokenIndex; - // set the formula definition - Reference< XFormulaTokens > xTokens( xNamedRange, UNO_QUERY_THROW ); - xTokens->setTokens( rTokens ); - // retry to insert a pending shared formula cell - if( mbPendingSharedFmla ) + // try to merge existing ranges and to write some formatting properties + if( !maXfIdRanges.empty() ) + { + // get row index of last inserted cell + sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow; + // row changed - try to merge ranges of last row with existing ranges + if( rModel.maCellAddr.Row != nLastRow ) + { + mergeXfIdRanges(); + // write format properties of all ranges above last row and remove them + XfIdRangeMap::iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); + while( aIt != aEnd ) + { + // check that range cannot be merged with current row, and that range is not in cached row range + if( (aIt->second.maRange.EndRow < nLastRow) && !maXfIdRowRange.intersects( aIt->second.maRange ) ) + { + writeXfIdRangeProperties( aIt->second ); + maXfIdRanges.erase( aIt++ ); + } + else + ++aIt; + } + } + } + + // try to expand last existing range, or create new range entry + if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel.maCellAddr, rModel.mnXfId, nNumFmtId ) ) + maXfIdRanges[ BinAddress( rModel.maCellAddr ) ].set( rModel.maCellAddr, rModel.mnXfId, nNumFmtId ); + + // update merged ranges for 'center across selection' and 'fill' + if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() ) { - ApiTokenSequence aTokens = resolveSharedFormula( maSharedBaseAddr ); - setFormulaCell( maSharedFmlaAddr, aTokens ); + sal_Int32 nHorAlign = pXf->getAlignment().getModel().mnHorAlign; + if( (nHorAlign == XML_centerContinuous) || (nHorAlign == XML_fill) ) + { + /* start new merged range, if cell is not empty (#108781#), + or try to expand last range with empty cell */ + if( rModel.mnCellType != XML_TOKEN_INVALID ) + maCenterFillRanges.push_back( MergedRange( rModel.maCellAddr, nHorAlign ) ); + else if( !maCenterFillRanges.empty() ) + maCenterFillRanges.rbegin()->tryExpand( rModel.maCellAddr, nHorAlign ); + } } } - catch( Exception& ) - { - } - mbPendingSharedFmla = false; -} - -ApiTokenSequence SheetDataBuffer::resolveSharedFormula( const BinAddress& rMapKey ) const -{ - sal_Int32 nTokenIndex = ContainerHelper::getMapElement( maSharedFormulas, rMapKey, -1 ); - return (nTokenIndex >= 0) ? getFormulaParser().convertNameToFormula( nTokenIndex ) : ApiTokenSequence(); } void SheetDataBuffer::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const { - if( (rXfIdRowRange.mnLastRow >= 0) && (rXfIdRowRange.mnXfId >= 0) ) + if( (rXfIdRowRange.maRowRange.mnLast >= 0) && (rXfIdRowRange.mnXfId >= 0) ) { AddressConverter& rAddrConv = getAddressConverter(); - CellRangeAddress aRange( getSheetIndex(), 0, rXfIdRowRange.mnFirstRow, rAddrConv.getMaxApiAddress().Column, rXfIdRowRange.mnLastRow ); + CellRangeAddress aRange( getSheetIndex(), 0, rXfIdRowRange.maRowRange.mnFirst, rAddrConv.getMaxApiAddress().Column, rXfIdRowRange.maRowRange.mnLast ); if( rAddrConv.validateCellRange( aRange, true, false ) ) { PropertySet aPropSet( getCellRange( aRange ) ); diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 63db3286cff6..00c4e21d82e7 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -176,23 +176,30 @@ void SheetDataContext::onEndElement() if( mbHasFormula ) switch( maFmlaData.mnFormulaType ) { case XML_normal: - mrSheetData.setFormulaCell( maCellData.maCellAddr, maTokens ); + mrSheetData.setFormulaCell( maCellData, maTokens ); break; case XML_shared: if( maFmlaData.mnSharedId >= 0 ) { if( mbValidRange && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) ) mrSheetData.createSharedFormula( maFmlaData.mnSharedId, maTokens ); - mrSheetData.setFormulaCell( maCellData.maCellAddr, maFmlaData.mnSharedId ); + mrSheetData.setFormulaCell( maCellData, maFmlaData.mnSharedId ); } + else + // no success, set plain cell value and formatting below + mbHasFormula = false; break; case XML_array: if( mbValidRange && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, maTokens ); + // set cell formatting, but do not set result as cell value + mrSheetData.setBlankCell( maCellData ); break; case XML_dataTable: if( mbValidRange ) mrSheetData.createTableOperation( maFmlaData.maFormulaRef, maTableData ); + // set cell formatting, but do not set result as cell value + mrSheetData.setBlankCell( maCellData ); break; default: OSL_ENSURE( maFmlaData.mnFormulaType == XML_TOKEN_INVALID, "SheetDataContext::onEndElement - unknown formula type" ); @@ -205,38 +212,33 @@ void SheetDataContext::onEndElement() if( maCellValue.getLength() > 0 ) switch( maCellData.mnCellType ) { case XML_n: - mrSheetData.setValueCell( maCellData.maCellAddr, maCellValue.toDouble() ); + mrSheetData.setValueCell( maCellData, maCellValue.toDouble() ); break; case XML_b: - mrSheetData.setBooleanCell( maCellData.maCellAddr, maCellValue.toDouble() != 0.0 ); + mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 ); break; case XML_e: - mrSheetData.setErrorCell( maCellData.maCellAddr, maCellValue ); + mrSheetData.setErrorCell( maCellData, maCellValue ); break; case XML_str: - mrSheetData.setStringCell( maCellData.maCellAddr, maCellValue ); + mrSheetData.setStringCell( maCellData, maCellValue ); break; case XML_s: - mrSheetData.setStringCell( maCellData.maCellAddr, maCellValue.toInt32(), maCellData.mnXfId ); + mrSheetData.setStringCell( maCellData, maCellValue.toInt32() ); break; } else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr.get() ) { mxInlineStr->finalizeImport(); - mrSheetData.setStringCell( maCellData.maCellAddr, *mxInlineStr, maCellData.mnXfId ); + mrSheetData.setStringCell( maCellData, mxInlineStr ); } else { // empty cell, update cell type maCellData.mnCellType = XML_TOKEN_INVALID; + mrSheetData.setBlankCell( maCellData ); } } - - // #108770# set 'Standard' number format for all Boolean cells - bool bBoolCell = !mbHasFormula && (maCellData.mnCellType == XML_b); - sal_Int32 nNumFmtId = bBoolCell ? 0 : -1; - // store the cell formatting data - mrSheetData.setCellFormat( maCellData, nNumFmtId ); } } @@ -285,7 +287,7 @@ ContextHandlerRef SheetDataContext::onCreateRecordContext( sal_Int32 nRecId, Seq void SheetDataContext::importRow( const AttributeList& rAttribs ) { RowModel aModel; - aModel.mnFirstRow = aModel.mnLastRow = rAttribs.getInteger( XML_r, -1 ); + aModel.mnRow = rAttribs.getInteger( XML_r, -1 ); aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 ); aModel.mnXfId = rAttribs.getInteger( XML_s, -1 ); aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 ); @@ -296,6 +298,23 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false ); aModel.mbThickTop = rAttribs.getBool( XML_thickTop, false ); aModel.mbThickBottom = rAttribs.getBool( XML_thickBot, false ); + + // decode the column spans (space-separated list of colon-separated integer pairs) + OUString aColSpansText = rAttribs.getString( XML_spans, OUString() ); + sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Column; + sal_Int32 nIndex = 0; + while( nIndex >= 0 ) + { + OUString aColSpanToken = aColSpansText.getToken( 0, ' ', nIndex ); + sal_Int32 nSepPos = aColSpanToken.indexOf( ':' ); + if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) ) + { + // OOXML uses 1-based integer column indexes, row model expects 0-based colspans + sal_Int32 nLastCol = ::std::min( aColSpanToken.copy( nSepPos + 1 ).toInt32() - 1, nMaxCol ); + aModel.insertColSpan( ValueRange( aColSpanToken.copy( 0, nSepPos ).toInt32() - 1, nLastCol ) ); + } + } + // set row properties in the current sheet setRowModel( aModel ); } @@ -345,12 +364,14 @@ void SheetDataContext::importFormula( const AttributeList& rAttribs ) void SheetDataContext::importRow( SequenceInputStream& rStrm ) { RowModel aModel; + sal_Int32 nSpanCount; sal_uInt16 nHeight, nFlags1; sal_uInt8 nFlags2; - rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2; + rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2 >> nSpanCount; + maCurrPos.mnCol = 0; // row index is 0-based in BIFF12, but RowModel expects 1-based - aModel.mnFirstRow = aModel.mnLastRow = maCurrPos.mnRow + 1; + aModel.mnRow = maCurrPos.mnRow + 1; // row height is in twips in BIFF12, convert to points aModel.mfHeight = nHeight / 20.0; aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 ); @@ -361,6 +382,16 @@ void SheetDataContext::importRow( SequenceInputStream& rStrm ) aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED ); aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP ); aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM ); + + // read the column spans + sal_Int32 nMaxCol = mrAddressConv.getMaxApiAddress().Column; + for( sal_Int32 nSpanIdx = 0; (nSpanIdx < nSpanCount) && !rStrm.isEof(); ++nSpanIdx ) + { + sal_Int32 nFirstCol, nLastCol; + rStrm >> nFirstCol >> nLastCol; + aModel.insertColSpan( ValueRange( nFirstCol, ::std::min( nLastCol, nMaxCol ) ) ); + } + // set row properties in the current sheet setRowModel( aModel ); } @@ -407,12 +438,9 @@ void SheetDataContext::importCellBool( SequenceInputStream& rStrm, CellType eCel maCellData.mnCellType = XML_b; bool bValue = rStrm.readuInt8() != 0; if( eCellType == CELLTYPE_FORMULA ) - mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); + mrSheetData.setFormulaCell( maCellData, readCellFormula( rStrm ) ); else - mrSheetData.setBooleanCell( maCellData.maCellAddr, bValue ); - // #108770# set 'Standard' number format for all Boolean cells - sal_Int32 nNumFmtId = (eCellType != CELLTYPE_FORMULA) ? 0 : -1; - mrSheetData.setCellFormat( maCellData, nNumFmtId ); + mrSheetData.setBooleanCell( maCellData, bValue ); } } @@ -420,7 +448,7 @@ void SheetDataContext::importCellBlank( SequenceInputStream& rStrm, CellType eCe { OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" ); if( readCellHeader( rStrm, eCellType ) ) - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setBlankCell( maCellData ); } void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eCellType ) @@ -430,10 +458,9 @@ void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eC maCellData.mnCellType = XML_n; double fValue = rStrm.readDouble(); if( eCellType == CELLTYPE_FORMULA ) - mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); + mrSheetData.setFormulaCell( maCellData, readCellFormula( rStrm ) ); else - mrSheetData.setValueCell( maCellData.maCellAddr, fValue ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, fValue ); } } @@ -444,10 +471,9 @@ void SheetDataContext::importCellError( SequenceInputStream& rStrm, CellType eCe maCellData.mnCellType = XML_e; sal_uInt8 nErrorCode = rStrm.readuInt8(); if( eCellType == CELLTYPE_FORMULA ) - mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); + mrSheetData.setFormulaCell( maCellData, readCellFormula( rStrm ) ); else - mrSheetData.setErrorCell( maCellData.maCellAddr, nErrorCode ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setErrorCell( maCellData, nErrorCode ); } } @@ -457,8 +483,7 @@ void SheetDataContext::importCellRk( SequenceInputStream& rStrm, CellType eCellT if( readCellHeader( rStrm, eCellType ) ) { maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); } } @@ -468,11 +493,10 @@ void SheetDataContext::importCellRString( SequenceInputStream& rStrm, CellType e if( readCellHeader( rStrm, eCellType ) ) { maCellData.mnCellType = XML_inlineStr; - RichString aString( *this ); - aString.importString( rStrm, true ); - aString.finalizeImport(); - mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); - mrSheetData.setCellFormat( maCellData ); + RichStringRef xString( new RichString( *this ) ); + xString->importString( rStrm, true ); + xString->finalizeImport(); + mrSheetData.setStringCell( maCellData, xString ); } } @@ -482,8 +506,7 @@ void SheetDataContext::importCellSi( SequenceInputStream& rStrm, CellType eCellT if( readCellHeader( rStrm, eCellType ) ) { maCellData.mnCellType = XML_s; - mrSheetData.setStringCell( maCellData.maCellAddr, rStrm.readInt32(), maCellData.mnXfId ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setStringCell( maCellData, rStrm.readInt32() ); } } @@ -493,14 +516,13 @@ void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eC { maCellData.mnCellType = XML_inlineStr; // always import the string, stream will point to formula afterwards, if existing - RichString aString( *this ); - aString.importString( rStrm, false ); - aString.finalizeImport(); + RichStringRef xString( new RichString( *this ) ); + xString->importString( rStrm, false ); + xString->finalizeImport(); if( eCellType == CELLTYPE_FORMULA ) - mrSheetData.setFormulaCell( maCellData.maCellAddr, readCellFormula( rStrm ) ); + mrSheetData.setFormulaCell( maCellData, readCellFormula( rStrm ) ); else - mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setStringCell( maCellData, xString ); } } @@ -656,10 +678,8 @@ void BiffSheetDataContext::importRecord( BiffInputStream& rStrm ) void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) { RowModel aModel; - sal_uInt16 nRow, nHeight; - rStrm >> nRow; - rStrm.skip( 4 ); - rStrm >> nHeight; + sal_uInt16 nRow, nFirstUsedCol, nFirstFreeCol, nHeight; + rStrm >> nRow >> nFirstUsedCol >> nFirstFreeCol >> nHeight; if( getBiff() == BIFF2 ) { rStrm.skip( 2 ); @@ -686,14 +706,21 @@ void BiffSheetDataContext::importRow( BiffInputStream& rStrm ) } // row index is 0-based in BIFF, but RowModel expects 1-based - aModel.mnFirstRow = aModel.mnLastRow = nRow + 1; + aModel.mnRow = static_cast< sal_Int32 >( nRow ) + 1; // row height is in twips in BIFF, convert to points aModel.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0; + // set column spans + if( nFirstUsedCol < nFirstFreeCol ) + { + sal_Int32 nLastCol = ::std::min< sal_Int32 >( nFirstFreeCol - 1, mrAddressConv.getMaxApiAddress().Column ); + aModel.insertColSpan( ValueRange( nFirstUsedCol, nLastCol ) ); + } + // set row properties in the current sheet setRowModel( aModel ); } -bool BiffSheetDataContext::readCellXfId( const BinAddress& rAddr, BiffInputStream& rStrm, bool bBiff2 ) +bool BiffSheetDataContext::readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 ) { bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, rAddr, mnSheet, true ); if( bValidAddr ) @@ -746,7 +773,7 @@ bool BiffSheetDataContext::readCellHeader( BiffInputStream& rStrm, bool bBiff2 ) { BinAddress aAddr; rStrm >> aAddr; - return readCellXfId( aAddr, rStrm, bBiff2 ); + return readCellXfId( rStrm, aAddr, bBiff2 ); } bool BiffSheetDataContext::readFormulaRef( BiffInputStream& rStrm ) @@ -759,7 +786,7 @@ bool BiffSheetDataContext::readFormulaRef( BiffInputStream& rStrm ) void BiffSheetDataContext::importBlank( BiffInputStream& rStrm ) { if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK ) ) - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setBlankCell( maCellData ); } void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) @@ -772,18 +799,17 @@ void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm ) { case BIFF_BOOLERR_BOOL: maCellData.mnCellType = XML_b; - mrSheetData.setBooleanCell( maCellData.maCellAddr, nValue != 0 ); + mrSheetData.setBooleanCell( maCellData, nValue != 0 ); break; case BIFF_BOOLERR_ERROR: maCellData.mnCellType = XML_e; - mrSheetData.setErrorCell( maCellData.maCellAddr, nValue ); + mrSheetData.setErrorCell( maCellData, nValue ); break; default: OSL_ENSURE( false, "BiffSheetDataContext::importBoolErr - unknown cell type" ); + maCellData.mnCellType = XML_TOKEN_INVALID; + mrSheetData.setBlankCell( maCellData ); } - // #108770# set 'Standard' number format for all Boolean cells - sal_Int32 nNumFmtId = (nType == BIFF_BOOLERR_BOOL) ? 0 : -1; - mrSheetData.setCellFormat( maCellData, nNumFmtId ); } } @@ -794,8 +820,7 @@ void BiffSheetDataContext::importFormula( BiffInputStream& rStrm ) maCellData.mnCellType = XML_n; rStrm.skip( mnFormulaSkipSize ); ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); - mrSheetData.setFormulaCell( maCellData.maCellAddr, aTokens ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setFormulaCell( maCellData, aTokens ); } } @@ -804,8 +829,7 @@ void BiffSheetDataContext::importInteger( BiffInputStream& rStrm ) if( readCellHeader( rStrm, true ) ) { maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData.maCellAddr, rStrm.readuInt16() ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, rStrm.readuInt16() ); } } @@ -822,10 +846,13 @@ void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) if( readCellHeader( rStrm, bBiff2Xf ) ) { maCellData.mnCellType = XML_inlineStr; - RichString aString( *this ); if( getBiff() == BIFF8 ) { - aString.importUniString( rStrm ); + // string may contain rich-text formatting + RichStringRef xString( new RichString( *this ) ); + xString->importUniString( rStrm ); + xString->finalizeImport(); + mrSheetData.setStringCell( maCellData, xString ); } else { @@ -833,13 +860,24 @@ void BiffSheetDataContext::importLabel( BiffInputStream& rStrm ) rtl_TextEncoding eTextEnc = getTextEncoding(); if( const Font* pFont = getStyles().getFontFromCellXf( maCellData.mnXfId ).get() ) eTextEnc = pFont->getFontEncoding(); - BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT; - setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING ); - aString.importByteString( rStrm, eTextEnc, nFlags ); + // RSTRING record contains rich-text formatting + if( rStrm.getRecId() == BIFF_ID_RSTRING ) + { + BiffStringFlags nFlags = BIFF_STR_EXTRAFONTS; + // BIFF2 record identifier: 8-bit string length (see above) + setFlag( nFlags, BIFF_STR_8BITLENGTH, bBiff2Xf ); + RichStringRef xString( new RichString( *this ) ); + xString->importByteString( rStrm, eTextEnc, nFlags ); + xString->finalizeImport(); + mrSheetData.setStringCell( maCellData, xString ); + } + else + { + // BIFF2 record identifier: 8-bit string length (see above) + OUString aText = rStrm.readByteStringUC( !bBiff2Xf, eTextEnc ); + mrSheetData.setStringCell( maCellData, aText ); + } } - aString.finalizeImport(); - mrSheetData.setStringCell( maCellData.maCellAddr, aString, maCellData.mnXfId ); - mrSheetData.setCellFormat( maCellData ); } } @@ -848,8 +886,7 @@ void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm ) if( readCellHeader( rStrm, false ) ) { maCellData.mnCellType = XML_s; - mrSheetData.setStringCell( maCellData.maCellAddr, rStrm.readInt32(), maCellData.mnXfId ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setStringCell( maCellData, rStrm.readInt32() ); } } @@ -858,8 +895,8 @@ void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm ) BinAddress aAddr; bool bValidAddr = true; for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) - if( (bValidAddr = readCellXfId( aAddr, rStrm, false )) == true ) - mrSheetData.setCellFormat( maCellData ); + if( (bValidAddr = readCellXfId( rStrm, aAddr, false )) == true ) + mrSheetData.setBlankCell( maCellData ); } void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm ) @@ -868,12 +905,11 @@ void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm ) bool bValidAddr = true; for( rStrm >> aAddr; bValidAddr && (rStrm.getRemaining() > 2); ++aAddr.mnCol ) { - if( (bValidAddr = readCellXfId( aAddr, rStrm, false )) == true ) + if( (bValidAddr = readCellXfId( rStrm, aAddr, false )) == true ) { maCellData.mnCellType = XML_n; sal_Int32 nRkValue = rStrm.readInt32(); - mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( nRkValue ) ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, BiffHelper::calcDoubleFromRk( nRkValue ) ); } } } @@ -883,8 +919,7 @@ void BiffSheetDataContext::importNumber( BiffInputStream& rStrm ) if( readCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER ) ) { maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData.maCellAddr, rStrm.readDouble() ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, rStrm.readDouble() ); } } @@ -893,8 +928,7 @@ void BiffSheetDataContext::importRk( BiffInputStream& rStrm ) if( readCellHeader( rStrm, false ) ) { maCellData.mnCellType = XML_n; - mrSheetData.setValueCell( maCellData.maCellAddr, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); - mrSheetData.setCellFormat( maCellData ); + mrSheetData.setValueCell( maCellData, BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) ); } } diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index 387aef608339..0b57d2621331 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -525,14 +525,14 @@ void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs ) void WorksheetFragment::importCol( const AttributeList& rAttribs ) { ColumnModel aModel; - aModel.mnFirstCol = rAttribs.getInteger( XML_min, -1 ); - aModel.mnLastCol = rAttribs.getInteger( XML_max, -1 ); - aModel.mfWidth = rAttribs.getDouble( XML_width, 0.0 ); - aModel.mnXfId = rAttribs.getInteger( XML_style, -1 ); - aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 ); - aModel.mbShowPhonetic = rAttribs.getBool( XML_phonetic, false ); - aModel.mbHidden = rAttribs.getBool( XML_hidden, false ); - aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false ); + aModel.maRange.mnFirst = rAttribs.getInteger( XML_min, -1 ); + aModel.maRange.mnLast = rAttribs.getInteger( XML_max, -1 ); + aModel.mfWidth = rAttribs.getDouble( XML_width, 0.0 ); + aModel.mnXfId = rAttribs.getInteger( XML_style, -1 ); + aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 ); + aModel.mbShowPhonetic = rAttribs.getBool( XML_phonetic, false ); + aModel.mbHidden = rAttribs.getBool( XML_hidden, false ); + aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false ); // set column properties in the current sheet setColumnModel( aModel ); } @@ -643,11 +643,11 @@ void WorksheetFragment::importCol( SequenceInputStream& rStrm ) sal_Int32 nWidth; sal_uInt16 nFlags; - rStrm >> aModel.mnFirstCol >> aModel.mnLastCol >> nWidth >> aModel.mnXfId >> nFlags; + rStrm >> aModel.maRange.mnFirst >> aModel.maRange.mnLast >> nWidth >> aModel.mnXfId >> nFlags; // column indexes are 0-based in BIFF12, but ColumnModel expects 1-based - ++aModel.mnFirstCol; - ++aModel.mnLastCol; + ++aModel.maRange.mnFirst; + ++aModel.maRange.mnLast; // width is stored as 1/256th of a character in BIFF12, convert to entire character aModel.mfWidth = static_cast< double >( nWidth ) / 256.0; // equal flags in all BIFFs @@ -945,15 +945,15 @@ void BiffWorksheetFragment::importColInfo( BiffInputStream& rStrm ) ColumnModel aModel; // column indexes are 0-based in BIFF, but ColumnModel expects 1-based - aModel.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1; - aModel.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1; + aModel.maRange.mnFirst = static_cast< sal_Int32 >( nFirstCol ) + 1; + aModel.maRange.mnLast = static_cast< sal_Int32 >( nLastCol ) + 1; // width is stored as 1/256th of a character in BIFF, convert to entire character - aModel.mfWidth = static_cast< double >( nWidth ) / 256.0; - aModel.mnXfId = nXfId; - aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 ); - aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC ); - aModel.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN ); - aModel.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED ); + aModel.mfWidth = static_cast< double >( nWidth ) / 256.0; + aModel.mnXfId = nXfId; + aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 ); + aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC ); + aModel.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN ); + aModel.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED ); // set column properties in the current sheet setColumnModel( aModel ); } @@ -973,8 +973,8 @@ void BiffWorksheetFragment::importColWidth( BiffInputStream& rStrm ) ColumnModel aModel; // column indexes are 0-based in BIFF, but ColumnModel expects 1-based - aModel.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1; - aModel.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1; + aModel.maRange.mnFirst = static_cast< sal_Int32 >( nFirstCol ) + 1; + aModel.maRange.mnLast = static_cast< sal_Int32 >( nLastCol ) + 1; // width is stored as 1/256th of a character in BIFF, convert to entire character aModel.mfWidth = static_cast< double >( nWidth ) / 256.0; // set column properties in the current sheet diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index bba52fb0d8f2..69d17b47a570 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -51,7 +51,6 @@ #include #include #include "oox/core/filterbase.hxx" -#include "oox/helper/containerhelper.hxx" #include "oox/helper/propertyset.hxx" #include "oox/xls/addressconverter.hxx" #include "oox/xls/autofilterbuffer.hxx" @@ -109,84 +108,13 @@ void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double f rxProgressBar->setPosition( fPosition ); } -// ---------------------------------------------------------------------------- - -struct ValueRange -{ - sal_Int32 mnFirst; - sal_Int32 mnLast; - - inline explicit ValueRange( sal_Int32 nValue ) : mnFirst( nValue ), mnLast( nValue ) {} - inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {} -}; - -typedef ::std::vector< ValueRange > ValueRangeVector; - -// ---------------------------------------------------------------------------- - -struct ValueRangeComp -{ - inline bool operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return rRange.mnLast < nValue; } -}; - -// ---------------------------------------------------------------------------- - -class ValueRangeSet -{ -public: - inline explicit ValueRangeSet() {} - - void insert( sal_Int32 nValue ); - void intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const; - -private: - ValueRangeVector maData; -}; - -void ValueRangeSet::insert( sal_Int32 nValue ) -{ - // find the first range that contains nValue or that follows nValue - ValueRangeVector::iterator aBeg = maData.begin(); - ValueRangeVector::iterator aEnd = maData.end(); - ValueRangeVector::iterator aNext = ::std::lower_bound( aBeg, aEnd, nValue, ValueRangeComp() ); - - // nothing to do if found range contains nValue - if( (aNext == aEnd) || (nValue < aNext->mnFirst) ) - { - ValueRangeVector::iterator aPrev = (aNext == aBeg) ? aEnd : (aNext - 1); - bool bJoinPrev = (aPrev != aEnd) && (aPrev->mnLast + 1 == nValue); - bool bJoinNext = (aNext != aEnd) && (aNext->mnFirst - 1 == nValue); - if( bJoinPrev && bJoinNext ) - { - aPrev->mnLast = aNext->mnLast; - maData.erase( aNext ); - } - else if( bJoinPrev ) - ++aPrev->mnLast; - else if( bJoinNext ) - --aNext->mnFirst; - else - maData.insert( aNext, ValueRange( nValue ) ); - } -} - -void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const -{ - orRanges.clear(); - // find the range that contains nFirst or the first range that follows nFirst - ValueRangeVector::const_iterator aIt = ::std::lower_bound( maData.begin(), maData.end(), nFirst, ValueRangeComp() ); - for( ValueRangeVector::const_iterator aEnd = maData.end(); (aIt != aEnd) && (aIt->mnFirst <= nLast); ++aIt ) - orRanges.push_back( ValueRange( ::std::max( aIt->mnFirst, nFirst ), ::std::min( aIt->mnLast, nLast ) ) ); -} - } // namespace // ============================================================================ // ============================================================================ ColumnModel::ColumnModel() : - mnFirstCol( -1 ), - mnLastCol( -1 ), + maRange( -1 ), mfWidth( 0.0 ), mnXfId( -1 ), mnLevel( 0 ), @@ -196,27 +124,22 @@ ColumnModel::ColumnModel() : { } -bool ColumnModel::tryExpand( const ColumnModel& rModel ) +bool ColumnModel::isMergeable( const ColumnModel& rModel ) const { - bool bExpandable = - (mnFirstCol <= rModel.mnFirstCol) && - (rModel.mnFirstCol <= mnLastCol + 1) && - (mfWidth == rModel.mfWidth) && + return + (maRange.mnFirst <= rModel.maRange.mnFirst) && + (rModel.maRange.mnFirst <= maRange.mnLast + 1) && + (mfWidth == rModel.mfWidth) && // ignore mnXfId, cell formatting is always set directly - (mnLevel == rModel.mnLevel) && - (mbHidden == rModel.mbHidden) && - (mbCollapsed == rModel.mbCollapsed); - - if( bExpandable ) - mnLastCol = rModel.mnLastCol; - return bExpandable; + (mnLevel == rModel.mnLevel) && + (mbHidden == rModel.mbHidden) && + (mbCollapsed == rModel.mbCollapsed); } // ---------------------------------------------------------------------------- RowModel::RowModel() : - mnFirstRow( -1 ), - mnLastRow( -1 ), + mnRow( -1 ), mfHeight( 0.0 ), mnXfId( -1 ), mnLevel( 0 ), @@ -230,21 +153,22 @@ RowModel::RowModel() : { } -bool RowModel::tryExpand( const RowModel& rModel ) +void RowModel::insertColSpan( const ValueRange& rColSpan ) { - bool bExpandable = - (mnFirstRow <= rModel.mnFirstRow) && - (rModel.mnFirstRow <= mnLastRow + 1) && - (mfHeight == rModel.mfHeight) && - // ignore mnXfId, mbCustomFormat, mbShowPhonetic - cell formatting is always set directly - (mnLevel == rModel.mnLevel) && - (mbCustomHeight == rModel.mbCustomHeight) && - (mbHidden == rModel.mbHidden) && - (mbCollapsed == rModel.mbCollapsed); + if( (0 <= rColSpan.mnFirst) && (rColSpan.mnFirst <= rColSpan.mnLast) ) + maColSpans.insert( rColSpan ); +} - if( bExpandable ) - mnLastRow = rModel.mnLastRow; - return bExpandable; +bool RowModel::isMergeable( const RowModel& rModel ) const +{ + return + // ignore maColSpans - is handled separately in SheetDataBuffer class + (mfHeight == rModel.mfHeight) && + // ignore mnXfId, mbCustomFormat, mbShowPhonetic - cell formatting is always set directly + (mnLevel == rModel.mnLevel) && + (mbCustomHeight == rModel.mbCustomHeight) && + (mbHidden == rModel.mbHidden) && + (mbCollapsed == rModel.mbCollapsed); } // ---------------------------------------------------------------------------- @@ -330,9 +254,9 @@ public: Reference< XCellRange > getRow( sal_Int32 nRow ) const; /** Returns the XTableColumns interface for a range of columns. */ - Reference< XTableColumns > getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const; + Reference< XTableColumns > getColumns( const ValueRange& rColRange ) const; /** Returns the XTableRows interface for a range of rows. */ - Reference< XTableRows > getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const; + Reference< XTableRows > getRows( const ValueRange& rRowRange ) const; /** Returns the XDrawPage interface of the draw page of the current sheet. */ Reference< XDrawPage > getDrawPage() const; @@ -419,8 +343,10 @@ public: private: typedef ::std::vector< sal_Int32 > OutlineLevelVec; - typedef ::std::map< sal_Int32, ColumnModel > ColumnModelMap; - typedef ::std::map< sal_Int32, RowModel > RowModelMap; + typedef ::std::pair< ColumnModel, sal_Int32 > ColumnModelRange; + typedef ::std::map< sal_Int32, ColumnModelRange > ColumnModelRangeMap; + typedef ::std::pair< RowModel, sal_Int32 > RowModelRange; + typedef ::std::map< sal_Int32, RowModelRange > RowModelRangeMap; typedef ::std::list< HyperlinkModel > HyperlinkModelList; typedef ::std::list< ValidationModel > ValidationModelList; @@ -437,12 +363,12 @@ private: /** Converts column properties for all columns in the sheet. */ void convertColumns(); /** Converts column properties. */ - void convertColumns( OutlineLevelVec& orColLevels, sal_Int32 nFirstCol, sal_Int32 nLastCol, const ColumnModel& rModel ); + void convertColumns( OutlineLevelVec& orColLevels, const ValueRange& rColRange, const ColumnModel& rModel ); /** Converts row properties for all rows in the sheet. */ void convertRows(); /** Converts row properties. */ - void convertRows( OutlineLevelVec& orRowLevels, sal_Int32 nFirstRow, sal_Int32 nLastRow, const RowModel& rModel, double fDefHeight = -1.0 ); + void convertRows( OutlineLevelVec& orRowLevels, const ValueRange& rRowRange, const RowModel& rModel, double fDefHeight = -1.0 ); /** Converts outline grouping for the passed column or row. */ void convertOutlines( OutlineLevelVec& orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows ); @@ -461,9 +387,9 @@ private: const CellAddress& mrMaxApiPos; /// Reference to maximum Calc cell address from address converter. CellRangeAddress maUsedArea; /// Used area of the sheet, and sheet index of the sheet. ColumnModel maDefColModel; /// Default column formatting. - ColumnModelMap maColModels; /// Columns sorted by first column index. + ColumnModelRangeMap maColModels; /// Ranges of columns sorted by first column index. RowModel maDefRowModel; /// Default row formatting. - RowModelMap maRowModels; /// Rows sorted by row index. + RowModelRangeMap maRowModels; /// Ranges of rows sorted by first row index. HyperlinkModelList maHyperlinks; /// Cell ranges containing hyperlinks. ValidationModelList maValidations; /// Cell ranges containing data validation settings. ValueRangeSet maManualRowHeights; /// Rows that need manual height independent from own settings. @@ -622,26 +548,26 @@ Reference< XCellRange > WorksheetGlobals::getRow( sal_Int32 nRow ) const return xRow; } -Reference< XTableColumns > WorksheetGlobals::getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const +Reference< XTableColumns > WorksheetGlobals::getColumns( const ValueRange& rColRange ) const { Reference< XTableColumns > xColumns; - nLastCol = ::std::min( nLastCol, mrMaxApiPos.Column ); - if( (0 <= nFirstCol) && (nFirstCol <= nLastCol) ) + sal_Int32 nLastCol = ::std::min( rColRange.mnLast, mrMaxApiPos.Column ); + if( (0 <= rColRange.mnFirst) && (rColRange.mnFirst <= nLastCol) ) { - Reference< XColumnRowRange > xRange( getCellRange( CellRangeAddress( getSheetIndex(), nFirstCol, 0, nLastCol, 0 ) ), UNO_QUERY ); + Reference< XColumnRowRange > xRange( getCellRange( CellRangeAddress( getSheetIndex(), rColRange.mnFirst, 0, nLastCol, 0 ) ), UNO_QUERY ); if( xRange.is() ) xColumns = xRange->getColumns(); } return xColumns; } -Reference< XTableRows > WorksheetGlobals::getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const +Reference< XTableRows > WorksheetGlobals::getRows( const ValueRange& rRowRange ) const { Reference< XTableRows > xRows; - nLastRow = ::std::min( nLastRow, mrMaxApiPos.Row ); - if( (0 <= nFirstRow) && (nFirstRow <= nLastRow) ) + sal_Int32 nLastRow = ::std::min( rRowRange.mnLast, mrMaxApiPos.Row ); + if( (0 <= rRowRange.mnFirst) && (rRowRange.mnFirst <= nLastRow) ) { - Reference< XColumnRowRange > xRange( getCellRange( CellRangeAddress( getSheetIndex(), 0, nFirstRow, 0, nLastRow ) ), UNO_QUERY ); + Reference< XColumnRowRange > xRange( getCellRange( CellRangeAddress( getSheetIndex(), 0, rRowRange.mnFirst, 0, nLastRow ) ), UNO_QUERY ); if( xRange.is() ) xRows = xRange->getRows(); } @@ -894,15 +820,48 @@ void WorksheetGlobals::setDefaultColumnWidth( double fWidth ) void WorksheetGlobals::setColumnModel( const ColumnModel& rModel ) { // convert 1-based OOXML column indexes to 0-based API column indexes - sal_Int32 nFirstCol = rModel.mnFirstCol - 1; - sal_Int32 nLastCol = rModel.mnLastCol - 1; - if( (0 <= nFirstCol) && (nFirstCol <= mrMaxApiPos.Column) ) + sal_Int32 nFirstCol = rModel.maRange.mnFirst - 1; + sal_Int32 nLastCol = rModel.maRange.mnLast - 1; + if( getAddressConverter().checkCol( nFirstCol, true ) && (nFirstCol <= nLastCol) ) { - // set column formatting directly, nLastCol is checked inside the function - convertColumnFormat( nFirstCol, nLastCol, rModel.mnXfId ); - // expand last entry or add new entry - if( maColModels.empty() || !maColModels.rbegin()->second.tryExpand( rModel ) ) - maColModels[ nFirstCol ] = rModel; + // validate last column index + if( !getAddressConverter().checkCol( nLastCol, true ) ) + nLastCol = mrMaxApiPos.Column; + // try to find entry in column model map that is able to merge with the passed model + bool bInsertModel = true; + if( !maColModels.empty() ) + { + // find first column model range following nFirstCol (nFirstCol < aIt->first), or end of map + ColumnModelRangeMap::iterator aIt = maColModels.upper_bound( nFirstCol ); + OSL_ENSURE( aIt == maColModels.end(), "WorksheetGlobals::setColModel - columns are unsorted" ); + // if inserting before another column model, get last free column + OSL_ENSURE( (aIt == maColModels.end()) || (nLastCol < aIt->first), "WorksheetGlobals::setColModel - multiple models of the same column" ); + if( aIt != maColModels.end() ) + nLastCol = ::std::min( nLastCol, aIt->first - 1 ); + if( aIt != maColModels.begin() ) + { + // go to previous map element (which may be able to merge with the passed model) + --aIt; + // the usage of upper_bound() above ensures that aIt->first is less than or equal to nFirstCol now + sal_Int32& rnLastMapCol = aIt->second.second; + OSL_ENSURE( rnLastMapCol < nFirstCol, "WorksheetGlobals::setColModel - multiple models of the same column" ); + nFirstCol = ::std::max( rnLastMapCol + 1, nFirstCol ); + if( (rnLastMapCol + 1 == nFirstCol) && (nFirstCol <= nLastCol) && aIt->second.first.isMergeable( rModel ) ) + { + // can merge with existing model, update last column index + rnLastMapCol = nLastCol; + bInsertModel = false; + } + } + } + if( nFirstCol <= nLastCol ) + { + // insert the column model, if it has not been merged with another + if( bInsertModel ) + maColModels[ nFirstCol ] = ColumnModelRange( rModel, nLastCol ); + // set column formatting directly + convertColumnFormat( nFirstCol, nLastCol, rModel.mnXfId ); + } } } @@ -927,18 +886,46 @@ void WorksheetGlobals::setDefaultRowSettings( double fHeight, bool bCustomHeight void WorksheetGlobals::setRowModel( const RowModel& rModel ) { - // convert 1-based OOXML row indexes to 0-based API row indexes - sal_Int32 nFirstRow = rModel.mnFirstRow - 1; - sal_Int32 nLastRow = rModel.mnLastRow - 1; - if( (0 <= nFirstRow) && (nFirstRow <= mrMaxApiPos.Row) ) + // convert 1-based OOXML row index to 0-based API row index + sal_Int32 nRow = rModel.mnRow - 1; + if( getAddressConverter().checkRow( nRow, true ) ) { - // set row formatting - maSheetData.setRowFormat( nFirstRow, nLastRow, rModel.mnXfId, rModel.mbCustomFormat ); - // expand last entry or add new entry - if( maRowModels.empty() || !maRowModels.rbegin()->second.tryExpand( rModel ) ) - maRowModels[ nFirstRow ] = rModel; + // try to find entry in row model map that is able to merge with the passed model + bool bInsertModel = true; + bool bUnusedRow = true; + if( !maRowModels.empty() ) + { + // find first row model range following nRow (nRow < aIt->first), or end of map + RowModelRangeMap::iterator aIt = maRowModels.upper_bound( nRow ); + OSL_ENSURE( aIt == maRowModels.end(), "WorksheetGlobals::setRowModel - rows are unsorted" ); + if( aIt != maRowModels.begin() ) + { + // go to previous map element (which may be able to merge with the passed model) + --aIt; + // the usage of upper_bound() above ensures that aIt->first is less than or equal to nRow now + sal_Int32& rnLastMapRow = aIt->second.second; + bUnusedRow = rnLastMapRow < nRow; + OSL_ENSURE( bUnusedRow, "WorksheetGlobals::setRowModel - multiple models of the same row" ); + if( (rnLastMapRow + 1 == nRow) && aIt->second.first.isMergeable( rModel ) ) + { + // can merge with existing model, update last row index + ++rnLastMapRow; + bInsertModel = false; + } + } + } + if( bUnusedRow ) + { + // insert the row model, if it has not been merged with another + if( bInsertModel ) + maRowModels[ nRow ] = RowModelRange( rModel, nRow ); + // set row formatting + maSheetData.setRowFormat( nRow, rModel.mnXfId, rModel.mbCustomFormat ); + // set column spans + maSheetData.setColSpans( nRow, rModel.maColSpans ); + } } - lclUpdateProgressBar( mxRowProgress, maUsedArea, nLastRow ); + lclUpdateProgressBar( mxRowProgress, maUsedArea, nRow ); } void WorksheetGlobals::setManualRowHeight( sal_Int32 nRow ) @@ -1160,32 +1147,29 @@ void WorksheetGlobals::convertColumns() // stores first grouped column index for each level OutlineLevelVec aColLevels; - for( ColumnModelMap::const_iterator aIt = maColModels.begin(), aEnd = maColModels.end(); aIt != aEnd; ++aIt ) + for( ColumnModelRangeMap::iterator aIt = maColModels.begin(), aEnd = maColModels.end(); aIt != aEnd; ++aIt ) { - // convert 1-based OOXML column indexes to 0-based API column indexes - sal_Int32 nFirstCol = ::std::max( aIt->second.mnFirstCol - 1, nNextCol ); - sal_Int32 nLastCol = ::std::min( aIt->second.mnLastCol - 1, nMaxCol ); - + // column indexes are stored 0-based in maColModels + ValueRange aColRange( ::std::max( aIt->first, nNextCol ), ::std::min( aIt->second.second, nMaxCol ) ); // process gap between two column models, use default column model - if( nNextCol < nFirstCol ) - convertColumns( aColLevels, nNextCol, nFirstCol - 1, maDefColModel ); + if( nNextCol < aColRange.mnFirst ) + convertColumns( aColLevels, ValueRange( nNextCol, aColRange.mnFirst - 1 ), maDefColModel ); // process the column model - convertColumns( aColLevels, nFirstCol, nLastCol, aIt->second ); - + convertColumns( aColLevels, aColRange, aIt->second.first ); // cache next column to be processed - nNextCol = nLastCol + 1; + nNextCol = aColRange.mnLast + 1; } // remaining default columns to end of sheet - convertColumns( aColLevels, nNextCol, nMaxCol, maDefColModel ); + convertColumns( aColLevels, ValueRange( nNextCol, nMaxCol ), maDefColModel ); // close remaining column outlines spanning to end of sheet convertOutlines( aColLevels, nMaxCol + 1, 0, false, false ); } void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels, - sal_Int32 nFirstCol, sal_Int32 nLastCol, const ColumnModel& rModel ) + const ValueRange& rColRange, const ColumnModel& rModel ) { - PropertySet aPropSet( getColumns( nFirstCol, nLastCol ) ); + PropertySet aPropSet( getColumns( rColRange ) ); // column width: convert 'number of characters' to column width in 1/100 mm sal_Int32 nWidth = getUnitConverter().scaleToMm100( rModel.mfWidth, UNIT_DIGIT ); @@ -1200,7 +1184,7 @@ void WorksheetGlobals::convertColumns( OutlineLevelVec& orColLevels, aPropSet.setProperty( PROP_IsVisible, false ); // outline settings for this column range - convertOutlines( orColLevels, nFirstCol, rModel.mnLevel, rModel.mbCollapsed, false ); + convertOutlines( orColLevels, rColRange.mnFirst, rModel.mnLevel, rModel.mbCollapsed, false ); } void WorksheetGlobals::convertRows() @@ -1210,44 +1194,45 @@ void WorksheetGlobals::convertRows() // stores first grouped row index for each level OutlineLevelVec aRowLevels; - for( RowModelMap::const_iterator aIt = maRowModels.begin(), aEnd = maRowModels.end(); aIt != aEnd; ++aIt ) + for( RowModelRangeMap::iterator aIt = maRowModels.begin(), aEnd = maRowModels.end(); aIt != aEnd; ++aIt ) { - // convert 1-based OOXML row indexes to 0-based API row indexes - sal_Int32 nFirstRow = ::std::max( aIt->second.mnFirstRow - 1, nNextRow ); - sal_Int32 nLastRow = ::std::min( aIt->second.mnLastRow - 1, nMaxRow ); - + // row indexes are stored 0-based in maRowModels + ValueRange aRowRange( ::std::max( aIt->first, nNextRow ), ::std::min( aIt->second.second, nMaxRow ) ); // process gap between two row models, use default row model - if( nNextRow < nFirstRow ) - convertRows( aRowLevels, nNextRow, nFirstRow - 1, maDefRowModel ); + if( nNextRow < aRowRange.mnFirst ) + convertRows( aRowLevels, ValueRange( nNextRow, aRowRange.mnFirst - 1 ), maDefRowModel ); // process the row model - convertRows( aRowLevels, nFirstRow, nLastRow, aIt->second, maDefRowModel.mfHeight ); - + convertRows( aRowLevels, aRowRange, aIt->second.first, maDefRowModel.mfHeight ); // cache next row to be processed - nNextRow = nLastRow + 1; + nNextRow = aRowRange.mnLast + 1; } // remaining default rows to end of sheet - convertRows( aRowLevels, nNextRow, nMaxRow, maDefRowModel ); + convertRows( aRowLevels, ValueRange( nNextRow, nMaxRow ), maDefRowModel ); // close remaining row outlines spanning to end of sheet convertOutlines( aRowLevels, nMaxRow + 1, 0, false, true ); } void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels, - sal_Int32 nFirstRow, sal_Int32 nLastRow, const RowModel& rModel, double fDefHeight ) + const ValueRange& rRowRange, const RowModel& rModel, double fDefHeight ) { // row height: convert points to row height in 1/100 mm double fHeight = (rModel.mfHeight >= 0.0) ? rModel.mfHeight : fDefHeight; sal_Int32 nHeight = getUnitConverter().scaleToMm100( fHeight, UNIT_POINT ); if( nHeight > 0 ) { + /* Get all rows that have custom height inside the passed row model. + If the model has the custom height flag set, all its rows have + custom height, otherwise get all rows specified in the class member + maManualRowHeights that are inside the passed row model. */ ValueRangeVector aManualRows; if( rModel.mbCustomHeight ) - aManualRows.push_back( ValueRange( nFirstRow, nLastRow ) ); + aManualRows.push_back( rRowRange ); else - maManualRowHeights.intersect( aManualRows, nFirstRow, nLastRow ); + aManualRows = maManualRowHeights.getIntersection( rRowRange ); for( ValueRangeVector::const_iterator aIt = aManualRows.begin(), aEnd = aManualRows.end(); aIt != aEnd; ++aIt ) { - PropertySet aPropSet( getRows( aIt->mnFirst, aIt->mnLast ) ); + PropertySet aPropSet( getRows( *aIt ) ); aPropSet.setProperty( PROP_Height, nHeight ); } } @@ -1255,12 +1240,12 @@ void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels, // hidden rows: TODO: #108683# hide rows later? if( rModel.mbHidden ) { - PropertySet aPropSet( getRows( nFirstRow, nLastRow ) ); + PropertySet aPropSet( getRows( rRowRange ) ); aPropSet.setProperty( PROP_IsVisible, false ); } // outline settings for this row range - convertOutlines( orRowLevels, nFirstRow, rModel.mnLevel, rModel.mbCollapsed, true ); + convertOutlines( orRowLevels, rRowRange.mnFirst, rModel.mnLevel, rModel.mbCollapsed, true ); } void WorksheetGlobals::convertOutlines( OutlineLevelVec& orLevels, @@ -1449,14 +1434,14 @@ Reference< XCellRange > WorksheetHelper::getRow( sal_Int32 nRow ) const return mrSheetGlob.getRow( nRow ); } -Reference< XTableColumns > WorksheetHelper::getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const +Reference< XTableColumns > WorksheetHelper::getColumns( const ValueRange& rColRange ) const { - return mrSheetGlob.getColumns( nFirstCol, nLastCol ); + return mrSheetGlob.getColumns( rColRange ); } -Reference< XTableRows > WorksheetHelper::getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const +Reference< XTableRows > WorksheetHelper::getRows( const ValueRange& rRowRange ) const { - return mrSheetGlob.getRows( nFirstRow, nLastRow ); + return mrSheetGlob.getRows( rRowRange ); } Reference< XDrawPage > WorksheetHelper::getDrawPage() const @@ -1661,6 +1646,34 @@ void WorksheetHelper::setManualRowHeight( sal_Int32 nRow ) mrSheetGlob.setManualRowHeight( nRow ); } +void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue ) const +{ + Reference< XCell > xCell = getCell( rAddress ); + OSL_ENSURE( xCell.is(), "WorksheetHelper::putValue - missing cell interface" ); + if( xCell.is() ) xCell->setValue( fValue ); +} + +void WorksheetHelper::putString( const CellAddress& rAddress, const OUString& rText ) const +{ + Reference< XText > xText( getCell( rAddress ), UNO_QUERY ); + OSL_ENSURE( xText.is(), "WorksheetHelper::putString - missing text interface" ); + if( xText.is() ) xText->setString( rText ); +} + +void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichString& rString, const Font* pFirstPortionFont ) const +{ + Reference< XText > xText( getCell( rAddress ), UNO_QUERY ); + OSL_ENSURE( xText.is(), "WorksheetHelper::putRichString - missing text interface" ); + rString.convert( xText, pFirstPortionFont ); +} + +void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens ) const +{ + Reference< XFormulaTokens > xTokens( getCell( rAddress ), UNO_QUERY ); + OSL_ENSURE( xTokens.is(), "WorksheetHelper::putFormulaTokens - missing token interface" ); + if( xTokens.is() ) xTokens->setTokens( rTokens ); +} + void WorksheetHelper::initializeWorksheetImport() { mrSheetGlob.initializeWorksheetImport(); -- cgit From a49ccf80a5fb9115fe7abfcc9c107d3ae126a33b Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 28 Feb 2011 14:05:07 +0100 Subject: dr78: removed remaining tools types --- sc/inc/dociter.hxx | 8 ++++---- sc/source/core/data/dociter.cxx | 6 +++--- sc/source/core/data/documen8.cxx | 6 +++--- sc/source/core/data/document.cxx | 4 ++-- sc/source/core/tool/interpr5.cxx | 4 ++-- sc/source/filter/excel/read.cxx | 2 +- sc/source/ui/docshell/dbdocfun.cxx | 2 +- sc/source/ui/docshell/dbdocimp.cxx | 4 ++-- sc/source/ui/docshell/docsh4.cxx | 2 +- sc/source/ui/docshell/docsh8.cxx | 4 ++-- sc/source/ui/inc/dbdocfun.hxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 2 +- sc/source/ui/view/output2.cxx | 4 ++-- sc/source/ui/view/preview.cxx | 6 +++--- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 02eaca587e3b..d5d22ff46ba4 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -453,8 +453,8 @@ private: ScDocument *pDoc; const ScAttrArray *pAttrArray; ScHorizontalCellIterator *pCellIter; - ULONG nNumFormat; // for CalcAsShown - ULONG nNumFmtIndex; + sal_uInt32 nNumFormat; // for CalcAsShown + sal_uInt32 nNumFmtIndex; SCTAB nEndTab; SCCOL nCurCol; SCROW nCurRow; @@ -473,9 +473,9 @@ public: bool bSTotal = false, bool bTextAsZero = false ); ~ScHorizontalValueIterator(); - void GetCurNumFmtInfo( short& nType, ULONG& nIndex ); + void GetCurNumFmtInfo( short& nType, sal_uInt32& nIndex ); /// Does NOT reset rValue if no value found! - bool GetNext( double& rValue, USHORT& rErr ); + bool GetNext( double& rValue, sal_uInt16& rErr ); }; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index a4c0c567c54b..7fe760d76a2e 100755 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1698,7 +1698,7 @@ void ScHorizontalCellIterator::SetTab( SCTAB nTabP ) nTab = nTabP; nRow = nStartRow; nCol = nStartCol; - bMore = TRUE; + bMore = sal_True; for (SCCOL i=nStartCol; i<=nEndCol; i++) { @@ -1837,7 +1837,7 @@ ScHorizontalValueIterator::~ScHorizontalValueIterator() delete pCellIter; } -bool ScHorizontalValueIterator::GetNext( double& rValue, USHORT& rErr ) +bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr ) { bool bFound = false; while ( !bFound ) @@ -1914,7 +1914,7 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, USHORT& rErr ) return bFound; } -void ScHorizontalValueIterator::GetCurNumFmtInfo( short& nType, ULONG& nIndex ) +void ScHorizontalValueIterator::GetCurNumFmtInfo( short& nType, sal_uInt32& nIndex ) { if (!bNumValid) { diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 9560a65c0872..819dbba3ecc8 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1532,7 +1532,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); SfxItemSet* pDefaults = new SfxItemSet( pEngine->GetEmptyItemSet() ); pPattern->FillEditItemSet( pDefaults ); - pEngine->SetDefaults( pDefaults, TRUE ); + pEngine->SetDefaults( pDefaults, sal_True ); if ( eType == CELLTYPE_STRING ) pEngine->SetText( static_cast(pCell)->GetString() ); @@ -1543,7 +1543,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp } pEngine->ClearModifyFlag(); - USHORT nLastPar = pEngine->GetParagraphCount(); + sal_uInt16 nLastPar = pEngine->GetParagraphCount(); if (nLastPar) --nLastPar; xub_StrLen nTxtLen = pEngine->GetTextLen(nLastPar); @@ -1558,7 +1558,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp { // remove defaults (paragraph attributes) before creating text object SfxItemSet* pEmpty = new SfxItemSet( pEngine->GetEmptyItemSet() ); - pEngine->SetDefaults( pEmpty, TRUE ); + pEngine->SetDefaults( pEmpty, sal_True ); EditTextObject* pNewData = pEngine->CreateTextObject(); PutCell( nCol, nRow, nTab, diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d2c54f4346bc..68cbef5e8e94 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2723,7 +2723,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, rtl::OUString if (pFCell->IsValue()) { double fVal = pFCell->GetValue(); - ULONG nIndex = pFormatter->GetStandardFormat( + sal_uInt32 nIndex = pFormatter->GetStandardFormat( NUMBERFORMAT_NUMBER, ScGlobal::eLnge); pFormatter->GetInputLineString(fVal, nIndex, aStr); @@ -2735,7 +2735,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, rtl::OUString case CELLTYPE_VALUE: { double fVal = static_cast(pCell)->GetValue(); - ULONG nIndex = pFormatter->GetStandardFormat( + sal_uInt32 nIndex = pFormatter->GetStandardFormat( NUMBERFORMAT_NUMBER, ScGlobal::eLnge); pFormatter->GetInputLineString(fVal, nIndex, aStr); diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index ec1a2f8fbc5a..cf6757556ed2 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -2348,7 +2348,7 @@ void ScInterpreter::ScRKP() void ScInterpreter::CalulateRGPRKP(bool _bRKP) { - BYTE nParamCount = GetByte(); + sal_uInt8 nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; bool bConstant, bStats; @@ -2881,7 +2881,7 @@ void ScInterpreter::ScGrowth() void ScInterpreter::CalculateTrendGrowth(bool _bGrowth) { - BYTE nParamCount = GetByte(); + sal_uInt8 nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 13328f49c60a..5bbd3ccaa9ec 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -881,7 +881,7 @@ FltError ImportExcel8::Read( void ) case Biff8V: // VB module default: // TODO: do not create a sheet in the Calc document - pD->SetVisible( GetCurrScTab(), FALSE ); + pD->SetVisible( GetCurrScTab(), sal_False ); XclTools::SkipSubStream( maStrm ); IncCurrScTab(); } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index b31b75249497..f0378beced22 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1475,7 +1475,7 @@ void ScDBDocFunc::UpdateImport( const String& rTarget, const svx::ODataAccessDes aImportParam.bSql = ( nCommandType == sdb::CommandType::COMMAND ); aImportParam.aStatement = sDBTable; aImportParam.bNative = sal_False; - aImportParam.nType = static_cast( ( nCommandType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); + aImportParam.nType = static_cast( ( nCommandType == sdb::CommandType::QUERY ) ? ScDbQuery : ScDbTable ); aImportParam.bImport = sal_True; sal_Bool bContinue = DoImport( nTab, aImportParam, &rDescriptor, sal_True ); diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index a2fbc5075856..368850b40399 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -137,7 +137,7 @@ sal_Bool ScDBDocFunc::DoImportUno( const ScAddress& rPos, // ----------------------------------------------------------------- -BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, +sal_Bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, const svx::ODataAccessDescriptor* pDescriptor, sal_Bool bRecord, sal_Bool bAddrInsert ) { ScDocument* pDoc = rDocShell.GetDocument(); @@ -350,7 +350,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, sal_Int32 nNextRow = 0; aSelection[nListPos] >>= nNextRow; if ( nRowsRead+1 < nNextRow ) - bRealSelection = TRUE; + bRealSelection = sal_True; bEnd = !xRowSet->absolute(nRowsRead = nNextRow); } ++nListPos; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 0af3e090cabe..6c799311a37b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -207,7 +207,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) { const SfxPoolItem* pItem; svx::ODataAccessDescriptor aDesc; - if ( pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET ) + if ( pReqArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET ) { uno::Any aAny = static_cast(pItem)->GetValue(); uno::Sequence aProperties; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 2a6dedcc5505..675f9ea109c0 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -317,7 +317,7 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet //! add type descriptions aProgress.SetState( 0 ); - ScColumn::bDoubleAlloc = TRUE; // row count isn't readily available in advance + ScColumn::bDoubleAlloc = sal_True; // row count isn't readily available in advance for (i=0; i 0 ) aDocument.DoColResize( 0, 0, static_cast(nColCount) - 1, 0 ); diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index 0edaef10cd98..d22dc4969cff 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -76,7 +76,7 @@ public: sal_Bool DoImport( SCTAB nTab, const ScImportParam& rParam, const svx::ODataAccessDescriptor* pDescriptor, // used for selection and existing ResultSet sal_Bool bRecord, - sal_Bool bAddrInsert = FALSE ); + sal_Bool bAddrInsert = sal_False ); sal_Bool DoImportUno( const ScAddress& rPos, const com::sun::star::uno::Sequence< diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1fabd891551f..1f8f69a2149a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -910,7 +910,7 @@ sal_Bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, if ( pExtOpt && pExtOpt->IsChanged() ) { pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings - pViewSh->SetTabNo( pViewSh->GetViewData()->GetTabNo(), TRUE ); + pViewSh->SetTabNo( pViewSh->GetViewData()->GetTabNo(), sal_True ); pExtOpt->SetChanged( false ); } diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index a13d6f6edada..2df47d16e195 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1908,10 +1908,10 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic ) ScFieldEditEngine* ScOutputData::CreateOutputEditEngine() { ScFieldEditEngine* pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( FALSE ); + pEngine->SetUpdateMode( sal_False ); // a RefDevice always has to be set, otherwise EditEngine would create a VirtualDevice pEngine->SetRefDevice( pFmtDevice ); - ULONG nCtrl = pEngine->GetControlWord(); + sal_uInt32 nCtrl = pEngine->GetControlWord(); if ( bShowSpellErrors ) nCtrl |= EE_CNTRL_ONLINESPELLING; if ( eType == OUTTYPE_PRINTER ) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 878102743fe9..8fc9c6037cbf 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -375,11 +375,11 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) long nRightMargin = 0; long nTopMargin = 0; long nBottomMargin = 0; - BOOL bHeaderOn = FALSE; - BOOL bFooterOn = FALSE; + sal_Bool bHeaderOn = sal_False; + sal_Bool bFooterOn = sal_False; ScDocument* pDoc = pDocShell->GetDocument(); - BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); Size aLocalPageSize; if ( bValidPage ) -- cgit From 35c2ef4569695240bccebe9e6c56a74b23edd984 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 28 Feb 2011 15:16:06 +0100 Subject: dr78: solaris build error --- oox/inc/oox/helper/helper.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index 4e5efea96f20..bb9877008e89 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -251,8 +251,8 @@ public: template< typename Type > inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount ); - template<> inline static void convertLittleEndianArray( sal_Int8*, size_t ) {} - template<> inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {} + inline static void convertLittleEndianArray( sal_Int8*, size_t ) {} + inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {} #else template< typename Type > -- cgit From 5b9c233e7f80fe363fd3826d76ade9175fa8c4c1 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 28 Feb 2011 15:24:56 +0100 Subject: dr78: #i116996# remove wrong assertions --- sc/source/filter/excel/xladdress.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sc/source/filter/excel/xladdress.cxx b/sc/source/filter/excel/xladdress.cxx index d0c1a925f8ab..62addbc1f4ee 100644 --- a/sc/source/filter/excel/xladdress.cxx +++ b/sc/source/filter/excel/xladdress.cxx @@ -138,8 +138,6 @@ XclAddressConverterBase::XclAddressConverterBase( XclTracer& rTracer, const ScAd mbRowTrunc( false ), mbTabTrunc( false ) { - DBG_ASSERT( static_cast< size_t >( rMaxPos.Col() ) <= SAL_MAX_UINT16, "XclAddressConverterBase::XclAddressConverterBase - invalid max column" ); - DBG_ASSERT( static_cast< size_t >( rMaxPos.Row() ) <= SAL_MAX_UINT16, "XclAddressConverterBase::XclAddressConverterBase - invalid max row" ); } XclAddressConverterBase::~XclAddressConverterBase() -- cgit From 1864247d585887383a0537bb9eb5be2d012cfded Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 28 Feb 2011 15:24:56 +0100 Subject: dr78: #i116996# remove wrong assertions --- oox/source/helper/binaryinputstream.cxx | 5 +++-- oox/source/helper/binaryoutputstream.cxx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx index e61000675006..58c7cca37008 100644 --- a/oox/source/helper/binaryinputstream.cxx +++ b/oox/source/helper/binaryinputstream.cxx @@ -155,7 +155,7 @@ BinaryXInputStream::BinaryXInputStream( const Reference< XInputStream >& rxInStr BinaryXSeekableStream( Reference< XSeekable >( rxInStrm, UNO_QUERY ) ), maBuffer( INPUTSTREAM_BUFFERSIZE ), mxInStrm( rxInStrm ), - mbAutoClose( bAutoClose ) + mbAutoClose( bAutoClose && rxInStrm.is() ) { mbEof = !mxInStrm.is(); } @@ -167,7 +167,7 @@ BinaryXInputStream::~BinaryXInputStream() void BinaryXInputStream::close() { - OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::close - invalid call" ); + OSL_ENSURE( !mbAutoClose || mxInStrm.is(), "BinaryXInputStream::close - invalid call" ); if( mbAutoClose && mxInStrm.is() ) try { mxInStrm->closeInput(); @@ -177,6 +177,7 @@ void BinaryXInputStream::close() OSL_ENSURE( false, "BinaryXInputStream::close - closing input stream failed" ); } mxInStrm.clear(); + mbAutoClose = false; BinaryXSeekableStream::close(); } diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx index 1ae7b15d7595..2f894ccf1bf2 100644 --- a/oox/source/helper/binaryoutputstream.cxx +++ b/oox/source/helper/binaryoutputstream.cxx @@ -52,7 +52,7 @@ BinaryXOutputStream::BinaryXOutputStream( const Reference< XOutputStream >& rxOu BinaryXSeekableStream( Reference< XSeekable >( rxOutStrm, UNO_QUERY ) ), maBuffer( OUTPUTSTREAM_BUFFERSIZE ), mxOutStrm( rxOutStrm ), - mbAutoClose( bAutoClose ) + mbAutoClose( bAutoClose && rxOutStrm.is() ) { mbEof = !mxOutStrm.is(); } @@ -64,7 +64,7 @@ BinaryXOutputStream::~BinaryXOutputStream() void BinaryXOutputStream::close() { - OSL_ENSURE( mxOutStrm.is(), "BinaryXOutputStream::close - invalid call" ); + OSL_ENSURE( !mbAutoClose || mxOutStrm.is(), "BinaryXOutputStream::close - invalid call" ); if( mxOutStrm.is() ) try { mxOutStrm->flush(); @@ -76,6 +76,7 @@ void BinaryXOutputStream::close() OSL_ENSURE( false, "BinaryXOutputStream::close - closing output stream failed" ); } mxOutStrm.clear(); + mbAutoClose = false; BinaryXSeekableStream::close(); } -- cgit From 4592e6d727ae5bd72faa9e630c07778f00edf5eb Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:27 +0100 Subject: sw34bf04: #i114548#: sw::MarkBase: do not create bookmarks with start==end --- sw/source/core/crsr/bookmrk.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 18dc67cfc958..77c7f774843e 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -109,7 +109,7 @@ namespace sw { namespace mark , m_aName(rName) { lcl_FixPosition(*m_pPos1); - if(aPaM.HasMark()) + if (aPaM.HasMark() && (*aPaM.GetMark() != *aPaM.GetPoint())) { MarkBase::SetOtherMarkPos(*(aPaM.GetMark())); lcl_FixPosition(*m_pPos2); -- cgit From 3078020b07e41a6533ba71755d8cc8095bc3c3a7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:27 +0100 Subject: sw34bf04: #i109272#: SwXTextPortionEnumeration: fix CrossRefBookmark handling --- sw/source/core/unocore/unoportenum.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 560fdc27a5b3..80de9d454116 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -155,12 +155,16 @@ namespace ++ppMark) { ::sw::mark::IMark* const pBkmk = ppMark->get(); - bool hasOther = pBkmk->IsExpanded(); + ::sw::mark::CrossRefBookmark *const pCrossRefMark( + dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)); + bool const hasOther = pBkmk->IsExpanded(); const SwPosition& rStartPos = pBkmk->GetMarkStart(); if(rStartPos.nNode == nOwnNode) { - const sal_uInt8 nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END; + // #i109272#: cross reference marks: need special handling! + sal_uInt8 const nType = (hasOther || pCrossRefMark) + ? BKM_TYPE_START : BKM_TYPE_START_END; rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( new SwXBookmarkPortion_Impl( SwXBookmark::CreateXBookmark(rDoc, *pBkmk), @@ -173,8 +177,10 @@ namespace auto_ptr pCrossRefEndPos; const SwPosition* pEndPos = NULL; if(hasOther) + { pEndPos = &rEndPos; - else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)) + } + else if (pCrossRefMark) { // Crossrefbookmarks only remember the start position but have to span the whole paragraph pCrossRefEndPos = auto_ptr(new SwPosition(rEndPos)); -- cgit From e2bb5b7bee4d6d0cd3798b97fa4f12d1f2952ad8 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:28 +0100 Subject: sw34bf04: #i115528#: SwAttrCheckArr: tweak check a bit to fix infinite loop --- sw/source/core/crsr/findattr.cxx | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index b505134e4395..88f345e62bcf 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -311,15 +311,33 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) pItem = aIter.NextItem(); } } + +static bool +lcl_IsAttributeIgnorable(xub_StrLen const nNdStart, xub_StrLen const nNdEnd, + _SwSrchChrAttr const& rTmp) +{ + // #i115528#: if there is a paragraph attribute, it has been added by the + // SwAttrCheckArr ctor, and nFound is 1. + // if the paragraph is entirely covered by hints that override the paragraph + // attribute, then this function must find an attribute to decrement nFound! + // so check for an empty search range, let attributes that start/end there + // cover it, and hope for the best... + return ((nNdEnd == nNdStart) + ? ((rTmp.nEnd < nNdStart) || (nNdEnd < rTmp.nStt)) + : ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt))); +} + int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; - // -------------------------------------------------------------- // Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht // -------------------------------------------------------------- @@ -473,9 +491,12 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd < nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; // -------------------------------------------------------------- -- cgit From 230fcf4a456636bb466f72834cd57238621d206d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:28 +0100 Subject: sw34bf04: #i102333#: SwDoc::ReplaceRangeImpl: remove bogus rPam.Move --- sw/source/core/doc/docedt.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 6e5c259a9d04..488a6a7a44c7 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -2521,8 +2521,6 @@ SetRedlineMode( eOld ); rPam.GetMark()->nNode = aPtNd; rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(), nPtCnt ); - if( bJoinTxt ) - rPam.Move( fnMoveBackward ); if( pUndoRpl ) { -- cgit From 6db3d54a19c2f16be2fc2d05618c4593055c38c5 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:30 +0100 Subject: sw34bf04: #i103539#: always import meta.xml, to extract the BuildId: SvXMLMetaDocumentContext: refactor to not require DocumentProperties, and always set the BuildId from the meta:generator element. {Sc,Sd,Sw}XMLImport::CreateMetaContext(): always create context. sc, sd: add OrganizerMode property to ODF import. --- sw/source/filter/xml/swxml.cxx | 17 +++++++++-------- sw/source/filter/xml/xmlimp.cxx | 18 +++++++++--------- sw/source/filter/xml/xmlimp.hxx | 15 ++++++++++++--- sw/source/filter/xml/xmlmeta.cxx | 26 +++++++++++++++++++------- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 98ae19039002..a892761023e5 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -925,18 +925,19 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con } } - sal_uInt32 nWarn = 0; - sal_uInt32 nWarn2 = 0; // read storage streams + + // #i103539#: always read meta.xml for generator + sal_uInt32 const nWarn = ReadThroughComponent( + xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, + (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" + : "com.sun.star.comp.Writer.XMLMetaImporter"), + aEmptyArgs, rName, sal_False ); + + sal_uInt32 nWarn2 = 0; if( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFmtsOnly() || bInsertMode) ) { - nWarn = ReadThroughComponent( - xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, - (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" - : "com.sun.star.comp.Writer.XMLMetaImporter"), - aEmptyArgs, rName, sal_False ); - nWarn2 = ReadThroughComponent( xStorage, xModelComp, "settings.xml", NULL, xServiceFactory, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisSettingsImporter" diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 279df96eb7cb..6c83855f1719 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -418,6 +418,12 @@ SvXMLImportContext *SwXMLImport::CreateContext( { pContext = CreateMetaContext(rLocalName); } + else if ( XML_NAMESPACE_OFFICE==nPrefix && + IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) + { + pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, + xAttrList ); + } else if ( XML_NAMESPACE_OFFICE==nPrefix && IsXMLToken( rLocalName, XML_DOCUMENT ) ) { @@ -425,17 +431,11 @@ SvXMLImportContext *SwXMLImport::CreateContext( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), uno::UNO_QUERY_THROW); - uno::Reference xDPS( - GetModel(), UNO_QUERY_THROW); + uno::Reference const xDocProps( + GetDocumentProperties()); // flat OpenDocument file format pContext = new SwXMLOfficeDocContext_Impl( *this, nPrefix, rLocalName, - xAttrList, xDPS->getDocumentProperties(), xDocBuilder); - } - else if ( XML_NAMESPACE_OFFICE==nPrefix && - IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) - { - pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, - xAttrList ); + xAttrList, xDocProps, xDocBuilder); } // <-- else diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index c670aaad9073..bec7a88719d4 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -25,14 +25,18 @@ * ************************************************************************/ -#ifndef _XMLIMP_HXX -#define _XMLIMP_HXX +#ifndef SW_XMLIMP_HXX +#define SW_XMLIMP_HXX + +#include #include + #include -#include "xmlitmap.hxx" #include +#include "xmlitmap.hxx" + class SwDoc; class SwPaM; class SvXMLUnitConverter; @@ -211,6 +215,11 @@ public: // initialize XForms virtual void initXForms(); + + // get the document properties, but only if they actually need importing + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> + GetDocumentProperties() const; }; inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx index c337e231017a..473b8065d992 100644 --- a/sw/source/filter/xml/xmlmeta.cxx +++ b/sw/source/filter/xml/xmlmeta.cxx @@ -57,22 +57,34 @@ using namespace ::xmloff::token; // --------------------------------------------------------------------- +uno::Reference +SwXMLImport::GetDocumentProperties() const +{ + if (IsOrganizerMode() || IsStylesOnlyMode() || + IsBlockMode() || IsInsertMode()) + { + return 0; + } + uno::Reference const xDPS( + GetModel(), UNO_QUERY_THROW); + return xDPS->getDocumentProperties(); +} + SvXMLImportContext *SwXMLImport::CreateMetaContext( const OUString& rLocalName ) { SvXMLImportContext *pContext = 0; - if( !(IsStylesOnlyMode() || IsInsertMode()) ) + if (getImportFlags() & IMPORT_META) { - uno::Reference xDocBuilder( + uno::Reference const xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), - uno::UNO_QUERY_THROW); - uno::Reference xDPS( - GetModel(), UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); + uno::Reference const xDocProps( + GetDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, - XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + XML_NAMESPACE_OFFICE, rLocalName, xDocProps, xDocBuilder); } if( !pContext ) -- cgit From bedbe4e2871440b5d276e97c2894c05cc4b6fcda Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:30 +0100 Subject: sw34bf04: #i103539#: always import meta.xml, to extract the BuildId: SvXMLMetaDocumentContext: refactor to not require DocumentProperties, and always set the BuildId from the meta:generator element. {Sc,Sd,Sw}XMLImport::CreateMetaContext(): always create context. sc, sd: add OrganizerMode property to ODF import. --- xmloff/inc/xmloff/xmlmetai.hxx | 10 +--- xmloff/source/draw/sdxmlimp.cxx | 21 +++++--- xmloff/source/meta/xmlmetai.cxx | 113 +++++++++++++++++++++++++++------------- 3 files changed, 94 insertions(+), 50 deletions(-) diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx index efdd1d3f024f..2ddd51920054 100644 --- a/xmloff/inc/xmloff/xmlmetai.hxx +++ b/xmloff/inc/xmloff/xmlmetai.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef _XMLOFF_XMLMETAI_HXX -#define _XMLOFF_XMLMETAI_HXX +#ifndef XMLOFF_XMLMETAI_HXX +#define XMLOFF_XMLMETAI_HXX #include "sal/config.h" #include "xmloff/dllapi.h" @@ -69,12 +69,6 @@ public: virtual void EndElement(); -protected: - /// initialize DocumentProperties object with DOM and base URL - void initDocumentProperties(); - // set the BuildId property at the importer - void setBuildId(const ::rtl::OUString & i_rBuildId); - public: static void setBuildId(const ::rtl::OUString & rGenerator, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo ); diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 578b3eefc719..7b69609fafe9 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -30,15 +30,11 @@ #include -#ifndef _XMLOFF_XMLMETAI_HXX #include -#endif #include "sdxmlimp_impl.hxx" #include "ximpbody.hxx" -#ifndef _SFX_XMLMETAI_HXX #include -#endif #include "ximpstyl.hxx" #include "xmloff/xmlnmspe.hxx" #include @@ -447,6 +443,17 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen if( xInfoSetInfo->hasPropertyByName( msPreview ) ) xInfoSet->getPropertyValue( msPreview ) >>= mbPreview; + + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + if (xInfoSetInfo->hasPropertyByName(sOrganizerMode)) + { + sal_Bool bStyleOnly(sal_False); + if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly) + { + mbLoadDoc = !bStyleOnly; + } + } } } @@ -765,7 +772,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, { SvXMLImportContext* pContext = 0L; - if (!IsStylesOnlyMode() && (getImportFlags() & IMPORT_META)) + if (getImportFlags() & IMPORT_META) { uno::Reference xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( @@ -773,9 +780,11 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName, uno::UNO_QUERY_THROW); uno::Reference xDPS( GetModel(), uno::UNO_QUERY_THROW); + uno::Reference const xDocProps( + (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + xDocProps, xDocBuilder); } if(!pContext) diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index e2ba207e5cd6..9f5aebece935 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -124,6 +125,71 @@ void XMLDocumentBuilderContext::EndElement() //=========================================================================== +static void +lcl_initDocumentProperties(SvXMLImport & rImport, + uno::Reference const& xDocBuilder, + uno::Reference const& xDocProps) +{ + uno::Sequence< uno::Any > aSeq(1); + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + aSeq[0] <<= xDB->getDocument(); + uno::Reference< lang::XInitialization > const xInit(xDocProps, + uno::UNO_QUERY_THROW); + try { + xInit->initialize(aSeq); + rImport.SetStatistics(xDocProps->getDocumentStatistics()); + // convert all URLs from relative to absolute + xDocProps->setTemplateURL(rImport.GetAbsoluteReference( + xDocProps->getTemplateURL())); + xDocProps->setAutoloadURL(rImport.GetAbsoluteReference( + xDocProps->getAutoloadURL())); + SvXMLMetaDocumentContext::setBuildId( + xDocProps->getGenerator(), rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString::createFromAscii( + "SvXMLMetaDocumentContext::initDocumentProperties: " + "properties init exception"), + rImport, makeAny(e)); + } +} + +static void +lcl_initGenerator(SvXMLImport & rImport, + uno::Reference const& xDocBuilder) +{ + uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder, + uno::UNO_QUERY_THROW); + uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(), + uno::UNO_SET_THROW); + try { + uno::Reference< xml::xpath::XXPathAPI > const xPath( + rImport.getServiceFactory()->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.xml.xpath.XPathAPI"))), + uno::UNO_QUERY_THROW ); + xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); + xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); + + ::rtl::OUString const expr(RTL_CONSTASCII_USTRINGPARAM( + "string(/office:document-meta/office:meta/meta:generator)")); + uno::Reference< xml::xpath::XXPathObject > const xObj( + xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW); + OUString const value(xObj->getString()); + SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo()); + } catch (uno::RuntimeException) { + throw; + } catch (uno::Exception & e) { + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString::createFromAscii( + "SvXMLMetaDocumentContext::initGenerator: exception"), + rImport, makeAny(e)); + } +} + SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, const uno::Reference& xDocProps, @@ -132,8 +198,9 @@ SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport, mxDocProps(xDocProps), mxDocBuilder(xDocBuilder) { - DBG_ASSERT(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); - DBG_ASSERT(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); +// #i103539#: must always read meta.xml for generator, xDocProps unwanted then +// OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props"); + OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr"); // here are no attributes } @@ -166,6 +233,7 @@ void SvXMLMetaDocumentContext::StartElement( mxDocBuilder->startElement( GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META)), xAttrList); + } void SvXMLMetaDocumentContext::EndElement() @@ -175,43 +243,16 @@ void SvXMLMetaDocumentContext::EndElement() GetImport().GetNamespaceMap().GetQNameByKey(GetPrefix(), GetXMLToken(XML_DOCUMENT_META))); mxDocBuilder->endDocument(); - initDocumentProperties(); -} - -void SvXMLMetaDocumentContext::initDocumentProperties() -{ - uno::Sequence< uno::Any > aSeq(1); - uno::Reference< xml::dom::XSAXDocumentBuilder > xDB (mxDocBuilder, - uno::UNO_QUERY_THROW); - aSeq[0] <<= xDB->getDocument(); - uno::Reference< lang::XInitialization > xInit(mxDocProps, - uno::UNO_QUERY_THROW); - try { - xInit->initialize(aSeq); - GetImport().SetStatistics(mxDocProps->getDocumentStatistics()); - // convert all URLs from relative to absolute - mxDocProps->setTemplateURL(GetImport().GetAbsoluteReference( - mxDocProps->getTemplateURL())); - mxDocProps->setAutoloadURL(GetImport().GetAbsoluteReference( - mxDocProps->getAutoloadURL())); - setBuildId(mxDocProps->getGenerator()); - } catch (uno::RuntimeException) { - throw; - } catch (uno::Exception & e) { - throw lang::WrappedTargetRuntimeException( - ::rtl::OUString::createFromAscii( - "SvXMLMetaDocumentContext::initDocumentProperties: " - "properties init exception"), - GetImport(), makeAny(e)); + if (mxDocProps.is()) + { + lcl_initDocumentProperties(GetImport(), mxDocBuilder, mxDocProps); + } + else + { + lcl_initGenerator(GetImport(), mxDocBuilder); } } -void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId) -{ - SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() ); -} - -//static void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference& xImportInfo ) { OUString sBuildId; -- cgit From b5cffc10b0b21aa88bcd533bee65d020c6cc0eea Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:30 +0100 Subject: sw34bf04: #i103539#: always import meta.xml, to extract the BuildId: SvXMLMetaDocumentContext: refactor to not require DocumentProperties, and always set the BuildId from the meta:generator element. {Sc,Sd,Sw}XMLImport::CreateMetaContext(): always create context. sc, sd: add OrganizerMode property to ODF import. --- sd/source/filter/xml/sdxmlwrp.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 0ebc716e863b..53c95050ec8a 100755 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -513,6 +513,9 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError ) { MAP_LEN( "BuildId" ), 0, &::getCppuType( (OUString *)0 ), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, + { MAP_LEN( "OrganizerMode" ), 0, + &::getBooleanCppuType(), + ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; @@ -630,6 +633,13 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError ) } } + if (SDXMLMODE_Organizer == meFilterMode) + { + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + xInfoSet->setPropertyValue(sOrganizerMode, uno::makeAny(sal_True)); + } + // ------------------------------------- if( 0 == nRet ) @@ -655,13 +665,14 @@ sal_Bool SdXMLFilter::Import( ErrCode& nError ) sal_uInt32 nWarn = 0; sal_uInt32 nWarn2 = 0; // read storage streams + // #i103539#: always read meta.xml for generator + nWarn = ReadThroughComponent( + xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, + pServices->mpMeta, + aEmptyArgs, aName, sal_False ); + if( meFilterMode != SDXMLMODE_Organizer ) { - nWarn = ReadThroughComponent( - xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, - pServices->mpMeta, - aEmptyArgs, aName, sal_False ); - nWarn2 = ReadThroughComponent( xStorage, xModelComp, "settings.xml", NULL, xServiceFactory, pServices->mpSettings, -- cgit From 7213a870d89e7dd0c7d35ca443c37e08037c12c6 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:30 +0100 Subject: sw34bf04: #i103539#: always import meta.xml, to extract the BuildId: SvXMLMetaDocumentContext: refactor to not require DocumentProperties, and always set the BuildId from the meta:generator element. {Sc,Sd,Sw}XMLImport::CreateMetaContext(): always create context. sc, sd: add OrganizerMode property to ODF import. --- sc/source/filter/xml/xmlimprt.cxx | 23 +++++++++++++++++++++-- sc/source/filter/xml/xmlwrap.cxx | 36 ++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index d840c39f5939..c336226f4111 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1911,7 +1911,7 @@ SvXMLImportContext *ScXMLImport::CreateMetaContext( { SvXMLImportContext *pContext(0); - if( !IsStylesOnlyMode() && (getImportFlags() & IMPORT_META)) + if (getImportFlags() & IMPORT_META) { uno::Reference xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( @@ -1919,9 +1919,11 @@ SvXMLImportContext *ScXMLImport::CreateMetaContext( uno::UNO_QUERY_THROW); uno::Reference xDPS( GetModel(), uno::UNO_QUERY_THROW); + uno::Reference const xDocProps( + (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + xDocProps, xDocBuilder); } if( !pContext ) @@ -2635,6 +2637,23 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE } } + uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() ); + uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo( + xImportInfo.is() ? xImportInfo->getPropertySetInfo() : 0); + if (xPropertySetInfo.is()) + { + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + if (xPropertySetInfo->hasPropertyByName(sOrganizerMode)) + { + sal_Bool bStyleOnly(sal_False); + if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly) + { + bLoadDoc = !bStyleOnly; + } + } + } + UnlockSolarMutex(); } diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 9e721b7e9b1a..f3270ff12ade 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -429,6 +429,8 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError) { MAP_LEN( "BuildId" ), 0, &::getCppuType( (OUString *)0 ), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN( "VBACompatibilityMode" ), 0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN( "ScriptConfiguration" ), 0, &::getCppuType((uno::Reference *)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, + { MAP_LEN( "OrganizerMode" ), 0, &::getBooleanCppuType(), + ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; @@ -488,26 +490,32 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError) } } + if (bStylesOnly) + { + ::rtl::OUString const sOrganizerMode( + RTL_CONSTASCII_USTRINGPARAM("OrganizerMode")); + xInfoSet->setPropertyValue(sOrganizerMode, uno::makeAny(sal_True)); + } + sal_Bool bOasis = ( SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60 ); + // #i103539#: always read meta.xml for generator sal_uInt32 nMetaRetval(0); - if(!bStylesOnly) - { - uno::Sequence aMetaArgs(1); - uno::Any* pMetaArgs = aMetaArgs.getArray(); - pMetaArgs[0] <<= xInfoSet; + uno::Sequence aMetaArgs(1); + uno::Any* pMetaArgs = aMetaArgs.getArray(); + pMetaArgs[0] <<= xInfoSet; - RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import start" ); + RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import start" ); - nMetaRetval = ImportFromComponent(xServiceFactory, xModel, xXMLParser, aParserInput, - bOasis ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLOasisMetaImporter")) - : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLMetaImporter")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Meta.xml")), aMetaArgs, - sal_False); + nMetaRetval = ImportFromComponent( + xServiceFactory, xModel, xXMLParser, aParserInput, + bOasis ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLOasisMetaImporter")) + : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.XMLMetaImporter")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Meta.xml")), aMetaArgs, + sal_False); - RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import end" ); - } + RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta import end" ); SvXMLGraphicHelper* pGraphicHelper = NULL; uno::Reference< document::XGraphicObjectResolver > xGrfContainer; -- cgit From 165b83523e601d7a63bb8b7d04382f510df6381c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:31 +0100 Subject: sw34bf04: #i116631# #i108813#: SwAnnotationWin::UpdateData(): check undo enabled --- sw/source/ui/docvw/AnnotationWin.cxx | 44 ++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 4675805e527c..7419ee060e29 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -111,15 +111,23 @@ void SwAnnotationWin::UpdateData() { if ( Engine()->IsModified() ) { - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); // #i98686# if we have several views, all notes should update their text @@ -242,15 +250,23 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) // lets insert an undo step so the initial text can be easily deleted // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr Engine()->SetModifyHdl( Link() ); - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) ); Engine()->ClearModifyFlag(); Engine()->GetUndoManager().Clear(); -- cgit From f79a915100d50fbf24915596c671db545a7c1baf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 1 Mar 2011 16:05:31 +0100 Subject: sw34bf04: idxmrk.src: fix annoying warnings --- sw/source/ui/index/idxmrk.src | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src index 5bd78240e5c5..fb2680797c7e 100644 --- a/sw/source/ui/index/idxmrk.src +++ b/sw/source/ui/index/idxmrk.src @@ -287,6 +287,14 @@ ModalDialog DLG_EDIT_IDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_EDIT_IDXMARK_CJK { @@ -306,6 +314,14 @@ ModalDialog DLG_EDIT_IDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK { @@ -328,6 +344,14 @@ ModelessDialog DLG_INSIDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK_CJK { @@ -349,6 +373,14 @@ ModelessDialog DLG_INSIDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_NEW_USER_IDX { @@ -529,6 +561,7 @@ ModalDialog DLG_EDIT_AUTHMARK Size = MAP_APPFONT ( 218 , 118 ) ; #define RADIO_BUTTON_HEIGHT 0 AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModelessDialog DLG_INSAUTHMARK { @@ -543,6 +576,7 @@ ModelessDialog DLG_INSAUTHMARK Size = MAP_APPFONT ( 218 , 118 + RADIO_BUTTON_HEIGHT) ; // Moveable = TRUE ; AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModalDialog DLG_CREATE_AUTH_ENTRY { -- cgit From a6489cbf0f70ded24d790e5ec4657eec291ce737 Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Tue, 1 Mar 2011 17:20:00 +0100 Subject: #i117121# ambiguous nameing of SwAttrIter in ww8 --- sw/source/filter/ww8/wrtw8nds.cxx | 44 +++++++++++++++++++-------------------- sw/source/filter/ww8/wrtww8.hxx | 6 +++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 7f5e0eaae54e..8c52f2269a36 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -178,7 +178,7 @@ MSWordAttrIter::~MSWordAttrIter() // Mit OutAttr() werden die Attribute an der angegebenen SwPos // ausgegeben. -class SwAttrIter : public MSWordAttrIter +class WW8SwAttrIter : public MSWordAttrIter { private: const SwTxtNode& rNd; @@ -209,10 +209,10 @@ private: void IterToCurrent(); //No copying - SwAttrIter(const SwAttrIter&); - SwAttrIter& operator=(const SwAttrIter&); + WW8SwAttrIter(const WW8SwAttrIter&); + WW8SwAttrIter& operator=(const WW8SwAttrIter&); public: - SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd ); + WW8SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd ); bool IsTxtAttr( xub_StrLen nSwPos ); bool IsRedlineAtEnd( xub_StrLen nPos ) const; @@ -248,7 +248,7 @@ public: } }; -void SwAttrIter::IterToCurrent() +void WW8SwAttrIter::IterToCurrent() { ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible"); mnScript = maCharRunIter->mnScript; @@ -256,7 +256,7 @@ void SwAttrIter::IterToCurrent() mbCharIsRTL = maCharRunIter->mbRTL; } -SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : +WW8SwAttrIter::WW8SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : MSWordAttrIter(rWr), rNd(rTxtNd), maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.HackIsWW8OrHigher())), @@ -323,7 +323,7 @@ xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 ) return min; } -xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) +xub_StrLen WW8SwAttrIter::SearchNext( xub_StrLen nStartPos ) { xub_StrLen nPos; xub_StrLen nMinPos = STRING_MAXLEN; @@ -456,7 +456,7 @@ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos ) return nMinPos; } -void SwAttrIter::OutAttr( xub_StrLen nSwPos ) +void WW8SwAttrIter::OutAttr( xub_StrLen nSwPos ) { m_rExport.AttrOutput().RTLAndCJKState( IsCharRTL(), GetScript() ); @@ -582,7 +582,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos ) } } -void SwAttrIter::OutFlys(xub_StrLen nSwPos) +void WW8SwAttrIter::OutFlys(xub_StrLen nSwPos) { /* #i2916# @@ -604,7 +604,7 @@ void SwAttrIter::OutFlys(xub_StrLen nSwPos) } } -bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) +bool WW8SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) { // search for attrs with CH_TXTATR if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints()) @@ -620,7 +620,7 @@ bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos ) return false; } -bool SwAttrIter::IsDropCap( int nSwPos ) +bool WW8SwAttrIter::IsDropCap( int nSwPos ) { // see if the current position falls on a DropCap int nDropChars = mrSwFmtDrop.GetChars(); @@ -639,7 +639,7 @@ bool SwAttrIter::IsDropCap( int nSwPos ) return false; } -bool SwAttrIter::RequiresImplicitBookmark() +bool WW8SwAttrIter::RequiresImplicitBookmark() { SwImplBookmarksIter bkmkIterEnd = m_rExport.maImplicitBookmarks.end(); for ( SwImplBookmarksIter aIter = m_rExport.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter ) @@ -658,7 +658,7 @@ bool SwAttrIter::RequiresImplicitBookmark() // Attribut-Anfangposition fragen kann. // Es koennen nur Attribute mit Ende abgefragt werden. // Es wird mit bDeep gesucht -const SfxPoolItem* SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const +const SfxPoolItem* WW8SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const { const SfxPoolItem* pRet = 0; const SwpHints* pTxtAttrs = rNd.GetpSwpHints(); @@ -691,7 +691,7 @@ void WW8Export::GetCurrentItems(WW8Bytes& rItems) const rItems.Insert((*pO)[nI], rItems.Count()); } -const SfxPoolItem& SwAttrIter::GetItem(sal_uInt16 nWhich) const +const SfxPoolItem& WW8SwAttrIter::GetItem(sal_uInt16 nWhich) const { const SfxPoolItem* pRet = HasTextItem(nWhich); return pRet ? *pRet : rNd.SwCntntNode::GetAttr(nWhich); @@ -1072,7 +1072,7 @@ String BookmarkToWriter(const String &rBookmark) INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_ASCII_US); } -void SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool) +void WW8SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool) { if ( m_rExport.HasRefToObject( REF_SETREFATTR, &rAttr.GetRefName(), 0 ) ) m_rExport.AppendBookmark( m_rExport.GetBookmarkName( REF_SETREFATTR, @@ -1172,7 +1172,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt FieldVanish( sTxt, eType ); } -int SwAttrIter::OutAttrWithRange(xub_StrLen nPos) +int WW8SwAttrIter::OutAttrWithRange(xub_StrLen nPos) { int nRet = 0; if ( const SwpHints* pTxtAttrs = rNd.GetpSwpHints() ) @@ -1233,7 +1233,7 @@ int SwAttrIter::OutAttrWithRange(xub_StrLen nPos) return nRet; } -bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const +bool WW8SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const { bool bRet = false; // search next Redline @@ -1255,7 +1255,7 @@ bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const return bRet; } -const SwRedlineData* SwAttrIter::GetRedline( xub_StrLen nPos ) +const SwRedlineData* WW8SwAttrIter::GetRedline( xub_StrLen nPos ) { if( pCurRedline ) { @@ -1450,7 +1450,7 @@ Convert characters that need to be converted, the basic replacements and the ridicously complicated title case attribute mapping to hardcoded upper case because word doesn't have the feature */ -String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, +String WW8SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos, xub_StrLen nLen) const { String aSnippet(rStr, nAktPos, nLen); @@ -1646,7 +1646,7 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); } -xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) +xub_StrLen MSWordExportBase::GetNextPos( WW8SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) { // Get the bookmarks for the normal run xub_StrLen nNextPos = aAttrIter->WhereNext(); @@ -1659,7 +1659,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& return std::min( nNextPos, nNextBookmark ); } -void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ ) +void MSWordExportBase::UpdatePosition( WW8SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ ) { xub_StrLen nNextPos; @@ -1797,7 +1797,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) // have to remember it in nStyle sal_uInt16 nStyle = nStyleBeforeFly; - SwAttrIter aAttrIter( *this, rNode ); + WW8SwAttrIter aAttrIter( *this, rNode ); rtl_TextEncoding eChrSet = aAttrIter.GetCharSet(); if ( bStartTOX ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 6350fb9f5512..a6b2eef0f079 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -58,7 +58,7 @@ namespace msfilter class MSCodec_Std97; } -class SwAttrIter; +class WW8SwAttrIter; class AttributeOutputBase; class DocxAttributeOutput; class RtfAttributeOutput; @@ -751,10 +751,10 @@ protected: virtual void ExportDocument_Impl() = 0; /// Get the next position in the text node to output - virtual xub_StrLen GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ); + virtual xub_StrLen GetNextPos( WW8SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ); /// Update the information for GetNextPos(). - virtual void UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ); + virtual void UpdatePosition( WW8SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ); /// Output SwTxtNode void OutputTextNode( const SwTxtNode& ); -- cgit From 723f772da09f872d91fd53d4fef0ca3bdd191205 Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Tue, 1 Mar 2011 17:35:02 +0100 Subject: #i106749: use FindPageDesc to get the current page description --- sw/source/filter/ww8/ww8atr.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 4e865bc0ca83..6b174aeaf489 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -439,10 +439,20 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode //section. bool bBreakSet = false; + const SwPageDesc * pPageDesc = rNd.FindPageDesc(sal_False); + + if (pAktPageDesc != pPageDesc) + { + bBreakSet = true; + bNewPageDesc = true; + pAktPageDesc = pPageDesc; + } + if ( pSet && pSet->Count() ) { - if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) - && ( (SwFmtPageDesc*)pItem )->GetRegisteredIn() ) + bool bGotItem = + if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) && + dynamic_cast(pItem)->GetRegisteredIn() != NULL) { bBreakSet = true; bNewPageDesc = true; -- cgit From d00e976916957c6a989a8be5cee5f0f1a3a2a4ad Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Wed, 2 Mar 2011 13:09:39 +0100 Subject: #i106749#: Removed some slipped line. --- sw/source/filter/ww8/ww8atr.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 6b174aeaf489..4a8fab5d0f79 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -450,7 +450,6 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode if ( pSet && pSet->Count() ) { - bool bGotItem = if ( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) && dynamic_cast(pItem)->GetRegisteredIn() != NULL) { -- cgit From 4a380b265d90ce63a2dd9184d7bc5fc7df95f2f4 Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Thu, 3 Mar 2011 14:51:57 +0100 Subject: sw34bf04: #i114533# handle SDT --- writerfilter/source/ooxml/dummyannotate.xsl | 2 +- writerfilter/source/ooxml/model.xml | 54 +++++++++++++++++++++++++++-- writerfilter/source/ooxml/modelcleanup.xsl | 19 ++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/writerfilter/source/ooxml/dummyannotate.xsl b/writerfilter/source/ooxml/dummyannotate.xsl index 0fcc1e0dcbc7..d457d0c0745b 100644 --- a/writerfilter/source/ooxml/dummyannotate.xsl +++ b/writerfilter/source/ooxml/dummyannotate.xsl @@ -838,7 +838,7 @@ sed "s/wml/ - diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 49998622e65d..be239665b54a 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -21113,7 +21113,7 @@ - + @@ -21642,6 +21642,7 @@ bestFit textFit + @@ -22552,7 +22553,56 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writerfilter/source/ooxml/modelcleanup.xsl b/writerfilter/source/ooxml/modelcleanup.xsl index d7a9aec40100..69e73d868c2d 100644 --- a/writerfilter/source/ooxml/modelcleanup.xsl +++ b/writerfilter/source/ooxml/modelcleanup.xsl @@ -40,6 +40,9 @@ + + @@ -52,6 +55,11 @@ yes + + + + + @@ -66,6 +74,11 @@ List yes + + + + + @@ -148,12 +161,18 @@ + Value yes + + + + + -- cgit From 1a8d219421ff26bc88c6aef1a4de4da1b8ceddb2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 3 Mar 2011 15:08:48 +0100 Subject: sw34bf04: #i117122#: inputwin.cxx: fix undoapi regression --- sw/source/ui/ribbar/inputwin.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index fe148ff04841..31149813643b 100755 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -165,6 +165,7 @@ void SwInputWindow::CleanupUglyHackWithUndo() { SW_MOD()->GetUndoOptions().SetUndoCount(0); } + m_bResetUndo = false; // #i117122# once is enough :) } } -- cgit From c675825931f67aad69e665c2802f87acf65dbb10 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 3 Mar 2011 15:08:48 +0100 Subject: sw34bf04: #i117193#: RemovePresentAttrs::operator(): fix crash; also fix comparison in lcl_CollectHintSpans (in case of multiple hints with same position) --- sw/source/core/txtnode/thints.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index d0be32e61953..f67398d182ee 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -2100,7 +2100,7 @@ struct RemovePresentAttrs const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second); SfxItemIter aIter(m_rAttrSet); const SfxPoolItem* pItem(aIter.GetCurItem()); - while (true) + while (pItem) { const sal_uInt16 nWhich(pItem->Which()); if (CharFmt::IsItemIncluded(nWhich, pAutoStyle)) @@ -2142,7 +2142,8 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_uInt16 nLength, const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd()); o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint)); - if (aSpan.first != nLastEnd) + // < not != because there may be multiple CHARFMT at same range + if (nLastEnd < aSpan.first) { // insert dummy span covering the gap o_rSpanMap.insert(AttrSpanMap_t::value_type( -- cgit From 850ac2446efbbf5a236c3109af45d804d6a984d3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 3 Mar 2011 15:08:48 +0100 Subject: sw34bf04: #i89751#: SwDoc::ResetAttrs: fix autoformat regression: replace old and broken para attr to hint conversion with call to FmtToTxtAttr --- sw/source/core/doc/docfmt.cxx | 70 ++++++++----------------------------------- 1 file changed, 12 insertions(+), 58 deletions(-) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 1154fbf61d88..db106fa23f39 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -493,45 +493,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode(); if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() ) { - SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); - - while( sal_True ) + if (pHst) { - if( IsInRange( aCharFmtSetRange, pItem->Which() )) - { - pTNd->GetOrCreateSwpHints(); - - aCharSet.Put( *pItem ); - - if( pHst ) - { - SwRegHistory aRegH( pTNd, *pTNd, pHst ); - pTNd->ResetAttr( pItem->Which() ); - } - else - pTNd->ResetAttr( pItem->Which() ); - } - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); + SwRegHistory history(pTNd, *pTNd, pHst); + pTNd->FmtToTxtAttr(pTNd); } - - if ( aCharSet.Count() ) + else { - if ( pHst ) - { - SwRegHistory history( pTNd, *pTNd, pHst ); - history.InsertItems( aCharSet, 0, pTNd->GetTxt().Len(), - nsSetAttrMode::SETATTR_NOFORMATATTR ); - } - else - { - SwTxtAttr* pNew = - MakeTxtAttr( *this, aCharSet, 0, pTNd->GetTxt().Len() ); - pTNd->InsertHint( pNew ); - } + pTNd->FmtToTxtAttr(pTNd); } } @@ -545,29 +514,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode(); if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() ) { - SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - while( sal_True ) + if (pHst) { - if( IsInRange( aCharFmtSetRange, pItem->Which() )) - { - SwTxtAttr* pTAttr = MakeTxtAttr( *this, - const_cast(*pItem), - 0, pTNd->GetTxt().Len() ); - SwpHints & rHints = pTNd->GetOrCreateSwpHints(); - rHints.SwpHintsArray::Insert( pTAttr ); - if ( pHst ) - { - SwRegHistory aRegH( pTNd, *pTNd, pHst ); - pTNd->ResetAttr( pItem->Which() ); - pHst->Add( pTAttr, aTmpEnd.GetIndex(), true ); - } - else - pTNd->ResetAttr( pItem->Which() ); - } - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); + SwRegHistory history(pTNd, *pTNd, pHst); + pTNd->FmtToTxtAttr(pTNd); + } + else + { + pTNd->FmtToTxtAttr(pTNd); } } } -- cgit From 4071c0b8c087568d390e5cee5db4ef7574d6c6da Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Fri, 4 Mar 2011 13:00:54 +0100 Subject: sw34bf04: #i104017#: there are 63 cells possible in a row --- sw/source/filter/ww8/WW8TableInfo.cxx | 8 ++++---- sw/source/filter/ww8/wrtww8.cxx | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 28180f598f6e..d10ff5d6d81f 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -251,8 +251,8 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() pWidths = WidthsPtr(new Widths); // number of cell written sal_uInt32 nBoxes = rTabBoxes.Count(); - if ( nBoxes > 32 ) - nBoxes = 32; + if ( nBoxes > 63 ) + nBoxes = 63; for (sal_uInt32 n = 0; n < nBoxes; n++) { @@ -282,8 +282,8 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); sal_uInt32 nBoxes = rTabBoxes.Count(); - if (nBoxes > 32) - nBoxes = 32; + if (nBoxes > 63) + nBoxes = 63; for (sal_uInt32 n = 0; n < nBoxes; ++n) { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c40ce759b3f2..163d86e55416 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2166,6 +2166,8 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner->getTableBoxesOfRow(); // number of cell written sal_uInt32 nBoxes = pTableBoxes->size(); + if (nBoxes > 63) + nBoxes = 63; // sprm header m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable ); -- cgit From af2a07dd79e89ae9459670ccbb3eeac16dfbb4fc Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Mon, 7 Mar 2011 10:12:50 +0100 Subject: sw34bf04: #i104017#: use MAXTABLECELLS to define maximum number of cells in a table row --- sw/source/filter/ww8/WW8TableInfo.cxx | 8 ++++---- sw/source/filter/ww8/WW8TableInfo.hxx | 2 ++ sw/source/filter/ww8/wrtww8.cxx | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index d10ff5d6d81f..b09bcb8df5cc 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -251,8 +251,8 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() pWidths = WidthsPtr(new Widths); // number of cell written sal_uInt32 nBoxes = rTabBoxes.Count(); - if ( nBoxes > 63 ) - nBoxes = 63; + if ( nBoxes > MAXTABLECELLS ) + nBoxes = MAXTABLECELLS; for (sal_uInt32 n = 0; n < nBoxes; n++) { @@ -282,8 +282,8 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); sal_uInt32 nBoxes = rTabBoxes.Count(); - if (nBoxes > 63) - nBoxes = 63; + if (nBoxes > MAXTABLECELLS) + nBoxes = MAXTABLECELLS; for (sal_uInt32 n = 0; n < nBoxes; ++n) { diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index b844615fecad..b00d0a7ae481 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -46,6 +46,8 @@ namespace ww8 { using namespace ::std; +const unsigned int MAXTABLECELLS = 63; + class WW8TableNodeInfo; typedef boost::shared_ptr SwRectPtr; typedef ::std::vector TableBoxVector; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 163d86e55416..b4724b68fb40 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2166,8 +2166,8 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner->getTableBoxesOfRow(); // number of cell written sal_uInt32 nBoxes = pTableBoxes->size(); - if (nBoxes > 63) - nBoxes = 63; + if (nBoxes > ww8::MAXTABLECELLS) + nBoxes = ww8::MAXTABLECELLS; // sprm header m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable ); -- cgit From c06f108e872871ea68188f72984dee690453ef96 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 7 Mar 2011 13:14:33 +0100 Subject: dr78: fix broken d.lst --- oox/prj/d.lst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oox/prj/d.lst b/oox/prj/d.lst index 69ff66b95bc5..8b27a19638de 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -19,9 +19,10 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\inc\oox\token\tokens.hxx %_DEST%\inc%_EXT%\oox\token\tokens.hxx -..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt +..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\token\namespaces.txt + +..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token\tokens.txt -..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt ..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h ..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx ..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx -- cgit From 7c765b91c9194aea22b244f6fad6af4cc1531b24 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Tue, 8 Mar 2011 11:52:31 +0100 Subject: cws dba34c: add new test for mysql connector --- .../dbaccess/optional/dba_db_MySQLnative.bas | 54 ++++++ .../dbaccess/optional/includes/db_MySQLnative.inc | 206 +++++++++++++++++++++ .../dbaccess/optional/includes/db_Query.inc | 1 + .../optional/includes/wiz_ReportWizard.inc | 41 ++-- testautomation/dbaccess/tools/dbcreatetools.inc | 98 ++++++++++ testautomation/dbaccess/tools/dbtools.inc | 17 ++ testautomation/global/win/edia_d_h.win | 1 + 7 files changed, 397 insertions(+), 21 deletions(-) create mode 100644 testautomation/dbaccess/optional/dba_db_MySQLnative.bas create mode 100644 testautomation/dbaccess/optional/includes/db_MySQLnative.inc diff --git a/testautomation/dbaccess/optional/dba_db_MySQLnative.bas b/testautomation/dbaccess/optional/dba_db_MySQLnative.bas new file mode 100644 index 000000000000..adb2e7987032 --- /dev/null +++ b/testautomation/dbaccess/optional/dba_db_MySQLnative.bas @@ -0,0 +1,54 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' 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 +' +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : marc.neumann@oracle.com +'* +'* short description : MySQL Native Connector Extension Test +'* +'\*********************************************************************** +sub main + printlog "--------------------------------------------------------------" + printlog "--- D B A C C E S S Mysql Native Connector ---" + printlog "--------------------------------------------------------------" + + use "dbaccess/optional/includes/db_MySQLnative.inc" + use "dbaccess/optional/includes/db_Relations.inc" + + call hStatusIn ("dbaccess" , "dba_db_MySQLnative.bas") + + call db_MySQLnative + + call hStatusOut + +end sub + +sub LoadIncludeFiles + use "dbaccess/tools/dbinit.inc" + Call sDBInit + Call GetUseFiles + gApplication = "WRITER" +end sub diff --git a/testautomation/dbaccess/optional/includes/db_MySQLnative.inc b/testautomation/dbaccess/optional/includes/db_MySQLnative.inc new file mode 100644 index 000000000000..de80287bec27 --- /dev/null +++ b/testautomation/dbaccess/optional/includes/db_MySQLnative.inc @@ -0,0 +1,206 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' 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 +' +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : marc.neumann@oracle.com +'* +'* short description : Create JDBC MySQL DS & Table & fill in Test +'* +'\*********************************************************************** +testcase db_MySQLnative + + ' ************************************************** + ' databases specific settings for JDBC MySQL + ' ************************************************** + + dim sDBConfigFile as string + + sDBConfigFile = environ ( "VTT_DB_CONFIG_FILE" ) + + printlog sDBConfigFile + + if (sDBConfigFile = "") then + qaerrorlog "settings for external databases not found. see wiki page. This test ist stopped now" + goto endsub + else + if Dir( sDBConfigFile ) = "" then ' the file does not exists + qaerrorlog "settings for external databases not found. see wiki page. This test ist stopped now" + else + ' file exists , so we can do th next step + endif + + endif + + + + Dim sFileName as string + sFileName = gOfficePath + Convertpath("user/work/TT_MYSQLnative.odb") + + Dim sTableName as string + sTableName = "tt_test_create-table" + + Dim sUser as string + sUser = "testtool" + + Dim sPWD as string + sPWD = "testtool" + + dim sCatalog as string + sCatalog = " " ' not used in this ds + + dim sSchema as string + sSchema = " " ' not used in this ds + + Dim aFieldTypeContent(30,2) as string 'database specific data matrix + + aFieldTypeContent(1,1)="tt_bool" + aFieldTypeContent(1,2)="bool" + + aFieldTypeContent(2,1)="tt_tinyint" + aFieldTypeContent(2,2)="tinyint" + + aFieldTypeContent(3,1)="tt_bigint" + aFieldTypeContent(3,2)="bigint" + + aFieldTypeContent(4,1)="tt_long_varbinary" + aFieldTypeContent(4,2)="long varbinary" + + aFieldTypeContent(5,1)="tt_mediumblob" + aFieldTypeContent(5,2)="mediumblob" + + aFieldTypeContent(6,1)="tt_longblob" + aFieldTypeContent(6,2)="longblob" + + aFieldTypeContent(7,1)="tt_blob" + aFieldTypeContent(7,2)="blob" + + aFieldTypeContent(8,1)="tt_tinyblob" + aFieldTypeContent(8,2)="tinyblob" + + aFieldTypeContent(9,1)="tt_varbinary" + aFieldTypeContent(9,2)="varbinary" + + aFieldTypeContent(10,1)="tt_binary" + aFieldTypeContent(10,2)="binary" + + aFieldTypeContent(11,1)="tt_longvarchar" + aFieldTypeContent(11,2)="long varchar" + + aFieldTypeContent(12,1)="tt_mediumtext" + aFieldTypeContent(12,2)="mediumtext" + + aFieldTypeContent(13,1)="tt_longtext" + aFieldTypeContent(13,2)="longtext" + + aFieldTypeContent(14,1)="tt_text" + aFieldTypeContent(14,2)="text" + + aFieldTypeContent(15,1)="tt_tinytext" + aFieldTypeContent(15,2)="tinytext" + + aFieldTypeContent(16,1)="tt_char" + aFieldTypeContent(16,2)="char" + + aFieldTypeContent(17,1)="tt_numeric" + aFieldTypeContent(17,2)="numeric" + + aFieldTypeContent(18,1)="tt_decimal" + aFieldTypeContent(18,2)="decimal" + + aFieldTypeContent(19,1)="tt_integer" + aFieldTypeContent(19,2)="integer" + + aFieldTypeContent(20,1)="tt_int" + aFieldTypeContent(20,2)="int" + + aFieldTypeContent(21,1)="tt_mediumint" + aFieldTypeContent(21,2)="mediumint" + + aFieldTypeContent(22,1)="tt_smallint" + aFieldTypeContent(22,2)="smallint" + + aFieldTypeContent(23,1)="tt_float" + aFieldTypeContent(23,2)="float" + + aFieldTypeContent(24,1)="tt_varchar" + aFieldTypeContent(24,2)="varchar" + + aFieldTypeContent(25,1)="tt_date" + aFieldTypeContent(25,2)="date" + + aFieldTypeContent(26,1)="tt_time" + aFieldTypeContent(26,2)="time" + + aFieldTypeContent(27,1)="tt_datetime" + aFieldTypeContent(27,2)="datetime" + + aFieldTypeContent(28,1)="tt_timestamp" + aFieldTypeContent(28,2)="timestamp" + + aFieldTypeContent(29,1)="tt_bit" + aFieldTypeContent(29,2)="bit" + + + + Dim aFieldContent(1,6) as string 'database specific data matrix + + aFieldContent(1,1)="1" + aFieldContent(1,2)="" + aFieldContent(1,3)="1" + aFieldContent(1,4)="1" + aFieldContent(1,5)="1" + aFieldContent(1,6)="1" + + dim aDatabaseProperties(7) as string + aDatabaseProperties() = tools_dbtools_fgetMySQLnativeDatabaseProperties(sDBConfigFile) + + dim dbok as boolean + dbok = false + + ' if and only if no properties are defined in the environment file the test is stopped + if(aDatabaseProperties(1) = "no") then + qaerrorlog "No database properties from Mysql defiened. The Test is stopped here." + goto endsub + endif + + dbok = fCreateMySQL_native_Datasource(sFileName,aDatabaseProperties(3),aDatabaseProperties(2),aDatabaseProperties(4),aDatabaseProperties(5)) + if dbok = true then + call fOpendatabase(sFileName,aDatabaseProperties(6)) + call fCreateTable( aFieldTypeContent(), sTableName) + call fInsertIntoTable( aFieldContent(), sTableName) + call fCloseDatabase + + use "dbaccess/optional/includes/db_Query.inc" + call db_Query(sFileName,"MYSQL_JDBC",aDatabaseProperties(6)) + + call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" ) + + else + warnlog "Data Source could not be created - beyond testcases stopped" + endif + +endcase + diff --git a/testautomation/dbaccess/optional/includes/db_Query.inc b/testautomation/dbaccess/optional/includes/db_Query.inc index b9d88142698f..798bc55b2118 100644 --- a/testautomation/dbaccess/optional/includes/db_Query.inc +++ b/testautomation/dbaccess/optional/includes/db_Query.inc @@ -47,6 +47,7 @@ function db_Query( sFileName , optional sType , optional sPassword) case "HSQLDB" sType = "2" case "MYSQL_JDBC" + case "MYSQL_NATIVE" sType = "3" case else sType = "1" diff --git a/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc b/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc index 67010e64fbfb..8743feae997b 100644 --- a/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc +++ b/testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc @@ -38,8 +38,8 @@ end sub '------------------------------------------------------------------------- testcase tNewReport - qaerrorlog "#i92543# crash when closing report" - goto endsub + ' qaerrorlog "#i92543# crash when closing report" + ' goto endsub call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb")) @@ -85,34 +85,33 @@ testcase tNewReport FinishBtn.Click sleep(10) - Kontext "DocumentWriter" + Kontext "DocumentWriter" DocumentWriter.TypeKeys "" , true ' EDIT / SELECT TEXT - DocumentWriter.TypeKeys "" ,2, true - DocumentWriter.TypeKeys "" , true + DocumentWriter.TypeKeys "" , true + DocumentWriter.TypeKeys "" , true DocumentWriter.TypeKeys "" , true - dim s as String - s = getClipboard + dim s as String + s = getClipboard - if left(s,10) = "Identifier" then - printlog "Report Table Header contains " + left(s,10) + ". -> OK" + if s = "Identifier" then + printlog "Report Table Header contains " + s + ". -> OK" else - warnlog "Report Table Header contains " + left(s,10) + " instead of IDENTIFIER" + warnlog "Report Table Header contains " + s + " instead of IDENTIFIER" endif - 'for windows a "new Line" are two characters - 'so I need to start at char 13 and not on 12 - dim iFromCharacter as integer - if gPlatGroup = "w95" then - iFromCharacter = 13 - else - iFromCharacter = 12 - endif + ' select next line and check content + Kontext "DocumentWriter" + DocumentWriter.TypeKeys "" , true + DocumentWriter.TypeKeys "" , true + DocumentWriter.TypeKeys "" , true + + s = getClipboard - if mid(s,iFromCharacter,5) = "GUR00" OR mid(s,iFromCharacter,5) = "BOR04" then - printlog "1. record is " + mid(s,iFromCharacter,5) + ". -> OK" + if s = "GUR00" OR s = "BOR04" then + printlog "1. record is " + s + ". -> OK" else - warnlog "1. record is " + mid(s,iFromCharacter,5) + " instead of GUR00 OR BOR04" + warnlog "1. record is " + s + " instead of GUR00 OR BOR04" endif call fCloseForm ' should be changed to a CloseReport diff --git a/testautomation/dbaccess/tools/dbcreatetools.inc b/testautomation/dbaccess/tools/dbcreatetools.inc index 034b1d18fef1..222ec470ca89 100644 --- a/testautomation/dbaccess/tools/dbcreatetools.inc +++ b/testautomation/dbaccess/tools/dbcreatetools.inc @@ -236,6 +236,104 @@ function fCreateMySQL_JDBC_Datasource(sFileName,sDatabaseName,sHost,sPort,sUser, call fCloseDatabase(true) +end function +'------------------------------------------------------------------------- +function fCreateMySQL_native_Datasource(sFileName,sDatabaseName,sHost,sPort,sUser,optional sRegister) as boolean + '/// create a new MySQL database via JDBC file with the given filename + '///+ and the given URL + '/// parameter: + '/// sFielName: the file name for the database file + '/// sDatabaseName: the name of the mysql database + '/// sHost: the host where the mysql database is running + '/// sPort: the port where the mysql database is running + '/// sUser: the user for the connection + '/// optional sRegister: the name under which the database is be registered + dim bOK as boolean + bOK = FALSE + + dim sEntry as string + + ' delete the file + if ( app.Dir( ConvertPath(sFileName) ) ) <> "" then + app.kill(ConvertPath(sFileName)) + endif + + Kontext "DocumentWriter" + if (DocumentWriter.exists(1)) then + DocumentWriter.UseMenu + else + Kontext "DocumentBackground" + DocumentBackground.UseMenu + endif + hMenuSelectNr(1) + hMenuSelectNr(1) + hMenuSelectNr(5) + + sleep(4) + + Kontext "DatabaseWizard" + ConnectToDatabase.Check + sleep(1) + sEntry = hGetDatabaseDisplayName( "sdbc:mysqlc:*" ) + 'cut off the (JDBC) string + sEntry = Left( sEntry , Instr(sEntry,"(") - 2 ) + printlog "entry = " + sEntry + DatabaseType.select( sEntry ) + sleep(1) + NextBtn.Click + sleep(1) + MySQLnative.Check + NextBtn.Click + sleep(1) + DatabaseWizard.typeKeys("",true) + DatabaseWizard.typeKeys(sDatabaseName,true) + DatabaseWizard.typeKeys("",true) + DatabaseWizard.typeKeys("",true) + DatabaseWizard.typeKeys(sHost,true) + 'MySQLDatabaseName.setText(sDatabaseName) + 'MySQLHostName.setText(sHost) + 'MySQLPort.setText(sPort) + + NextBtn.Click + sleep(1) + + '/// add the user name + printlog "add the user name" + UserName.setText sUser + + '/// check the password required checkbox + printlog "check the password required checkbox" + PasswordRequired.Check + + NextBtn.Click + FinishBtn.Click + + Kontext "SpeichernDlg" + Dateiname.setText ConvertPath(sFileName) + Speichern.click + + sleep(5) + + if ( IsMissing(sRegister) ) then + printlog "don't register datasource" + else + printlog "register datasource with name " + sRegister + call fRegisterDatabaseFile(ConvertPath(sFilename),sRegister) + end if + + bOK = true + if bOK = true then + printlog "--- End of function - *** Succeed ***" + else + warnlog "--- End of function - *** Failed *** Data source was not created" + endif + + fCreateMySQL_native_Datasource = bOK + + sleep(1) + + call fCloseDatabase(true) + end function '------------------------------------------------------------------------- function fCreateAdabasDatasource(sFileName,sURL,sUser, optional sRegister) as boolean diff --git a/testautomation/dbaccess/tools/dbtools.inc b/testautomation/dbaccess/tools/dbtools.inc index 2e40a3f25726..f36438b46318 100644 --- a/testautomation/dbaccess/tools/dbtools.inc +++ b/testautomation/dbaccess/tools/dbtools.inc @@ -317,6 +317,23 @@ function tools_dbtools_fgetMySQLODBCDatabaseProperties() tools_dbtools_fgetMySQLODBCDatabaseProperties = b() +end function +'------------------------------------------------------------------------- +function tools_dbtools_fgetMySQLnativeDatabaseProperties(sDBConfigFileName as string) + '/// return the databaseserver properties from the environment directory + '/// parameter: + '///
+ '/// return: + '/// the properties as an array + '/// entry 1 defined (yes or no) + '/// entry 2 server name + '/// entry 3 database name + '/// entry 4 database port + '/// entry 5 database user name + '/// entry 6 database user password + + tools_dbtools_fgetMySQLnativeDatabaseProperties = fgetGenericDatabaseProperties( sDBConfigFileName, "mysql_native" ) + end function '------------------------------------------------------------------------- function tools_dbtools_fgetAdabasDatabaseProperties() diff --git a/testautomation/global/win/edia_d_h.win b/testautomation/global/win/edia_d_h.win index 0448fccc9f02..ab411b541d26 100755 --- a/testautomation/global/win/edia_d_h.win +++ b/testautomation/global/win/edia_d_h.win @@ -47,6 +47,7 @@ UserName sym:DBACCESS_HID_PAGE_DBWIZARD_AUTHENTIFICATION_ET_GENERALUS AdabasBrowse sym:DBACCESS_HID_PAGE_DBWIZARD_ADABAS_PB_ADABASNAME MySQLODBC sym:DBACCESS_HID_PAGE_DBWIZARD_MYSQL_RB_CONNECTVIAODBC MySQLJDBC sym:DBACCESS_HID_PAGE_DBWIZARD_MYSQL_RB_CONNECTVIAJDBC +MySQLnative sym:dbaccess:RadioButton:PAGE_DBWIZARD_MYSQL_INTRO:RB_CONNECTVIANATIVE MySQLDatabaseName sym:DBACCESS_HID_PAGE_DBWIZARD_JDBC_ET_MYSQLDBNAME MySQLODBCDSName sym:DBACCESS_HID_PAGE_DBWIZARD_ODBC_ET_NAMEOFODBCDATASOURCE MySQLHostName sym:DBACCESS_HID_PAGE_DBWIZARD_JDBC_ET_MYSQLHOSTSERVER -- cgit From 17e137d01ec9863cb99b70d7351bb5adcd66fe3b Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Wed, 9 Mar 2011 12:43:03 +0100 Subject: sw34bf04: #i46648#: define class for NfKeywordTable * * * #i46648#: Use specific NfKeywordTabl --- sw/source/filter/ww8/wrtww8.cxx | 35 ++++++++++++++++++++++++++++++++--- sw/source/filter/ww8/wrtww8.hxx | 4 +++- sw/source/filter/ww8/ww8atr.cxx | 16 +++++----------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b4724b68fb40..ad568bc3c0f8 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3385,7 +3385,7 @@ sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ) : aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0), - pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0), + pBmpPal(0), pOLEExp(0), pOCXExp(0), pOleMap(0), mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0), mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pStyles( NULL ), @@ -3400,8 +3400,6 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM MSWordExportBase::~MSWordExportBase() { delete pBmpPal; - if (pKeyMap) - delete[] (NfKeywordTable*)pKeyMap; delete pOLEExp; delete pOCXExp; delete pOleMap; @@ -3885,4 +3883,35 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) #endif } +const NfKeywordTable & MSWordExportBase::GetNfKeywordTable() +{ + if (pKeyMap.get() == NULL) + { + pKeyMap.reset(new NfKeywordTable); + NfKeywordTable & rKeywordTable = *pKeyMap; + rKeywordTable[NF_KEY_D] = ::rtl::OUString::createFromAscii("d"); + rKeywordTable[NF_KEY_DD] = ::rtl::OUString::createFromAscii("dd"); + rKeywordTable[NF_KEY_DDD] = ::rtl::OUString::createFromAscii("ddd"); + rKeywordTable[NF_KEY_DDDD] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_M] = ::rtl::OUString::createFromAscii("M"); + rKeywordTable[NF_KEY_MM] = ::rtl::OUString::createFromAscii("MM"); + rKeywordTable[NF_KEY_MMM] = ::rtl::OUString::createFromAscii("MMM"); + rKeywordTable[NF_KEY_MMMM] = ::rtl::OUString::createFromAscii("MMMM"); + rKeywordTable[NF_KEY_NN] = ::rtl::OUString::createFromAscii("ddd"); + rKeywordTable[NF_KEY_NNN] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_NNNN] = ::rtl::OUString::createFromAscii("dddd"); + rKeywordTable[NF_KEY_YY] = ::rtl::OUString::createFromAscii("yy"); + rKeywordTable[NF_KEY_YYYY] = ::rtl::OUString::createFromAscii("yyyy"); + rKeywordTable[NF_KEY_H] = ::rtl::OUString::createFromAscii("H"); + rKeywordTable[NF_KEY_HH] = ::rtl::OUString::createFromAscii("HH"); + rKeywordTable[NF_KEY_MI] = ::rtl::OUString::createFromAscii("m"); + rKeywordTable[NF_KEY_MMI] = ::rtl::OUString::createFromAscii("mm"); + rKeywordTable[NF_KEY_S] = ::rtl::OUString::createFromAscii("s"); + rKeywordTable[NF_KEY_SS] = ::rtl::OUString::createFromAscii("ss"); + rKeywordTable[NF_KEY_AMPM] = ::rtl::OUString::createFromAscii("AM/PM"); + } + + return *pKeyMap; +} + /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index a6b2eef0f079..ed8fcf644302 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -472,7 +472,7 @@ public: WW8_WrtBookmarks* pBkmks; WW8_WrtRedlineAuthor* pRedlAuthors; BitmapPalette* pBmpPal; - void* pKeyMap; + boost::shared_ptr pKeyMap; SvxMSExportOLEObjects* pOLEExp; SwMSConvertControls* pOCXExp; WW8OleMaps* pOleMap; @@ -816,6 +816,8 @@ protected: bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd, IMarkVector& rArr ); + const NfKeywordTable & GetNfKeywordTable(); + public: MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ); virtual ~MSWordExportBase(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 4a8fab5d0f79..cf281f6992cf 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2430,19 +2430,13 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) const SvNumberformat* pNumFmt = pNFmtr->GetEntry( nFmtIdx ); if( pNumFmt ) { - //sal_uInt16 nLng = rFld.GetLanguage(); - LocaleDataWrapper aLocDat( pNFmtr->GetServiceManager(), - MsLangId::convertLanguageToLocale( LANGUAGE_ENGLISH_US ) ); + sal_uInt16 nLng = rFld.GetLanguage(); + LocaleDataWrapper aLocDat(pNFmtr->GetServiceManager(), + MsLangId::convertLanguageToLocale(nLng)); - if( !pKeyMap ) - { - pKeyMap = new NfKeywordTable; - NfKeywordTable& rKeyMap = *(NfKeywordTable*)pKeyMap; - pNFmtr->FillKeywordTable( rKeyMap, LANGUAGE_ENGLISH_US ); - } - - String sFmt(pNumFmt->GetMappedFormatstring(*(NfKeywordTable*)pKeyMap, + String sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(), aLocDat)); + if (sFmt.Len()) { sw::ms::SwapQuotesInField(sFmt); -- cgit From 6201194c7c851faed3f2f0cc14df40d605e393af Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Wed, 9 Mar 2011 12:43:03 +0100 Subject: sw34bf04: #i46648#: define class for NfKeywordTable * * * #i46648#: Use specific NfKeywordTabl --- svl/inc/svl/nfkeytab.hxx | 14 +++++++++++++- svl/source/numbers/zforlist.cxx | 14 +++++++------- svl/source/numbers/zformat.cxx | 20 ++++++++++---------- svl/source/numbers/zforscan.cxx | 22 +++++++++++----------- svl/source/numbers/zforscan.hxx | 2 +- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/svl/inc/svl/nfkeytab.hxx b/svl/inc/svl/nfkeytab.hxx index 7c3fef4b88cc..34d483ab4d86 100644 --- a/svl/inc/svl/nfkeytab.hxx +++ b/svl/inc/svl/nfkeytab.hxx @@ -28,6 +28,7 @@ #ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX #define INCLUDED_SVTOOLS_NFKEYTAB_HXX +#include #include //! For ImpSvNumberformatScan: first the short symbols, then the long symbols! @@ -111,7 +112,18 @@ enum NfKeywordIndex NF_KEYWORD_ENTRIES_COUNT }; -typedef String NfKeywordTable [NF_KEYWORD_ENTRIES_COUNT]; +class NfKeywordTable +{ + typedef ::std::vector Keywords_t; + Keywords_t m_keywords; + +public: + NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {}; + virtual ~NfKeywordTable() {} + + String & operator[] (Keywords_t::size_type n) { return m_keywords[n]; } + const String & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; } +}; #endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index ebc1fa673fe2..d4d0f8550907 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -939,10 +939,10 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang ) { ChangeIntl( eLang ); - const String* pTable = pFormatScanner->GetKeywords(); + const NfKeywordTable & rTable = pFormatScanner->GetKeywords(); for ( sal_uInt16 i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i ) { - rKeywords[i] = pTable[i]; + rKeywords[i] = rTable[i]; } } @@ -950,9 +950,9 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, String SvNumberFormatter::GetKeyword( LanguageType eLnge, sal_uInt16 nIndex ) { ChangeIntl(eLnge); - const String* pTable = pFormatScanner->GetKeywords(); - if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT ) - return pTable[nIndex]; + const NfKeywordTable & rTable = pFormatScanner->GetKeywords(); + if ( nIndex < NF_KEYWORD_ENTRIES_COUNT ) + return rTable[nIndex]; DBG_ERROR("GetKeyword: invalid index"); return String(); @@ -2589,8 +2589,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, sal_Bool bLoadi CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); // Week of year must be appended here because of nNewExtended - const String* pKeyword = pFormatScanner->GetKeywords(); - aSingleFormatCode.Code = pKeyword[NF_KEY_WW]; + const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); + aSingleFormatCode.Code = rKeyword[NF_KEY_WW]; ImpInsertNewStandardFormat( aSingleFormatCode, CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 92398792077d..9b01c2ee91be 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1149,7 +1149,7 @@ short SvNumberformat::ImpNextSymbol(String& rString, xub_StrLen nLen = rString.Len(); ScanState eState = SsStart; sSymbol.Erase(); - const String* pKeywords = rScan.GetKeywords(); + const NfKeywordTable & rKeywords = rScan.GetKeywords(); while (nPos < nLen && eState != SsStop) { cToken = rString.GetChar(nPos); @@ -1267,9 +1267,9 @@ short SvNumberformat::ImpNextSymbol(String& rString, BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); eState = SsGetPrefix; } - else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + else if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S { sSymbol += cToken; eState = SsGetTime; @@ -1306,9 +1306,9 @@ short SvNumberformat::ImpNextSymbol(String& rString, else { sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0); - if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + if (cUpper == rKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == rKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == rKeywords[NF_KEY_S].GetChar(0) ) // S { if (cLetter == cToken) { @@ -4230,10 +4230,10 @@ String SvNumberformat::GetMappedFormatstring( const String& rColorName = NumFor[n].GetColorName(); if ( rColorName.Len() ) { - const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR; - for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ ) + const NfKeywordTable & rKey = rScan.GetKeywords(); + for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++ ) { - if ( *pKey == rColorName ) + if ( rKey[j] == rColorName ) { aPrefix += '['; aPrefix += rKeywords[j]; diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 000649a6de80..83dbd512a4e2 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -473,10 +473,10 @@ void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec) Color* ImpSvNumberformatScan::GetColor(String& sStr) { String sString = pFormatter->GetCharClass()->upper(sStr); - const String* pKeyword = GetKeywords(); + const NfKeywordTable & rKeyword = GetKeywords(); size_t i = 0; while (i < NF_MAX_DEFAULT_COLORS && - sString != pKeyword[NF_KEY_FIRSTCOLOR+i] ) + sString != rKeyword[NF_KEY_FIRSTCOLOR+i] ) i++; if ( i >= NF_MAX_DEFAULT_COLORS ) { @@ -492,7 +492,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) Color* pResult = NULL; if (i >= NF_MAX_DEFAULT_COLORS) { - const String& rColorWord = pKeyword[NF_KEY_COLOR]; + const String& rColorWord = rKeyword[NF_KEY_COLOR]; xub_StrLen nPos = sString.Match(rColorWord); if (nPos > 0) { @@ -529,7 +529,7 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) pFormatter->ChangeIntl(eTmpLnge); } else - sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; + sStr = rKeyword[NF_KEY_FIRSTCOLOR+i]; pResult = &(StandardColor[i]); } @@ -540,16 +540,16 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr) short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos ) { String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos ); - const String* pKeyword = GetKeywords(); + const NfKeywordTable & rKeyword = GetKeywords(); // #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere - if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 ) + if ( sString.Search( rKeyword[NF_KEY_GENERAL] ) == 0 ) return NF_KEY_GENERAL; //! MUST be a reverse search to find longer strings first short i = NF_KEYWORD_ENTRIES_COUNT-1; sal_Bool bFound = sal_False; for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i ) { - bFound = sString.Search(pKeyword[i]) == 0; + bFound = sString.Search(rKeyword[i]) == 0; if ( bFound ) { break; @@ -559,15 +559,15 @@ short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos if ( !bFound ) { // skip the gap of colors et al between new and old keywords and search on i = NF_KEY_LASTKEYWORD; - while ( i > 0 && sString.Search(pKeyword[i]) != 0 ) + while ( i > 0 && sString.Search(rKeyword[i]) != 0 ) i--; - if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] ) + if ( i > NF_KEY_LASTOLDKEYWORD && sString != rKeyword[i] ) { // found something, but maybe it's something else? // e.g. new NNN is found in NNNN, for NNNN we must search on short j = i - 1; - while ( j > 0 && sString.Search(pKeyword[j]) != 0 ) + while ( j > 0 && sString.Search(rKeyword[j]) != 0 ) j--; - if ( j && pKeyword[j].Len() > pKeyword[i].Len() ) + if ( j && rKeyword[j].Len() > rKeyword[i].Len() ) return j; } } diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index 9b04921cb7f4..a1372866a46e 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -66,7 +66,7 @@ public: const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); } CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); } - const String* GetKeywords() const + const NfKeywordTable & GetKeywords() const { if ( bKeywordsNeedInit ) InitKeywords(); -- cgit From 1138fad1b357b5dba76670227e785565e42f164b Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 9 Mar 2011 13:43:38 +0100 Subject: native367: #o11840947# preparing OOO 3.4 --- scp2/source/ooo/windowscustomaction_ooo.scp | 4 +- solenv/bin/modules/installer/epmfile.pm | 12 +- solenv/bin/modules/installer/globals.pm | 4 + solenv/bin/modules/installer/simplepackage.pm | 1 + solenv/bin/modules/installer/windows/file.pm | 12 +- solenv/bin/modules/installer/windows/idtglobal.pm | 3 + solenv/bin/modules/installer/windows/msp.pm | 201 ++++++++++++++++++++++ solenv/bin/modules/installer/windows/property.pm | 6 + solenv/bin/modules/installer/windows/registry.pm | 76 +++++++- 9 files changed, 311 insertions(+), 8 deletions(-) diff --git a/scp2/source/ooo/windowscustomaction_ooo.scp b/scp2/source/ooo/windowscustomaction_ooo.scp index 7bd6c18fae99..a4090b21e553 100755 --- a/scp2/source/ooo/windowscustomaction_ooo.scp +++ b/scp2/source/ooo/windowscustomaction_ooo.scp @@ -474,8 +474,8 @@ WindowsCustomAction gid_Customaction_RebaseLibrariesonproperties Source = "rebase.dll"; Target = "RebaseLibrariesOnProperties"; Inbinarytable = 1; - Assignment1 = ("InstallExecuteSequence", "Not REMOVE=\"ALL\"", "end"); - Assignment2 = ("AdminExecuteSequence", "Not REMOVE=\"ALL\"", "end"); + Assignment1 = ("InstallExecuteSequence", "VersionNT < 600 And Not REMOVE=\"ALL\"", "end"); + Assignment2 = ("AdminExecuteSequence", "VersionNT < 600 And Not REMOVE=\"ALL\"", "end"); End WindowsCustomAction gid_Customaction_ShowSurvey diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index 8b828b85335f..119eb95e0b7c 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -1060,7 +1060,7 @@ sub set_revision_in_pkginfo my $pkgversion = "SOLSPARCPKGVERSION"; if ( $installer::globals::issolarisx86build ) { $pkgversion = "SOLIAPKGVERSION"; } - if (( $variables->{$pkgversion} ) && ( $variables->{$pkgversion} ne "" )) + if (( $variables->{$pkgversion} ) && ( $variables->{$pkgversion} ne "" )) { if ( $variables->{$pkgversion} ne "FINALVERSION" ) { @@ -1085,7 +1085,15 @@ sub set_revision_in_pkginfo $version = "$finalmajor.$finalminor.$finalmicro"; } - my $versionstring = "$version,$variables->{$pkgversion}"; + my $datestring = $variables->{$pkgversion}; + + # Allowing some packages to have another date of creation. + # They can be defined in product definition using a key like "SOLSPARCPKGVERSION_$packagename" + + my $additionalkey = $pkgversion . "_" . $packagename; + if (( $variables->{$additionalkey} ) && ( $variables->{$additionalkey} ne "" )) { $datestring = $variables->{$additionalkey}; } + + my $versionstring = "$version,$datestring"; for ( my $i = 0; $i <= $#{$file}; $i++ ) { diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 1536cb993db0..4fed7314ef67 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -379,6 +379,10 @@ BEGIN %allcomponents_in_this_database = (); %allshortcomponents = (); %alluniquedirectorynames = (); + %allregistrycomponents_ = (); + %allregistrycomponents_in_this_database_ = (); + %allshortregistrycomponents = (); + %allregistryidentifier = (); $installlocationdirectory = ""; $installlocationdirectoryset = 0; diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index d76b81a55850..2e870ba48712 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -705,6 +705,7 @@ sub create_simple_package if (( $onefile->{'Styles'} ) && ( $onefile->{'Styles'} =~ /\bBINARYTABLE_ONLY\b/ )) { next; } if (( $installer::globals::patch ) && ( $onefile->{'Styles'} ) && ( ! ( $onefile->{'Styles'} =~ /\bPATCH\b/ ))) { next; } + if (( $installer::globals::patch ) && ( $installer::globals::packageformat eq "dmg" )) { push(@installer::globals::patchfilecollector, "$onefile->{'destination'}\n"); } my $source = $onefile->{'sourcepath'}; my $destination = $onefile->{'destination'}; diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index b679d8b46e2b..3ac72ecf6ac3 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -282,7 +282,7 @@ sub get_file_component_name } else { - if ( length($componentname) > 72 ) + if ( length($componentname) > 60 ) { # Using md5sum needs much time # chomp(my $shorter = `echo $componentname | md5sum | sed -e "s/ .*//g"`); @@ -674,7 +674,15 @@ sub get_language_for_file if ( $fileref->{'specificlanguage'} ) { $language = $fileref->{'specificlanguage'}; } - if (!($language eq "")) + if ( $language eq "" ) + { + $language = 0; # language independent + # If this is not a font, the return value should be "0" (Check ICE 60) + my $styles = ""; + if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; } + if ( $styles =~ /\bFONT\b/ ) { $language = ""; } + } + else { $language = installer::windows::language::get_windows_language($language); } diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm b/solenv/bin/modules/installer/windows/idtglobal.pm index 453464a3ae36..4a54ead9dfd4 100644 --- a/solenv/bin/modules/installer/windows/idtglobal.pm +++ b/solenv/bin/modules/installer/windows/idtglobal.pm @@ -49,11 +49,14 @@ sub shorten_feature_gid my ($stringref) = @_; $$stringref =~ s/gid_Module_/gm_/; + $$stringref =~ s/_Extension_/_ex_/; $$stringref =~ s/_Root_/_r_/; $$stringref =~ s/_Prg_/_p_/; $$stringref =~ s/_Optional_/_o_/; + $$stringref =~ s/_Tools_/_tl_/; $$stringref =~ s/_Wrt_Flt_/_w_f_/; $$stringref =~ s/_Javafilter_/_jf_/; + $$stringref =~ s/_Productivity_/_pr_/; } ############################################ diff --git a/solenv/bin/modules/installer/windows/msp.pm b/solenv/bin/modules/installer/windows/msp.pm index a4996945de4d..553449adaad8 100644 --- a/solenv/bin/modules/installer/windows/msp.pm +++ b/solenv/bin/modules/installer/windows/msp.pm @@ -27,6 +27,7 @@ package installer::windows::msp; +use File::Copy; use installer::control; use installer::converter; use installer::exiter; @@ -84,6 +85,200 @@ sub install_installation_sets return ($olddatabase, $newdatabase); } +################################################################################# +# Collecting the destinations of all files with flag PATCH in a hash. +################################################################################# + +sub collect_patch_file_destinations +{ + my ( $filesarray ) = @_; + + my %patchfiledestinations = (); + my %nopatchfiledestinations = (); + my $patchcounter = 0; + my $nopatchcounter = 0; + + for ( my $i = 0; $i <= $#{$filesarray}; $i++ ) + { + my $onefile = ${$filesarray}[$i]; + my $styles = ""; + + if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'} }; + + if ( $styles =~ /\bPATCH\b/ ) + { + $patchfiledestinations{$onefile->{'destination'}} = 1; + $patchcounter++; + } + else + { + $nopatchfiledestinations{$onefile->{'destination'}} = 1; + $nopatchcounter++; + } + } + + return (\%patchfiledestinations, \%nopatchfiledestinations, $patchcounter, $nopatchcounter); +} + +################################################################################# +# Returning the first path segment of a path +################################################################################# + +sub get_first_path_segment +{ + my ( $path ) = @_; + + my $firstsegment = ""; + my $remainder = $path; + + if ( $path =~ /^\s*(.*?)[\/\\](.*)\s*$/ ) + { + $firstsegment = $1; + $remainder = $2; + } + + return ($firstsegment, $remainder); +} + +################################################################################# +# Finding the flexible path in the destinations, that are saved in +# the hash $nopatchfiledestinations. +################################################################################# + +sub prepare_path_in_nopatchfilehash +{ + my ($nopatchfiledestinations, $newpath) = @_; + + my $infoline = ""; + my $flexiblepath = ""; + my $found = 0; + my %checked_destinations = (); + + foreach my $onedestination ( keys %{$nopatchfiledestinations} ) + { + $flexiblepath = ""; + $found = 0; + + my $found_first_segement = 1; + my $firstsegement = ""; + my $fixedpath = $onedestination; + my $testfile = $newpath . $installer::globals::separator . $fixedpath; + + while (( ! -f $testfile ) && ( $found_first_segement )) + { + $firstsegement = ""; + ( $firstsegement, $fixedpath ) = get_first_path_segment($fixedpath); + + if ( $firstsegement ne "" ) + { + $found_first_segement = 1; + $flexiblepath = $flexiblepath . $firstsegement . $installer::globals::separator; + } + else + { + $found_first_segement = 0; + } + + $testfile = $newpath . $installer::globals::separator . $fixedpath; + } + + if ( -f $testfile ) { $found = 1; } + + if ( $found ) { last; } + } + + $infoline = "Setting flexible path for msp creation: $flexiblepath\n"; + push( @installer::globals::logfileinfo, $infoline); + + if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not determine flexible destination path for msp patch creation!", "prepare_path_in_nopatchfilehash"); } + + foreach my $onedestination ( keys %{$nopatchfiledestinations} ) + { + $onedestination =~ s/^\s*\Q$flexiblepath\E//; + $checked_destinations{$onedestination} = 1; + } + + return \%checked_destinations; +} + +################################################################################# +# Synchronizing the two installed products in that way, that only +# files with flag PATCH are different. +################################################################################# + +sub synchronize_installation_sets +{ + my ($olddatabase, $newdatabase, $filesarray) = @_; + + my $infoline = "\nSynchronizing installed products because of PATCH flag\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "Old product: $olddatabase\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "New product: $newdatabase\n"; + push( @installer::globals::logfileinfo, $infoline); + + my ( $patchfiledestinations, $nopatchfiledestinations, $patchfilecounter, $nopatchfilecounter ) = collect_patch_file_destinations($filesarray); + + $infoline = "Number of files with PATCH flag: $patchfilecounter\n"; + push( @installer::globals::logfileinfo, $infoline); + + $infoline = "Number of files without PATCH flag: $nopatchfilecounter\n"; + push( @installer::globals::logfileinfo, $infoline); + + foreach my $localfile ( sort keys %{$patchfiledestinations} ) + { + $infoline = "\tPATCH file: $localfile\n"; + push( @installer::globals::logfileinfo, $infoline); + } + + my @oldfiles = (); + my @newfiles = (); + my $pathstring = ""; + + my $oldpath = $olddatabase; + if ( $^O =~ /cygwin/i ) { $oldpath =~ s/\\/\//g; } + installer::pathanalyzer::get_path_from_fullqualifiedname(\$oldpath); + $oldpath =~ s/\\\s*$//; + $oldpath =~ s/\/\s*$//; + + my $newpath = $newdatabase; + if ( $^O =~ /cygwin/i ) { $newpath =~ s/\\/\//g; } + installer::pathanalyzer::get_path_from_fullqualifiedname(\$newpath); + $newpath =~ s/\\\s*$//; + $newpath =~ s/\/\s*$//; + + # The destination path is not correct. destinations in the hash contain + # the flexible installation path, that is not part in the administrative installation + $nopatchfiledestinations = prepare_path_in_nopatchfilehash($nopatchfiledestinations, $newpath); + + foreach my $onedestination ( keys %{$nopatchfiledestinations} ) + { + my $source = $oldpath . $installer::globals::separator . $onedestination; + my $dest = $newpath . $installer::globals::separator . $onedestination; + + if ( -f $source ) + { + if ( -f $dest ) + { + my $copyreturn = copy($source, $dest); + # installer::systemactions::copy_one_file($source, $dest); + # $infoline = "Synchronizing file: $source to $dest\n"; + # push( @installer::globals::logfileinfo, $infoline); + } + else + { + $infoline = "Not synchronizing. Destination file \"$dest\" does not exist.\n"; + push( @installer::globals::logfileinfo, $infoline); + } + } + else + { + $infoline = "Not synchronizing. Source file \"$source\" does not exist.\n"; + push( @installer::globals::logfileinfo, $infoline); + } + } +} + ################################################################################# # Extracting all tables from a pcp file ################################################################################# @@ -1200,6 +1395,12 @@ sub create_msp_patch installer::logger::print_message( "... installing products ...\n" ); my ($olddatabase, $newdatabase) = install_installation_sets($installationdir); + installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting synchronization of installation sets"); + + # Synchronizing installed products, allowing only different files with PATCH flag + installer::logger::print_message( "... synchronizing installation sets ...\n" ); + synchronize_installation_sets($olddatabase, $newdatabase, $filesarray); + installer::logger::include_timestamp_into_logfile("\nPerformance Info: Starting pcp file creation"); # Create pcp file diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 9e5557e4dacc..a5d3745d94c3 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -294,6 +294,12 @@ sub set_important_properties push(@{$propertyfile}, $onepropertyline); } + if ( $allvariables->{'EXCLUDE_FROM_REBASE'} ) + { + my $onepropertyline = "EXCLUDE_FROM_REBASE" . "\t" . $allvariables->{'EXCLUDE_FROM_REBASE'} . "\n"; + push(@{$propertyfile}, $onepropertyline); + } + if ( $allvariables->{'PREREQUIREDPATCH'} ) { my $onepropertyline = "PREREQUIREDPATCH" . "\t" . $allvariables->{'PREREQUIREDPATCH'} . "\n"; diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm index cf87ba174dd0..18981d661372 100644 --- a/solenv/bin/modules/installer/windows/registry.pm +++ b/solenv/bin/modules/installer/windows/registry.pm @@ -61,12 +61,13 @@ sub get_registry_component_name # Attention: Maximum length for the componentname is 72 + # identifying this component as registryitem component + $componentname = "registry_" . $componentname; + $componentname =~ s/gid_module_/g_m_/g; $componentname =~ s/_optional_/_o_/g; $componentname =~ s/_javafilter_/_jf_/g; - $componentname = $componentname . "_registry"; # identifying this component as registryitem component - # This componentname must be more specific my $addon = "_"; if ( $allvariables->{'PRODUCTNAME'} ) { $addon = $addon . $allvariables->{'PRODUCTNAME'}; } @@ -95,11 +96,74 @@ sub get_registry_component_name if (( $styles =~ /\bLANGUAGEPACK\b/ ) && ( $installer::globals::languagepack )) { $componentname = $componentname . "_lang"; } if ( $styles =~ /\bALWAYS_REQUIRED\b/ ) { $componentname = $componentname . "_forced"; } + # Attention: Maximum length for the componentname is 72 + # %installer::globals::allregistrycomponents_in_this_database_ : resetted for each database + # %installer::globals::allregistrycomponents_ : not resetted for each database + # Component strings must be unique for the complete product, because they are used for + # the creation of the globally unique identifier. + + my $fullname = $componentname; # This can be longer than 72 + + if (( exists($installer::globals::allregistrycomponents_{$fullname}) ) && ( ! exists($installer::globals::allregistrycomponents_in_this_database_{$fullname}) )) + { + # This is not allowed: One component cannot be installed with different packages. + installer::exiter::exit_program("ERROR: Windows registry component \"$fullname\" is already included into another package. This is not allowed.", "get_registry_component_name"); + } + + if ( exists($installer::globals::allregistrycomponents_{$fullname}) ) + { + $componentname = $installer::globals::allregistrycomponents_{$fullname}; + } + else + { + if ( length($componentname) > 60 ) + { + $componentname = generate_new_short_registrycomponentname($componentname); # This has to be unique for the complete product, not only one package + } + + $installer::globals::allregistrycomponents_{$fullname} = $componentname; + $installer::globals::allregistrycomponents_in_this_database_{$fullname} = 1; + } + if ( $isrootmodule ) { $installer::globals::registryrootcomponent = $componentname; } return $componentname; } +######################################################### +# Create a shorter version of a long component name, +# because maximum length in msi database is 72. +# Attention: In multi msi installation sets, the short +# names have to be unique over all packages, because +# this string is used to create the globally unique id +# -> no resetting of +# %installer::globals::allshortregistrycomponents +# after a package was created. +######################################################### + +sub generate_new_short_registrycomponentname +{ + my ($componentname) = @_; + + my $shortcomponentname = ""; + my $counter = 1; + + my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters + $startversion = $startversion . "_"; + + $shortcomponentname = $startversion . $counter; + + while ( exists($installer::globals::allshortregistrycomponents{$shortcomponentname}) ) + { + $counter++; + $shortcomponentname = $startversion . $counter; + } + + $installer::globals::allshortregistrycomponents{$shortcomponentname} = 1; + + return $shortcomponentname; +} + ############################################################## # Returning identifier for registry table. ############################################################## @@ -121,8 +185,16 @@ sub get_registry_identifier $identifier =~ s/_clsid_/_c_/; $identifier =~ s/_currentversion_/_cv_/; $identifier =~ s/_microsoft_/_ms_/; + $identifier =~ s/_manufacturer_/_mf_/; + $identifier =~ s/_productname_/_pn_/; + $identifier =~ s/_productversion_/_pv_/; $identifier =~ s/_staroffice_/_so_/; + $identifier =~ s/_software_/_sw_/; + $identifier =~ s/_capabilities_/_cap_/; $identifier =~ s/_classpath_/_cp_/; + $identifier =~ s/_extension_/_ex_/; + $identifier =~ s/_fileassociations_/_fa_/; + $identifier =~ s/_propertysheethandlers_/_psh_/; $identifier =~ s/__/_/g; # Saving this in the registry collector -- cgit From c38ac7124a3a0f55b155569b8574f1ba4dc734ab Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 10 Mar 2011 10:59:14 +0100 Subject: dba34c: release param --- dbaccess/source/ui/browser/genericcontroller.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 200c87a729b3..99208c0de2ae 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -965,6 +965,9 @@ void OGenericUnoController::disposing() m_xMasterDispatcher = NULL; m_xSlaveDispatcher = NULL; m_xServiceFactory = NULL; + m_xTitleHelper.clear(); + m_xUrlTransformer.clear(); + m_aInitParameters.clear(); } // ----------------------------------------------------------------------------- -- cgit From 5d1fcc6735986e1d7490b01031c1945ac8fefbd2 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 10 Mar 2011 11:01:42 +0100 Subject: native367: #o11840947# preparing OOO 3.4 --- solenv/bin/modules/installer/windows/msp.pm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/solenv/bin/modules/installer/windows/msp.pm b/solenv/bin/modules/installer/windows/msp.pm index 553449adaad8..ac28f9258820 100644 --- a/solenv/bin/modules/installer/windows/msp.pm +++ b/solenv/bin/modules/installer/windows/msp.pm @@ -187,11 +187,11 @@ sub prepare_path_in_nopatchfilehash if ( $found ) { last; } } + if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not determine flexible destination path for msp patch creation!", "prepare_path_in_nopatchfilehash"); } + $infoline = "Setting flexible path for msp creation: $flexiblepath\n"; push( @installer::globals::logfileinfo, $infoline); - if ( ! $found ) { installer::exiter::exit_program("ERROR: Could not determine flexible destination path for msp patch creation!", "prepare_path_in_nopatchfilehash"); } - foreach my $onedestination ( keys %{$nopatchfiledestinations} ) { $onedestination =~ s/^\s*\Q$flexiblepath\E//; @@ -231,10 +231,6 @@ sub synchronize_installation_sets push( @installer::globals::logfileinfo, $infoline); } - my @oldfiles = (); - my @newfiles = (); - my $pathstring = ""; - my $oldpath = $olddatabase; if ( $^O =~ /cygwin/i ) { $oldpath =~ s/\\/\//g; } installer::pathanalyzer::get_path_from_fullqualifiedname(\$oldpath); -- cgit From 5652ca8a2a7d0a49a73de82661ff68e0cbdc8370 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Thu, 10 Mar 2011 13:09:38 +0100 Subject: dr78: #i111413# removed all translation relevant strings from SEC, CSC, SECH and CSCH. As CWS dr78 didn't make it before translation freeze, string changes would pollute translation data. The core feature is still available, documents containing the functions can be loaded and saved, but the UI function names are non-translatable English names and function wizard resource is not available. TODO: undo this change for the next release. --- sc/inc/helpids.h | 4 -- sc/source/ui/src/scfuncs.src | 98 -------------------------------------------- sc/util/hidother.src | 4 -- 3 files changed, 106 deletions(-) diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index 25f8ebb2fbe3..f1803639cba2 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -515,10 +515,6 @@ #define HID_FUNC_COTHYP "SC_HID_FUNC_COTHYP" #define HID_FUNC_TANHYP "SC_HID_FUNC_TANHYP" #define HID_FUNC_ARCTAN2 "SC_HID_FUNC_ARCTAN2" -#define HID_FUNC_COSECANT "SC_HID_FUNC_COSECANT" -#define HID_FUNC_SECANT "SC_HID_FUNC_SECANT" -#define HID_FUNC_SECANTHYP "SC_HID_FUNC_SECANTHYP" -#define HID_FUNC_COSECANTHYP "SC_HID_FUNC_COSECANTHYP" #define HID_FUNC_DEG "SC_HID_FUNC_DEG" #define HID_FUNC_RAD "SC_HID_FUNC_RAD" #define HID_FUNC_EXP "SC_HID_FUNC_EXP" diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index d9934eac6a2b..a63a897b007c 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -3469,104 +3469,6 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 }; }; - // -=*# Resource for function CSC #*=- - Resource SC_OPCODE_COSECANT - { - String 1 // Description - { - Text [ en-US ] = "Return the cosecant of an angle. CSC(x)=1/SIN(x)" ; - }; - ExtraData = - { - 0; - ID_FUNCTION_GRP_MATH; - U2S( HID_FUNC_COSECANT ); - 1; 0; - 0; - }; - String 2 // Name of Parameter 1 - { - Text [ en-US ] = "Angle" ; - }; - String 3 // Description of Parameter 1 - { - Text [ en-US ] = "The angle in radians for which the cosecant is to be calculated." ; - }; - }; - - // -=*# Resource for function SEC #*=- - Resource SC_OPCODE_SECANT - { - String 1 // Description - { - Text [ en-US ] = "Return the secant of an angle. SEC(x)=1/COS(x)" ; - }; - ExtraData = - { - 0; - ID_FUNCTION_GRP_MATH; - U2S( HID_FUNC_SECANT ); - 1; 0; - 0; - }; - String 2 // Name of Parameter 1 - { - Text [ en-US ] = "Angle" ; - }; - String 3 // Description of Parameter 1 - { - Text [ en-US ] = "The angle in radians for which the secant is to be calculated." ; - }; - }; - // -=*# Resource for function CSCH #*=- - Resource SC_OPCODE_COSECANT_HYP - { - String 1 // Description - { - Text [ en-US ] = "Return the hyperbolic cosecant of a hyperbolic angle. CSCH(x)=1/SINH(x)" ; - }; - ExtraData = - { - 0; - ID_FUNCTION_GRP_MATH; - U2S( HID_FUNC_COSECANTHYP ); - 1; 0; - 0; - }; - String 2 // Name of Parameter 1 - { - Text [ en-US ] = "Angle" ; - }; - String 3 // Description of Parameter 1 - { - Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic cosecant is to be calculated." ; - }; - }; - // -=*# Resource for function SECH #*=- - Resource SC_OPCODE_SECANT_HYP - { - String 1 // Description - { - Text [ en-US ] = "Return the hyperbolic secant of a hyperbolic angle. SECH(x)=1/COSH(x)" ; - }; - ExtraData = - { - 0; - ID_FUNCTION_GRP_MATH; - U2S( HID_FUNC_SECANTHYP ); - 1; 0; - 0; - }; - String 2 // Name of Parameter 1 - { - Text [ en-US ] = "Angle" ; - }; - String 3 // Description of Parameter 1 - { - Text [ en-US ] = "The hyperbolic angle in radians for which the hyperbolic secant is to be calculated." ; - }; - }; - // -=*# Resource for function DEG #*=- Resource SC_OPCODE_DEG { diff --git a/sc/util/hidother.src b/sc/util/hidother.src index 1f3072303402..d575580228bd 100644 --- a/sc/util/hidother.src +++ b/sc/util/hidother.src @@ -191,10 +191,6 @@ hidspecial HID_FUNC_SINHYP { HelpID = HID_FUNC_SINHYP; }; hidspecial HID_FUNC_COTHYP { HelpID = HID_FUNC_COTHYP; }; hidspecial HID_FUNC_TANHYP { HelpID = HID_FUNC_TANHYP; }; hidspecial HID_FUNC_ARCTAN2 { HelpID = HID_FUNC_ARCTAN2; }; -hidspecial HID_FUNC_COSECANT { HelpID = HID_FUNC_COSECANT; }; -hidspecial HID_FUNC_SECANT { HelpID = HID_FUNC_SECANT; }; -hidspecial HID_FUNC_COSECANTHYP { HelpID = HID_FUNC_COSECANTHYP; }; -hidspecial HID_FUNC_SECANTHYP { HelpID = HID_FUNC_SECANTHYP; }; hidspecial HID_FUNC_DEG { HelpID = HID_FUNC_DEG; }; hidspecial HID_FUNC_RAD { HelpID = HID_FUNC_RAD; }; hidspecial HID_FUNC_EXP { HelpID = HID_FUNC_EXP; }; -- cgit From 8575dc4a545812b80c20d01c3c3e35f1eb9f2123 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Thu, 10 Mar 2011 13:09:38 +0100 Subject: dr78: #i111413# removed all translation relevant strings from SEC, CSC, SECH and CSCH. As CWS dr78 didn't make it before translation freeze, string changes would pollute translation data. The core feature is still available, documents containing the functions can be loaded and saved, but the UI function names are non-translatable English names and function wizard resource is not available. TODO: undo this change for the next release. --- formula/source/core/resource/core_resource.src | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index f7cd137d08a5..b8a5f1250941 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -840,19 +840,19 @@ Resource RID_STRLIST_FUNCTION_NAMES }; String SC_OPCODE_COSECANT { - Text [ en-US ] = "CSC" ; + Text = "CSC" ; }; String SC_OPCODE_SECANT { - Text [ en-US ] = "SEC" ; + Text = "SEC" ; }; String SC_OPCODE_COSECANT_HYP { - Text [ en-US ] = "CSCH" ; + Text = "CSCH" ; }; String SC_OPCODE_SECANT_HYP { - Text [ en-US ] = "SECH" ; + Text = "SECH" ; }; String SC_OPCODE_EXP { -- cgit From d09682885106abdd7173656b9aeb8a945caafb06 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 11 Mar 2011 10:16:56 +0100 Subject: db34c: #i108415# check if column exists --- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 966da2722ff0..967ed753e6df 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -239,11 +239,16 @@ public class SQLQueryComposer private PropertyValue[][] replaceConditionsByAlias(PropertyValue _filterconditions[][]) { + XColumnsSupplier columnSup = UnoRuntime.queryInterface(XColumnsSupplier.class, m_xQueryAnalyzer); + XNameAccess columns = columnSup.getColumns(); for (int n = 0; n < _filterconditions.length; n++) { for (int m = 0; m < _filterconditions[n].length; m++) { _filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name); + final String aliasName = getComposedAliasFieldName(_filterconditions[n][m].Name); + if ( columns.hasByName(aliasName)) + _filterconditions[n][m].Name = aliasName; } } return _filterconditions; -- cgit From dc8fc17fedf7e66795870bbb2ba46395071d1461 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:31 +0100 Subject: sw34bf04: #i115557#: SwFrm::AppendDrawObj: SwFlyFrm may have 0 pUpper --- sw/source/core/layout/fly.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 38ce56f902d4..5957b614a5d7 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2258,7 +2258,10 @@ void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj ) // Assure the control objects and group objects containing controls are on the control layer if ( ::CheckControlLayer( _rNewObj.DrawObj() ) ) { - const IDocumentDrawModelAccess* pIDDMA = GetUpper()->GetFmt()->getIDocumentDrawModelAccess(); + const IDocumentDrawModelAccess* pIDDMA = (IsFlyFrm()) + ? static_cast(this)->GetFmt()-> + getIDocumentDrawModelAccess() + : GetUpper()->GetFmt()->getIDocumentDrawModelAccess(); const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer()); const SdrLayerID aControlLayerID(pIDDMA->GetControlsId()); const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId()); -- cgit From 7ee24fb1c5350ea781d41d65a460c28987666a1f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:31 +0100 Subject: sw34bf04: RDFRepositoryTest: fix accidentally inverted assertions (sb123) --- unoxml/qa/complex/unoxml/RDFRepositoryTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java index d047ef77440e..3cf203325a70 100644 --- a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java +++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java @@ -172,14 +172,14 @@ public class RDFRepositoryTest try { xRep.createGraph(foo); - assertFalse("creating duplicate graph was allowed", false); + fail("creating duplicate graph was allowed"); } catch (ElementExistException e) { // ignore } try { xRep.createGraph(null); - assertFalse("invalid graph name was allowed", false); + fail("invalid graph name was allowed"); } catch (IllegalArgumentException e) { // ignore } @@ -296,7 +296,7 @@ public class RDFRepositoryTest xFooIn = new StreamSimulator(tempDir + "foo.rdf", true, param); try { xRep.importGraph(FileFormat.RDF_XML, xFooIn, bar, base); - assertFalse("importing existing graph did not fail", false); + fail("importing existing graph did not fail"); } catch (ElementExistException e) { // ignore } @@ -328,28 +328,28 @@ public class RDFRepositoryTest try { xBazGraph.clear(); - assertFalse("deleted graph not invalid (clear)", false); + fail("deleted graph not invalid (clear)"); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.addStatement(foo, foo, foo); - assertFalse("deleted graph not invalid (add)", false); + fail("deleted graph not invalid (add)"); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.removeStatements(null, null, null); - assertFalse("deleted graph not invalid (remove)", false); + fail("deleted graph not invalid (remove)"); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.getStatements(null, null, null); - assertFalse("deleted graph not invalid (get)", false); + fail("deleted graph not invalid (get)"); } catch (NoSuchElementException e) { // ignore } @@ -473,14 +473,14 @@ public class RDFRepositoryTest try { xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null); - assertFalse("RDFa: set: no predicate", false); + fail("RDFa: set: no predicate"); } catch (IllegalArgumentException e) { // ignore } try { xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null); - assertFalse("RDFa: set: null", false); + fail("RDFa: set: null"); } catch (IllegalArgumentException e) { // ignore } -- cgit From 8e8d4ca2bdb5b28e7371efebab6fde4285b6ae09 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:32 +0100 Subject: sw34bf04: #o11831122#: prevent redline corruption: SwDoc::DelFullPara: call other CorrAbs variant in case of single paragraph. SwDoc::CorrAbs: delete empty redlines, which cause assertions. --- sw/source/core/doc/doccorr.cxx | 16 ++++++++++++++-- sw/source/core/doc/docedt.cxx | 11 +++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 3477619fba33..1390a049fd4a 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -212,10 +212,22 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode, getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset); { // fix redlines SwRedlineTbl& rTbl = *pRedlineTbl; - for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) + for (sal_uInt16 n = 0; n < rTbl.Count(); ) { // is on position ?? - lcl_PaMCorrAbs(*rTbl[ n ], *aPam.Start(), *aPam.End(), aNewPos); + SwRedline *const pRedline( rTbl[ n ] ); + bool const bChanged = + lcl_PaMCorrAbs(*pRedline, *aPam.Start(), *aPam.End(), aNewPos); + // clean up empty redlines: docredln.cxx asserts these as invalid + if (bChanged && (*pRedline->GetPoint() == *pRedline->GetMark()) + && (pRedline->GetContentIdx() == NULL)) + { + rTbl.DeleteAndDestroy(n); + } + else + { + ++n; + } } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 488a6a7a44c7..489bbce0d7da 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -2646,8 +2646,15 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) return sal_False; } } - // text::Bookmarks usw. verschieben - CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True ); + // move bookmarks, redlines etc. + if (aRg.aStart == aRg.aEnd) // only first CorrAbs variant handles this + { + CorrAbs( aRg.aStart, *rPam.GetPoint(), 0, sal_True ); + } + else + { + CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True ); + } // was ist mit Fly's ?? { -- cgit From b51b36409dcf1afb64f6d97c3bd0278b8902496d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:32 +0100 Subject: sw34bf04: #o11831122#: writerfilter: CreateRedline: disable assertion for now --- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 11d03655b5db..96ad59830ade 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1201,7 +1201,8 @@ void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange catch( const uno::Exception & rEx ) { ( void ) rEx; - OSL_ENSURE( false, "Exception in makeRedline" ); +// disabled: current writer redline impl. rather primitive, so it gets annoying +// OSL_ENSURE( false, "Exception in makeRedline" ); } } } -- cgit From 4b6b4bb3e3aaf5868220e29080395270a0763485 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:33 +0100 Subject: sw34bf04: #i117331#: fix SwXText::convertToTextFrame: SwXText::convertToTextFrame: only delete paragraph if it is empty. SwXFrame::attachToRange, SwXText::convertToTextFrame: prevent PaMs on the stack from being registered at nodes that may be deleted preventing assertions from ~SwIndexReg on the bugdoc of #o11831122#. --- sw/source/core/unocore/unoframe.cxx | 2 ++ sw/source/core/unocore/unotext.cxx | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5ee3fc45f6f4..98e78ed00eac 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2180,6 +2180,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 )); } + aPam.DeleteMark(); // mark position node will be deleted! + aIntPam.DeleteMark(); // mark position node will be deleted! pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet, 0, pParentFrmFmt ); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 875d0e23235d..e86f6c7b24de 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1754,13 +1754,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) // DelFullPara is called const uno::Reference< text::XTextRange> xInsertTextRange = new SwXTextRange(aStartPam, this); + aStartPam.DeleteMark(); // mark position node may be deleted! pNewFrame->attach( xInsertTextRange ); pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName()); } - if (!aStartPam.GetTxt().Len()) + SwTxtNode *const pTxtNode(aStartPam.GetNode()->GetTxtNode()); + OSL_ASSERT(pTxtNode); + if (!pTxtNode || !pTxtNode->Len()) // don't remove if it contains text! { - bool bMoved = false; { // has to be in a block to remove the SwIndexes before // DelFullPara is called SwPaM aMovePam( *aStartPam.GetNode() ); @@ -1772,14 +1774,8 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) m_pImpl->m_pDoc->SetAttr( aNewAnchor, *pNewFrame->GetFrmFmt() ); } - bMoved = true; - } - if (bMoved) - { - aStartPam.DeleteMark(); -// SwPaM aDelPam( *aStartPam.GetNode() ); - m_pImpl->m_pDoc->DelFullPara(aStartPam/*aDelPam*/); } + m_pImpl->m_pDoc->DelFullPara(aStartPam); } } catch (lang::IllegalArgumentException& rIllegal) -- cgit From 39df59386962ffda33abc4613910aacb3ade9633 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:33 +0100 Subject: sw34bf04: #i51277#: MSWordExportBase::OutputTextNode: for AUTOFMT that ends at para end, with frame also anchored at para end. the formatting was not exported properly. so move the OutAttr call before the OutFlys call, except if para is empty. --- sw/source/filter/ww8/wrtw8nds.cxx | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 8c52f2269a36..a1738701d3b4 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -500,9 +500,7 @@ void WW8SwAttrIter::OutAttr( xub_StrLen nSwPos ) : nSwPos == *pHt->GetStart() ) { sal_uInt16 nWhich = pHt->GetAttr().Which(); - if (nWhich == nFontId) - pFont = &(item_cast(pHt->GetAttr())); - else if( nWhich == RES_TXTATR_AUTOFMT ) + if (nWhich == RES_TXTATR_AUTOFMT) { const SwFmtAutoFmt& rAutoFmt = static_cast(pHt->GetAttr()); const boost::shared_ptr pSet = rAutoFmt.GetStyleHandle(); @@ -1840,7 +1838,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) String aStr( rNode.GetTxt() ); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen const nEnd = aStr.Len(); bool bRedlineAtEnd = false; int nOpenAttrWithRange = 0; @@ -1932,6 +1930,15 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) if ( aAttrIter.IsDropCap( nNextAttr ) ) AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFmtDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner ); + if (0 != nEnd) + { + // Output the character attributes + // #i51277# do this before writing flys at end of paragraph + AttrOutput().StartRunProperties(); + aAttrIter.OutAttr( nAktPos ); + AttrOutput().EndRunProperties( pRedlineData ); + } + // At the end of line, output the attributes until the CR. // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) @@ -1957,10 +1964,15 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) } } - // Output the character attributes - AttrOutput().StartRunProperties(); - aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ?? - AttrOutput().EndRunProperties( pRedlineData ); + if (0 == nEnd) + { + // Output the character attributes + // do it after WriteCR for an empty paragraph (otherwise + // WW8_WrFkp::Append throws SPRMs away...) + AttrOutput().StartRunProperties(); + aAttrIter.OutAttr( nAktPos ); + AttrOutput().EndRunProperties( pRedlineData ); + } // Exception: footnotes at the end of line if ( nNextAttr == nEnd ) -- cgit From ae3459b3f63764cc586f1b7e004ff343e3928e3f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 11:47:34 +0100 Subject: sw34bf04: #i51277#: SwFltStackEntry::MakeRegion: prevent lots of HintsCheck assertions when importing bugdoc from the issue. --- sw/source/filter/ww1/fltshell.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index c6e093c11935..ded870591e9b 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -137,13 +137,14 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos) sal_Bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bCheck ) { - // wird ueberhaupt ein Bereich umspannt ?? - // - ist kein Bereich, dann nicht returnen wenn am Anfang vom Absatz - // - Felder aussortieren, koennen keinen Bereich haben !! - if ( - nMkNode.GetIndex() == nPtNode.GetIndex() && nMkCntnt == nPtCntnt && - nPtCntnt && RES_TXTATR_FIELD != pAttr->Which() - ) + // does this range actually contain something? + // empty range is allowed if at start of empty paragraph + // fields are special: never have range, so leave them + SwCntntNode *const pCntntNode( + SwNodeIndex(nMkNode, +1).GetNode().GetCntntNode()); + if ((nMkNode.GetIndex() == nPtNode.GetIndex()) && (nMkCntnt == nPtCntnt) + && ((0 != nPtCntnt) || (pCntntNode && (0 != pCntntNode->Len()))) + && (RES_TXTATR_FIELD != pAttr->Which())) { return sal_False; } -- cgit From ea129aa54826091152b59817a295ed0c7075b3bd Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 11 Mar 2011 12:30:14 +0100 Subject: sw34bf04: sw: enable complex test CheckBookmarks (except on windows) --- sw/JunitTest_sw_complex.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sw/JunitTest_sw_complex.mk b/sw/JunitTest_sw_complex.mk index df81b22f712d..bbd05ffa8044 100755 --- a/sw/JunitTest_sw_complex.mk +++ b/sw/JunitTest_sw_complex.mk @@ -64,7 +64,11 @@ $(eval $(call gb_JunitTest_add_classes,sw_complex,\ complex.writer.TextPortionEnumerationTest \ )) -# currently fails (should run again in os146) (except on windows) -# complex.writer.CheckBookmarks \ +# CheckBookmarks currently fails on windows because the hashes are different +ifneq ($(OS),WNT) +$(eval $(call gb_JunitTest_add_classes,sw_complex,\ + complex.writer.CheckBookmarks \ +)) +endif # vim: set noet sw=4 ts=4: -- cgit From 379996c3759ffcd25710fd62165d11e80358f318 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 14 Mar 2011 10:54:34 +0100 Subject: dba34c: remove comment in front of import --- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 967ed753e6df..8724fc46f858 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -33,7 +33,7 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.*; // import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XIndexAccess; -// import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameAccess; import com.sun.star.sdbcx.XColumnsSupplier; // import com.sun.star.sdb.XColumn; import com.sun.star.sdb.XSingleSelectQueryComposer; -- cgit From fb3e5a6bd83cc502b335eab23edfddc0f8ecc85c Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 14 Mar 2011 12:36:04 +0100 Subject: dba34c: forgot to comment one line --- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 8724fc46f858..6a4ced428ea6 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -245,7 +245,7 @@ public class SQLQueryComposer { for (int m = 0; m < _filterconditions[n].length; m++) { - _filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name); + // _filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name); final String aliasName = getComposedAliasFieldName(_filterconditions[n][m].Name); if ( columns.hasByName(aliasName)) _filterconditions[n][m].Name = aliasName; -- cgit From a3ddef2ce63b424b473ee86056b74466596314bc Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Mon, 14 Mar 2011 18:02:19 +0100 Subject: native367: #i117264# exclude list from rebase --- .../source/win32/customactions/rebase/rebase.cxx | 85 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx index dfe1e82e1e9b..2a7026675107 100644 --- a/setup_native/source/win32/customactions/rebase/rebase.cxx +++ b/setup_native/source/win32/customactions/rebase/rebase.cxx @@ -19,11 +19,14 @@ #include #include #include +#include const DWORD PE_Signature = 0x00004550; +typedef std::pair< std::string, bool > StringPair; +typedef std::hash_map< std::string, bool > ExcludeLibsMap; #ifdef DEBUG -inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) +static void OutputDebugStringFormat( LPCSTR pFormat, ... ) { CHAR buffer[1024]; va_list args; @@ -33,7 +36,7 @@ inline void OutputDebugStringFormat( LPCSTR pFormat, ... ) OutputDebugStringA( buffer ); } #else -static inline void OutputDebugStringFormat( LPCSTR, ... ) +static void OutputDebugStringFormat( LPCSTR, ... ) { } #endif @@ -98,22 +101,31 @@ static BOOL rebaseImage( MSIHANDLE /*handle*/, const std::string& sFilePath, LPV return bResult; } -static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address ) +static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address, ExcludeLibsMap& rExcludeMap ) { - std::string sDir = sPath; - std::string sPattern = sPath + TEXT("*.dll"); - + std::string sDir = sPath; + std::string sPattern = sPath + TEXT("*.dll"); WIN32_FIND_DATA aFindFileData; - HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); + HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); if ( IsValidHandle(hFind) ) { BOOL fSuccess = false; do { - std::string sLibFile = sDir + aFindFileData.cFileName; - rebaseImage( handle, sLibFile, address ); + std::string sFileName = aFindFileData.cFileName; + if ( rExcludeMap.find( sFileName ) == rExcludeMap.end() ) + { + OutputDebugStringFormat( "Rebase library: %s", sFileName.c_str() ); + std::string sLibFile = sDir + sFileName; + rebaseImage( handle, sLibFile, address ); + } + else + { + OutputDebugStringFormat( "Exclude library %s from rebase", sFileName.c_str() ); + } + fSuccess = FindNextFile( hFind, &aFindFileData ); } while ( fSuccess ); @@ -124,7 +136,7 @@ static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LP return ERROR_SUCCESS; } -static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress ) +static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress, ExcludeLibsMap& rMap ) { std::string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); @@ -132,9 +144,9 @@ static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress ) std::string sOfficeDir = sInstallPath + TEXT("program\\"); std::string sUreDir = sInstallPath + TEXT("URE\\bin\\"); - BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress ); - bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress ); - bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress ); + BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress, rMap ); + bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress, rMap ); + bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress, rMap ); return bResult; } @@ -146,21 +158,66 @@ static BOOL IsServerSystem( MSIHANDLE /*handle*/ ) GetVersionEx(reinterpret_cast(&osVersionInfoEx)); if ( osVersionInfoEx.wProductType != VER_NT_WORKSTATION ) + { + OutputDebugStringFormat( "Server system detected. No rebase necessary!" ); return TRUE; + } else + { + OutputDebugStringFormat( "Client system detected. Rebase necessary!" ); return FALSE; + } +} + +static void InitExcludeFromRebaseList( MSIHANDLE handle, ExcludeLibsMap& rMap ) +{ + size_t nPos( 0 ); + const TCHAR cDelim = ','; + std::string sLibsExcluded = GetMsiProperty(handle, TEXT("EXCLUDE_FROM_REBASE")); + + while ( nPos < sLibsExcluded.size() ) + { + size_t nDelPos = sLibsExcluded.find_first_of( cDelim, nPos ); + + std::string sExcludedLibName; + if ( nDelPos != std::string::npos ) + { + sExcludedLibName = sLibsExcluded.substr( nPos, nDelPos - nPos ); + nPos = nDelPos+1; + } + else + { + sExcludedLibName = sLibsExcluded.substr( nPos ); + nPos = sLibsExcluded.size(); + } + + if ( sExcludedLibName.size() > 0 ) + { + OutputDebugStringFormat( "Insert library %s into exclude from rebase list", sExcludedLibName.c_str() ); + rMap.insert( StringPair( sExcludedLibName, true )); + } + } } extern "C" BOOL __stdcall RebaseLibrariesOnProperties( MSIHANDLE handle ) { static LPVOID pDefault = reinterpret_cast(0x10000000); + OutputDebugStringFormat( "RebaseLibrariesOnProperties has been called" ); std::string sDontOptimizeLibs = GetMsiProperty(handle, TEXT("DONTOPTIMIZELIBS")); if ( sDontOptimizeLibs.length() > 0 && sDontOptimizeLibs == "1" ) + { + OutputDebugStringFormat( "Don't optimize libraries set. No rebase necessary!" ); return TRUE; + } if ( !IsServerSystem( handle )) - return rebaseImages( handle, pDefault ); + { + ExcludeLibsMap aExcludeLibsMap; + InitExcludeFromRebaseList( handle, aExcludeLibsMap ); + + return rebaseImages( handle, pDefault, aExcludeLibsMap ); + } return TRUE; } -- cgit From e550fb754b98568cd6df498c5017050101ab7718 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Mar 2011 23:01:23 +0100 Subject: dba34c: removed conflicting fix for a leaking WorkWindow - both changes together cause a crash --- sd/source/ui/framework/factories/BasicViewFactory.cxx | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index ebb55ec3bd57..902c6f48a9a7 100755 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include @@ -153,20 +152,6 @@ BasicViewFactory::BasicViewFactory ( BasicViewFactory::~BasicViewFactory (void) { - mpViewCache.reset(); - - Reference< awt::XWindow > xLocalPaneWindow( mxLocalPane->getWindow() ); - try - { - const Reference< XComponent > xLocalPaneComponent( mxLocalPane, UNO_QUERY_THROW ); - xLocalPaneComponent->dispose(); - const Reference< XComponent > xWindowComponent( xLocalPaneWindow, UNO_QUERY_THROW ); - xWindowComponent->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } } -- cgit From ef1fe531a5e8cc6bf8171d489d86f4b4538f3e57 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Tue, 15 Mar 2011 15:55:06 +0100 Subject: dr78: x64 build breaker --- sc/inc/dociter.hxx | 6 +++--- sc/source/core/data/dociter.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index d5d22ff46ba4..15be21b697b8 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -453,8 +453,8 @@ private: ScDocument *pDoc; const ScAttrArray *pAttrArray; ScHorizontalCellIterator *pCellIter; - sal_uInt32 nNumFormat; // for CalcAsShown - sal_uInt32 nNumFmtIndex; + sal_uLong nNumFormat; // for CalcAsShown + sal_uLong nNumFmtIndex; SCTAB nEndTab; SCCOL nCurCol; SCROW nCurRow; @@ -473,7 +473,7 @@ public: bool bSTotal = false, bool bTextAsZero = false ); ~ScHorizontalValueIterator(); - void GetCurNumFmtInfo( short& nType, sal_uInt32& nIndex ); + void GetCurNumFmtInfo( short& nType, sal_uLong& nIndex ); /// Does NOT reset rValue if no value found! bool GetNext( double& rValue, sal_uInt16& rErr ); }; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 7fe760d76a2e..2db9bd61bcfd 100755 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1914,7 +1914,7 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr ) return bFound; } -void ScHorizontalValueIterator::GetCurNumFmtInfo( short& nType, sal_uInt32& nIndex ) +void ScHorizontalValueIterator::GetCurNumFmtInfo( short& nType, sal_uLong& nIndex ) { if (!bNumValid) { -- cgit From 7ee057d408b05a1fadaa344abfc2d5d0945e3a24 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Wed, 23 Mar 2011 15:36:07 +0100 Subject: DEV300 --- solenv/inc/minor.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 19b8ca8eed4e..7cd8c89ac8f3 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=300 -RSCREVISION=300m103(Build:9578) -BUILD=9578 -LAST_MINOR=m103 +RSCREVISION=300m104(Build:9579) +BUILD=9579 +LAST_MINOR=m104 SOURCEVERSION=DEV300 -- cgit From 9823cbf7faac2ef54b29e453a8fd03bb7d987c6b Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 24 Mar 2011 11:13:10 +0100 Subject: #i10000# fix for Solaris warnings --- connectivity/source/commontools/FValue.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 5ea0e601a9c3..6f65547736d9 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -795,7 +795,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const case DataType::DOUBLE: case DataType::REAL: return getDouble() == _rRH.getDouble(); - break; default: switch(_rRH.m_eTypeKind) { @@ -803,7 +802,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const case DataType::DOUBLE: case DataType::REAL: return getDouble() == _rRH.getDouble(); - break; default: break; } @@ -827,7 +825,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const ::rtl::OUString aVal1(m_aValue.m_pString); ::rtl::OUString aVal2(_rRH.m_aValue.m_pString); return aVal1 == aVal2; - break; } default: if ( m_bSigned != _rRH.m_bSigned ) -- cgit