Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d9199f10
Kaydet (Commit)
d9199f10
authored
Şub 03, 2003
tarafından
Stephan Wunderlich
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
new: initial version
üst
73ddcdc6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
272 additions
and
0 deletions
+272
-0
ScIndexEnumeration_TableChartsEnumeration.java
...va/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java
+272
-0
No files found.
qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java
0 → 100644
Dosyayı görüntüle @
d9199f10
/*************************************************************************
*
* $RCSfile: ScIndexEnumeration_TableChartsEnumeration.java,v $
*
* $Revision: 1.1 $
*
* last change:$Date: 2003-02-03 16:38:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
package
mod
.
_sc
;
import
com.sun.star.awt.Rectangle
;
import
com.sun.star.container.XIndexAccess
;
import
com.sun.star.container.XEnumerationAccess
;
import
com.sun.star.lang.XComponent
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.sheet.XCellRangeAddressable
;
import
com.sun.star.sheet.XSpreadsheet
;
import
com.sun.star.sheet.XSpreadsheetDocument
;
import
com.sun.star.sheet.XSpreadsheets
;
import
com.sun.star.table.CellRangeAddress
;
import
com.sun.star.table.XCell
;
import
com.sun.star.table.XCellRange
;
import
com.sun.star.table.XTableChart
;
import
com.sun.star.table.XTableCharts
;
import
com.sun.star.table.XTableChartsSupplier
;
import
com.sun.star.uno.UnoRuntime
;
import
java.io.PrintWriter
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.SOfficeFactory
;
import
com.sun.star.uno.AnyConverter
;
import
com.sun.star.uno.Type
;
public
class
ScIndexEnumeration_TableChartsEnumeration
extends
TestCase
{
XSpreadsheetDocument
xSheetDoc
=
null
;
/**
* Creates Spreadsheet document.
*/
protected
void
initialize
(
TestParameters
tParam
,
PrintWriter
log
)
{
// get a soffice factory object
SOfficeFactory
SOF
=
SOfficeFactory
.
getFactory
(
tParam
.
getMSF
());
try
{
log
.
println
(
"creating a sheetdocument"
);
xSheetDoc
=
SOF
.
createCalcDoc
(
null
);;
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
// Some exception occures.FAILED
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't create document"
,
e
);
}
}
/**
* Disposes Spreadsheet document.
*/
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
" disposing xSheetDoc "
);
XComponent
oComp
=
(
XComponent
)
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xSheetDoc
);
oComp
.
dispose
();
}
protected
synchronized
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
PrintWriter
log
)
{
XSpreadsheet
oSheet
=
null
;
try
{
System
.
out
.
println
(
"Getting spreadsheet"
)
;
XSpreadsheets
oSheets
=
xSheetDoc
.
getSheets
()
;
XIndexAccess
oIndexSheets
=
(
XIndexAccess
)
UnoRuntime
.
queryInterface
(
XIndexAccess
.
class
,
oSheets
);
oSheet
=
(
XSpreadsheet
)
AnyConverter
.
toObject
(
new
Type
(
XSpreadsheet
.
class
),
oIndexSheets
.
getByIndex
(
0
));
}
catch
(
com
.
sun
.
star
.
lang
.
WrappedTargetException
e
)
{
log
.
println
(
"Couldn't get Sheet "
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't get sheet"
,
e
);
}
catch
(
com
.
sun
.
star
.
lang
.
IndexOutOfBoundsException
e
)
{
log
.
println
(
"Couldn't get Sheet "
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't get sheet"
,
e
);
}
catch
(
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e
)
{
log
.
println
(
"Couldn't get Sheet "
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't get sheet"
,
e
);
}
log
.
println
(
"Creating the Header"
)
;
insertIntoCell
(
1
,
0
,
"JAN"
,
oSheet
,
""
);
insertIntoCell
(
2
,
0
,
"FEB"
,
oSheet
,
""
);
insertIntoCell
(
3
,
0
,
"MAR"
,
oSheet
,
""
);
insertIntoCell
(
4
,
0
,
"APR"
,
oSheet
,
""
);
insertIntoCell
(
5
,
0
,
"MAI"
,
oSheet
,
""
);
insertIntoCell
(
6
,
0
,
"JUN"
,
oSheet
,
""
);
insertIntoCell
(
7
,
0
,
"JUL"
,
oSheet
,
""
);
insertIntoCell
(
8
,
0
,
"AUG"
,
oSheet
,
""
);
insertIntoCell
(
9
,
0
,
"SEP"
,
oSheet
,
""
);
insertIntoCell
(
10
,
0
,
"OCT"
,
oSheet
,
""
);
insertIntoCell
(
11
,
0
,
"NOV"
,
oSheet
,
""
);
insertIntoCell
(
12
,
0
,
"DEC"
,
oSheet
,
""
);
insertIntoCell
(
13
,
0
,
"SUM"
,
oSheet
,
""
);
log
.
println
(
"Fill the lines"
);
insertIntoCell
(
0
,
1
,
"Smith"
,
oSheet
,
""
);
insertIntoCell
(
1
,
1
,
"42"
,
oSheet
,
"V"
);
insertIntoCell
(
2
,
1
,
"58.9"
,
oSheet
,
"V"
);
insertIntoCell
(
3
,
1
,
"-66.5"
,
oSheet
,
"V"
);
insertIntoCell
(
4
,
1
,
"43.4"
,
oSheet
,
"V"
);
insertIntoCell
(
5
,
1
,
"44.5"
,
oSheet
,
"V"
);
insertIntoCell
(
6
,
1
,
"45.3"
,
oSheet
,
"V"
);
insertIntoCell
(
7
,
1
,
"-67.3"
,
oSheet
,
"V"
);
insertIntoCell
(
8
,
1
,
"30.5"
,
oSheet
,
"V"
);
insertIntoCell
(
9
,
1
,
"23.2"
,
oSheet
,
"V"
);
insertIntoCell
(
10
,
1
,
"-97.3"
,
oSheet
,
"V"
);
insertIntoCell
(
11
,
1
,
"22.4"
,
oSheet
,
"V"
);
insertIntoCell
(
12
,
1
,
"23.5"
,
oSheet
,
"V"
);
insertIntoCell
(
13
,
1
,
"=SUM(B2:M2)"
,
oSheet
,
""
);
insertIntoCell
(
0
,
2
,
"Jones"
,
oSheet
,
""
);
insertIntoCell
(
1
,
2
,
"21"
,
oSheet
,
"V"
);
insertIntoCell
(
2
,
2
,
"40.9"
,
oSheet
,
"V"
);
insertIntoCell
(
3
,
2
,
"-57.5"
,
oSheet
,
"V"
);
insertIntoCell
(
4
,
2
,
"-23.4"
,
oSheet
,
"V"
);
insertIntoCell
(
5
,
2
,
"34.5"
,
oSheet
,
"V"
);
insertIntoCell
(
6
,
2
,
"59.3"
,
oSheet
,
"V"
);
insertIntoCell
(
7
,
2
,
"27.3"
,
oSheet
,
"V"
);
insertIntoCell
(
8
,
2
,
"-38.5"
,
oSheet
,
"V"
);
insertIntoCell
(
9
,
2
,
"43.2"
,
oSheet
,
"V"
);
insertIntoCell
(
10
,
2
,
"57.3"
,
oSheet
,
"V"
);
insertIntoCell
(
11
,
2
,
"25.4"
,
oSheet
,
"V"
);
insertIntoCell
(
12
,
2
,
"28.5"
,
oSheet
,
"V"
);
insertIntoCell
(
13
,
2
,
"=SUM(B3:M3)"
,
oSheet
,
""
);
insertIntoCell
(
0
,
3
,
"Brown"
,
oSheet
,
""
);
insertIntoCell
(
1
,
3
,
"31.45"
,
oSheet
,
"V"
);
insertIntoCell
(
2
,
3
,
"-20.9"
,
oSheet
,
"V"
);
insertIntoCell
(
3
,
3
,
"-117.5"
,
oSheet
,
"V"
);
insertIntoCell
(
4
,
3
,
"23.4"
,
oSheet
,
"V"
);
insertIntoCell
(
5
,
3
,
"-114.5"
,
oSheet
,
"V"
);
insertIntoCell
(
6
,
3
,
"115.3"
,
oSheet
,
"V"
);
insertIntoCell
(
7
,
3
,
"-171.3"
,
oSheet
,
"V"
);
insertIntoCell
(
8
,
3
,
"89.5"
,
oSheet
,
"V"
);
insertIntoCell
(
9
,
3
,
"41.2"
,
oSheet
,
"V"
);
insertIntoCell
(
10
,
3
,
"71.3"
,
oSheet
,
"V"
);
insertIntoCell
(
11
,
3
,
"25.4"
,
oSheet
,
"V"
);
insertIntoCell
(
12
,
3
,
"38.5"
,
oSheet
,
"V"
);
insertIntoCell
(
13
,
3
,
"=SUM(A4:L4)"
,
oSheet
,
""
);
// insert a chart
Rectangle
oRect
=
new
Rectangle
(
500
,
3000
,
25000
,
11000
);
XCellRange
oRange
=
(
XCellRange
)
UnoRuntime
.
queryInterface
(
XCellRange
.
class
,
oSheet
);
XCellRange
myRange
=
oRange
.
getCellRangeByName
(
"A1:N4"
);
XCellRangeAddressable
oRangeAddr
=
(
XCellRangeAddressable
)
UnoRuntime
.
queryInterface
(
XCellRangeAddressable
.
class
,
myRange
);
CellRangeAddress
myAddr
=
oRangeAddr
.
getRangeAddress
();
CellRangeAddress
[]
oAddr
=
new
CellRangeAddress
[
1
];
oAddr
[
0
]
=
myAddr
;
XTableChartsSupplier
oSupp
=
(
XTableChartsSupplier
)
UnoRuntime
.
queryInterface
(
XTableChartsSupplier
.
class
,
oSheet
);
XTableChart
oChart
=
null
;
log
.
println
(
"Insert Chart"
);
XTableCharts
oCharts
=
oSupp
.
getCharts
();
oCharts
.
addNewByName
(
"ScChartObj"
,
oRect
,
oAddr
,
true
,
true
);
log
.
println
(
"creating a new environment for object"
);
XEnumerationAccess
ea
=
(
XEnumerationAccess
)
UnoRuntime
.
queryInterface
(
XEnumerationAccess
.
class
,
oCharts
);
XInterface
oObj
=
ea
.
createEnumeration
();
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
// tEnv.addObjRelation("RECT", oRect);
// tEnv.addObjRelation("ADDR", oAddr);
return
tEnv
;
}
/**
* Inserts a value or a formula in the cell of the spreasheet.
* @param CellX is the column index of the cell
* @param CellY is the row index of the cell
* @param theValue string representation of the value
* @param TT1 specify the spreadsheet, the interface
* <code>com.sun.star.sheet.XSpreadsheet</code>
* @param flag if it's equal to <code>'V'</code> then the method inserts
* a double-value in the cell else it inserts a formula in the cell
*/
public
static
void
insertIntoCell
(
int
CellX
,
int
CellY
,
String
theValue
,
XSpreadsheet
TT1
,
String
flag
)
{
XCell
oCell
=
null
;
try
{
oCell
=
TT1
.
getCellByPosition
(
CellX
,
CellY
);
}
catch
(
com
.
sun
.
star
.
lang
.
IndexOutOfBoundsException
ex
)
{
System
.
out
.
println
(
"Could not get Cell"
);
}
if
(
flag
.
equals
(
"V"
))
{
oCell
.
setValue
(
new
Float
(
theValue
).
floatValue
());
}
else
{
oCell
.
setFormula
(
theValue
);
}
}
// end of insertIntoCell
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment