unochart.cxx (9f813b30) | unochart.cxx (de739a45) |
---|---|
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 --- 1111 unchanged lines hidden (view full) --- 1120 uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS ); 1121 sal_Int32 *pSequenceMapping = aSequenceMapping.getArray(); 1122 1123 String aCellRanges; 1124 sal_Int16 nDtaSrcIsColumns = -1;// -1: don't know yet, 0: false, 1: true -2: neither 1125 sal_Int32 nLabelSeqLen = -1; // used to see if labels are always used or not and have 1126 // the expected size of 1 (i.e. if FirstCellAsLabel can 1127 // be determined) | 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 --- 1111 unchanged lines hidden (view full) --- 1120 uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS ); 1121 sal_Int32 *pSequenceMapping = aSequenceMapping.getArray(); 1122 1123 String aCellRanges; 1124 sal_Int16 nDtaSrcIsColumns = -1;// -1: don't know yet, 0: false, 1: true -2: neither 1125 sal_Int32 nLabelSeqLen = -1; // used to see if labels are always used or not and have 1126 // the expected size of 1 (i.e. if FirstCellAsLabel can 1127 // be determined) |
1128 // -1: don't know yet, 0: not used, 1: always a single labe cell, ... | 1128 // -1: don't know yet, 0: not used, 1: always a single label cell, ... |
1129 // -2: neither/failed 1130// sal_Int32 nValuesSeqLen = -1; // used to see if all value sequences have the same size 1131 for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1) 1132 { 1133 uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] ); 1134 if( !xLabeledDataSequence.is() ) 1135 { 1136 DBG_ERROR("got NULL for XLabeledDataSequence from Data source"); --- 56 unchanged lines hidden (view full) --- 1193 // 1194 sal_Int16 nDirection = -1; // -1: not yet set, 0: columns, 1: rows, -2: failed 1195 if (nFirstCol == nLastCol && nFirstRow == nLastRow) // a single cell... 1196 { 1197 DBG_ASSERT( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1, 1198 "trying to determine 'DataRowSource': something's fishy... should have been a single cell"); 1199 nDirection = 0; // default direction for a single cell should be 'columns' 1200 } | 1129 // -2: neither/failed 1130// sal_Int32 nValuesSeqLen = -1; // used to see if all value sequences have the same size 1131 for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1) 1132 { 1133 uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] ); 1134 if( !xLabeledDataSequence.is() ) 1135 { 1136 DBG_ERROR("got NULL for XLabeledDataSequence from Data source"); --- 56 unchanged lines hidden (view full) --- 1193 // 1194 sal_Int16 nDirection = -1; // -1: not yet set, 0: columns, 1: rows, -2: failed 1195 if (nFirstCol == nLastCol && nFirstRow == nLastRow) // a single cell... 1196 { 1197 DBG_ASSERT( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1, 1198 "trying to determine 'DataRowSource': something's fishy... should have been a single cell"); 1199 nDirection = 0; // default direction for a single cell should be 'columns' 1200 } |
1201 else // more than one cell is availabale (in values and label together!) | 1201 else // more than one cell is available (in values and label together!) |
1202 { 1203 if (nFirstCol == nLastCol && nFirstRow != nLastRow) 1204 nDirection = 1; 1205 else if (nFirstCol != nLastCol && nFirstRow == nLastRow) 1206 nDirection = 0; 1207 else 1208 { 1209 DBG_ERROR( "trying to determine 'DataRowSource': unexpected case found" ); --- 518 unchanged lines hidden (view full) --- 1728 } 1729} 1730 1731 1732//////////////////////////////////////// 1733// SwChartDataProvider::AddRowCols tries to notify charts of added columns 1734// or rows and extends the value sequence respectively (if possible). 1735// If those can be added to the end of existing value data-sequences those | 1202 { 1203 if (nFirstCol == nLastCol && nFirstRow != nLastRow) 1204 nDirection = 1; 1205 else if (nFirstCol != nLastCol && nFirstRow == nLastRow) 1206 nDirection = 0; 1207 else 1208 { 1209 DBG_ERROR( "trying to determine 'DataRowSource': unexpected case found" ); --- 518 unchanged lines hidden (view full) --- 1728 } 1729} 1730 1731 1732//////////////////////////////////////// 1733// SwChartDataProvider::AddRowCols tries to notify charts of added columns 1734// or rows and extends the value sequence respectively (if possible). 1735// If those can be added to the end of existing value data-sequences those |
1736// sequences get mofdified accordingly and will send a modification | 1736// sequences get modified accordingly and will send a modification |
1737// notification (calling 'setModified'). 1738// 1739// Since this function is a work-around for non existent Writer core functionality 1740// (no arbitrary multi-selection in tables that can be used to define a 1741// data-sequence) this function will be somewhat unreliable. 1742// For example we will only try to adapt value sequences. For this we assume 1743// that a sequence of length 1 is a label sequence and those with length >= 2 1744// we presume to be value sequences. Also new cells can only be added in the --- 103 unchanged lines hidden (view full) --- 1848{ 1849 vos::OGuard aGuard( Application::GetSolarMutex() ); 1850 if (bDisposed) 1851 throw lang::DisposedException(); 1852 1853 String aRes; 1854 String aRangeRepresentation( rRangeRepresentation ); 1855 | 1737// notification (calling 'setModified'). 1738// 1739// Since this function is a work-around for non existent Writer core functionality 1740// (no arbitrary multi-selection in tables that can be used to define a 1741// data-sequence) this function will be somewhat unreliable. 1742// For example we will only try to adapt value sequences. For this we assume 1743// that a sequence of length 1 is a label sequence and those with length >= 2 1744// we presume to be value sequences. Also new cells can only be added in the --- 103 unchanged lines hidden (view full) --- 1848{ 1849 vos::OGuard aGuard( Application::GetSolarMutex() ); 1850 if (bDisposed) 1851 throw lang::DisposedException(); 1852 1853 String aRes; 1854 String aRangeRepresentation( rRangeRepresentation ); 1855 |
1856 // multiple ranges are delimeted by a ';' like in | 1856 // multiple ranges are delimited by a ';' like in |
1857 // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges! 1858 xub_StrLen nNumRanges = aRangeRepresentation.GetTokenCount( ';' ); 1859 SwTable* pFirstFoundTable = 0; // to check that only one table will be used 1860 for (sal_uInt16 i = 0; i < nNumRanges; ++i) 1861 { 1862 String aRange( aRangeRepresentation.GetToken(i, ';') ); 1863 SwFrmFmt *pTblFmt = 0; // pointer to table format 1864 // BM: For what should the check be necessary? for #i79009# it is required that NO check is done --- 38 unchanged lines hidden (view full) --- 1903 if (nCol < 0 || nRow < 0) 1904 throw uno::RuntimeException(); 1905 1906 aCellRange.aLowerRight.nColumn = nCol; 1907 aCellRange.aLowerRight.nRow = nRow; 1908 aCellRange.aLowerRight.bIsEmpty = false; 1909 } 1910 String aTmp( XMLRangeHelper::getXMLStringFromCellRange( aCellRange ) ); | 1857 // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges! 1858 xub_StrLen nNumRanges = aRangeRepresentation.GetTokenCount( ';' ); 1859 SwTable* pFirstFoundTable = 0; // to check that only one table will be used 1860 for (sal_uInt16 i = 0; i < nNumRanges; ++i) 1861 { 1862 String aRange( aRangeRepresentation.GetToken(i, ';') ); 1863 SwFrmFmt *pTblFmt = 0; // pointer to table format 1864 // BM: For what should the check be necessary? for #i79009# it is required that NO check is done --- 38 unchanged lines hidden (view full) --- 1903 if (nCol < 0 || nRow < 0) 1904 throw uno::RuntimeException(); 1905 1906 aCellRange.aLowerRight.nColumn = nCol; 1907 aCellRange.aLowerRight.nRow = nRow; 1908 aCellRange.aLowerRight.bIsEmpty = false; 1909 } 1910 String aTmp( XMLRangeHelper::getXMLStringFromCellRange( aCellRange ) ); |
1911 if (aRes.Len()) // in case of multiple ranges add delimeter | 1911 if (aRes.Len()) // in case of multiple ranges add delimiter |
1912 aRes.AppendAscii( " " ); 1913 aRes += aTmp; 1914 } 1915 1916 return aRes; 1917} 1918 1919rtl::OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const rtl::OUString& rXMLRange ) 1920 throw ( uno::RuntimeException, lang::IllegalArgumentException ) 1921{ 1922 vos::OGuard aGuard( Application::GetSolarMutex() ); 1923 if (bDisposed) 1924 throw lang::DisposedException(); 1925 1926 String aRes; 1927 String aXMLRange( rXMLRange ); 1928 | 1912 aRes.AppendAscii( " " ); 1913 aRes += aTmp; 1914 } 1915 1916 return aRes; 1917} 1918 1919rtl::OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const rtl::OUString& rXMLRange ) 1920 throw ( uno::RuntimeException, lang::IllegalArgumentException ) 1921{ 1922 vos::OGuard aGuard( Application::GetSolarMutex() ); 1923 if (bDisposed) 1924 throw lang::DisposedException(); 1925 1926 String aRes; 1927 String aXMLRange( rXMLRange ); 1928 |
1929 // multiple ranges are delimeted by a ' ' like in | 1929 // multiple ranges are delimited by a ' ' like in |
1930 // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges! 1931 xub_StrLen nNumRanges = aXMLRange.GetTokenCount( ' ' ); 1932 rtl::OUString aFirstFoundTable; // to check that only one table will be used 1933 for (sal_uInt16 i = 0; i < nNumRanges; ++i) 1934 { 1935 String aRange( aXMLRange.GetToken(i, ' ') ); 1936 1937 //!! following objects and function are implemented in XMLRangeHelper.?xx --- 13 unchanged lines hidden (view full) --- 1951 // does cell range consist of more than a single cell? 1952 if (!aCellRange.aLowerRight.bIsEmpty) 1953 { 1954 aTmp += OUString::valueOf((sal_Unicode) ':'); 1955 aTmp += lcl_GetCellName( aCellRange.aLowerRight.nColumn, 1956 aCellRange.aLowerRight.nRow ); 1957 } 1958 | 1930 // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges! 1931 xub_StrLen nNumRanges = aXMLRange.GetTokenCount( ' ' ); 1932 rtl::OUString aFirstFoundTable; // to check that only one table will be used 1933 for (sal_uInt16 i = 0; i < nNumRanges; ++i) 1934 { 1935 String aRange( aXMLRange.GetToken(i, ' ') ); 1936 1937 //!! following objects and function are implemented in XMLRangeHelper.?xx --- 13 unchanged lines hidden (view full) --- 1951 // does cell range consist of more than a single cell? 1952 if (!aCellRange.aLowerRight.bIsEmpty) 1953 { 1954 aTmp += OUString::valueOf((sal_Unicode) ':'); 1955 aTmp += lcl_GetCellName( aCellRange.aLowerRight.nColumn, 1956 aCellRange.aLowerRight.nRow ); 1957 } 1958 |
1959 if (aRes.Len()) // in case of multiple ranges add delimeter | 1959 if (aRes.Len()) // in case of multiple ranges add delimiter |
1960 aRes.AppendAscii( ";" ); 1961 aRes += String(aTmp); 1962 } 1963 1964 return aRes; 1965} 1966 1967 --- 247 unchanged lines hidden (view full) --- 2215 SwTable* pTable = pTblFmt ? SwTable::FindTable( pTblFmt ) : 0; 2216 if (!pTblFmt || !pTable || pTable->IsTblComplex()) 2217 throw uno::RuntimeException(); 2218 else 2219 { 2220 String aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) ); 2221 DBG_ASSERT( aCellRange.Len() != 0, "failed to get cell range" ); 2222 bOk = FillRangeDescriptor( aDesc, aCellRange ); | 1960 aRes.AppendAscii( ";" ); 1961 aRes += String(aTmp); 1962 } 1963 1964 return aRes; 1965} 1966 1967 --- 247 unchanged lines hidden (view full) --- 2215 SwTable* pTable = pTblFmt ? SwTable::FindTable( pTblFmt ) : 0; 2216 if (!pTblFmt || !pTable || pTable->IsTblComplex()) 2217 throw uno::RuntimeException(); 2218 else 2219 { 2220 String aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) ); 2221 DBG_ASSERT( aCellRange.Len() != 0, "failed to get cell range" ); 2222 bOk = FillRangeDescriptor( aDesc, aCellRange ); |
2223 DBG_ASSERT( bOk, "falied to get SwRangeDescriptor" ); | 2223 DBG_ASSERT( bOk, "failed to get SwRangeDescriptor" ); |
2224 } 2225 if (bOk) 2226 { 2227 aDesc.Normalize(); 2228 sal_Int32 nColSpan = aDesc.nRight - aDesc.nLeft + 1; 2229 sal_Int32 nRowSpan = aDesc.nBottom - aDesc.nTop + 1; 2230 DBG_ASSERT( nColSpan == 1 || nRowSpan == 1, 2231 "unexpected range of selected cells" ); --- 483 unchanged lines hidden (view full) --- 2715 nRow += bMoveUp ? -1 : +1; 2716 if (bMoveHorizontal) 2717 nCol += bMoveLeft ? -1 : +1; 2718 String aNewCellName = lcl_GetCellName( nCol, nRow ); 2719 SwTableBox* pNewBox = (SwTableBox*) pTable->GetTblBox( aNewCellName ); 2720 2721 if (pNewBox) // set new position (cell range) to use 2722 { | 2224 } 2225 if (bOk) 2226 { 2227 aDesc.Normalize(); 2228 sal_Int32 nColSpan = aDesc.nRight - aDesc.nLeft + 1; 2229 sal_Int32 nRowSpan = aDesc.nBottom - aDesc.nTop + 1; 2230 DBG_ASSERT( nColSpan == 1 || nRowSpan == 1, 2231 "unexpected range of selected cells" ); --- 483 unchanged lines hidden (view full) --- 2715 nRow += bMoveUp ? -1 : +1; 2716 if (bMoveHorizontal) 2717 nCol += bMoveLeft ? -1 : +1; 2718 String aNewCellName = lcl_GetCellName( nCol, nRow ); 2719 SwTableBox* pNewBox = (SwTableBox*) pTable->GetTblBox( aNewCellName ); 2720 2721 if (pNewBox) // set new position (cell range) to use 2722 { |
2723 // So erh�lt man den ersten Inhaltsnode in einer gegebenen Zelle: 2724 // Zun�chst einen SwNodeIndex auf den Node hinter dem SwStartNode der Box... | 2723 // So erhält man den ersten Inhaltsnode in einer gegebenen Zelle: 2724 // Zunächst einen SwNodeIndex auf den Node hinter dem SwStartNode der Box... |
2725 SwNodeIndex aIdx( *pNewBox->GetSttNd(), +1 ); 2726 // Dies kann ein SwCntntNode sein, kann aber auch ein Tabellen oder Sectionnode sein, 2727 // deshalb das GoNext; 2728 SwCntntNode *pCNd = aIdx.GetNode().GetCntntNode(); 2729 if (!pCNd) 2730 pCNd = GetFrmFmt()->GetDoc()->GetNodes().GoNext( &aIdx ); 2731 //und damit kann man z.B. eine SwPosition erzeugen: 2732 SwPosition aNewPos( *pCNd ); // new position to beused with cursor --- 383 unchanged lines hidden --- | 2725 SwNodeIndex aIdx( *pNewBox->GetSttNd(), +1 ); 2726 // Dies kann ein SwCntntNode sein, kann aber auch ein Tabellen oder Sectionnode sein, 2727 // deshalb das GoNext; 2728 SwCntntNode *pCNd = aIdx.GetNode().GetCntntNode(); 2729 if (!pCNd) 2730 pCNd = GetFrmFmt()->GetDoc()->GetNodes().GoNext( &aIdx ); 2731 //und damit kann man z.B. eine SwPosition erzeugen: 2732 SwPosition aNewPos( *pCNd ); // new position to beused with cursor --- 383 unchanged lines hidden --- |