undoutil.cxx (57b4fa3c) | undoutil.cxx (22407013) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 68 unchanged lines hidden (view full) --- 77{ 78 MarkSimpleBlock( pDocShell, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(), 79 rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab() ); 80} 81 82 83 84ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab, | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 68 unchanged lines hidden (view full) --- 77{ 78 MarkSimpleBlock( pDocShell, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(), 79 rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab() ); 80} 81 82 83 84ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab, |
85 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) | 85 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) |
86{ | 86{ |
87 ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 ); | 87 ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 ); |
88 | 88 |
89 if (!pRet) 90 { 91 sal_Bool bWasTemp = sal_False; 92 if ( pUndoData ) 93 { 94 String aName; 95 pUndoData->GetName( aName ); 96// if ( aName == ScGlobal::GetRscString( STR_DB_NONAME ) ) 97 if (pUndoData->IsBuildin()) 98 bWasTemp = sal_True; 99 } 100 DBG_ASSERT(bWasTemp, "Undo: didn't find database range"); | 89 if (!pRet) 90 { 91 bool bWasInternalUnnamed = false; 92 bool bWasInternalForAutoFilter = false; 93 if ( pUndoData ) 94 { 95 String aName; 96 pUndoData->GetName( aName ); 97 if ( pUndoData->IsInternalUnnamed() ) 98 { 99 bWasInternalUnnamed = true; 100 } 101 else if (pUndoData->IsInternalForAutoFilter()) 102 { 103 bWasInternalForAutoFilter = true; 104 } 105 } 106 DBG_ASSERT( bWasInternalUnnamed || bWasInternalForAutoFilter, "Undo: didn't find database range"); |
101 | 107 |
102 sal_uInt16 nIndex; 103 ScDBCollection* pColl = pDoc->GetDBCollection(); 104 if (pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex )) 105 pRet = (*pColl)[nIndex]; 106 else 107 { 108 String aNoNamed = pColl->GetNewDefaultDBName(); 109 pRet = new ScDBData( aNoNamed/*ScGlobal::GetRscString( STR_DB_NONAME )*/, nTab, 110 nCol1,nRow1, nCol2,nRow2, sal_True, 111 pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) ); 112 pColl->Insert( pRet ); 113 } 114 } | 108 sal_uInt16 nIndex; 109 ScDBCollection* pColl = pDoc->GetDBCollection(); 110 if ( bWasInternalUnnamed 111 && pColl->SearchName( ScGlobal::GetRscString( STR_DB_NONAME ), nIndex )) 112 { 113 pRet = (*pColl)[nIndex]; 114 } 115 else 116 { 117 String aNewNamed = bWasInternalForAutoFilter 118 ? pColl->GetNewDefaultDBName() 119 : ScGlobal::GetRscString( STR_DB_NONAME ); 120 pRet = new ScDBData( 121 aNewNamed, nTab, nCol1,nRow1, nCol2,nRow2, sal_True, 122 pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) ); 123 pColl->Insert( pRet ); 124 } 125 } |
115 | 126 |
116 return pRet; | 127 return pRet; |
117} 118 119 120void ScUndoUtil::PaintMore( ScDocShell* pDocShell, 121 const ScRange& rRange ) 122{ 123 SCCOL nCol1 = rRange.aStart.Col(); 124 SCROW nRow1 = rRange.aStart.Row(); 125 SCCOL nCol2 = rRange.aEnd.Col(); 126 SCROW nRow2 = rRange.aEnd.Row(); 127 if (nCol1 > 0) --nCol1; 128 if (nRow1 > 0) --nRow1; 129 if (nCol2<MAXCOL) ++nCol2; 130 if (nRow2<MAXROW) ++nRow2; 131 132 pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(), 133 nCol2,nRow2,rRange.aEnd.Tab(), PAINT_GRID ); 134} | 128} 129 130 131void ScUndoUtil::PaintMore( ScDocShell* pDocShell, 132 const ScRange& rRange ) 133{ 134 SCCOL nCol1 = rRange.aStart.Col(); 135 SCROW nRow1 = rRange.aStart.Row(); 136 SCCOL nCol2 = rRange.aEnd.Col(); 137 SCROW nRow2 = rRange.aEnd.Row(); 138 if (nCol1 > 0) --nCol1; 139 if (nRow1 > 0) --nRow1; 140 if (nCol2<MAXCOL) ++nCol2; 141 if (nRow2<MAXROW) ++nRow2; 142 143 pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(), 144 nCol2,nRow2,rRange.aEnd.Tab(), PAINT_GRID ); 145} |