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
f49575a8
Kaydet (Commit)
f49575a8
authored
Agu 21, 2002
tarafından
Juergen Schmidt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#99053# did some improvements
üst
a12ececf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
236 additions
and
287 deletions
+236
-287
Makefile
odk/examples/java/ToDo/Makefile
+30
-19
ToDo.java
odk/examples/java/ToDo/ToDo.java
+205
-267
XToDo.idl
odk/examples/java/ToDo/XToDo.idl
+1
-1
No files found.
odk/examples/java/ToDo/Makefile
Dosyayı görüntüle @
f49575a8
...
@@ -9,23 +9,26 @@ include $(SETTINGS)/dk.mk
...
@@ -9,23 +9,26 @@ include $(SETTINGS)/dk.mk
include
$(SETTINGS)/std.mk
include
$(SETTINGS)/std.mk
# Define non-platform/compiler specific settings
# Define non-platform/compiler specific settings
COMPONENT_NAME
=
ToDo
REGISTERFLAG
=
$(OUT_MISC)$(PS)
todo_register_component.flag
OUT_COMPONENT
=
$(OUT_CLASS)$(PS)$(COMPONENT_NAME)
COMPONENTJARFLAG
=
$(OUT_MISC)$(PS)
todo_create_component_jar.flag
COMPONENT_RDB_NAME
=
$(COMPONENT_NAME)
.rdb
TYPEFLAG
=
$(OUT_MISC)$(PS)
todo_type_generation.flag
COMPONENT_RDB
=
$(OUT_BIN)$(PS)$(COMPONENT_RDB_NAME)
JAVAFLAG
=
$(OUT_MISC)$(PS)
todo_javac.flag
COMPONENT_PACKAGE_NAME
=
$(COMPONENT_NAME)
.zip
COMPONENT_PACKAGE_URL
=
$
(
subst
\\
,/,
"file:///
$(COMPONENT_PACKAGE_DIR)$(PS)$(COMPONENT_PACKAGE_NAME)
"
)
OUT_COMPONENT
=
$(OUT_CLASS)$(PS)
todo
COMPONENT_JAR_NAME
=
$(COMPONENT_NAME)
.jar
COMPONENT_RDB
=
$(OUT_BIN)$(PS)
ToDo.rdb
COMPONENT_JAR
=
$(OUT_CLASS)$(PS)$(COMPONENT_JAR_NAME)
COMPONENT_MANIFESTFILE
=
$(OUT_COMPONENT)$(PS)$(COMPONENT_NAME)
.Manifest
COMPONENT_JAR
=
$(OUT_CLASS)$(PS)
ToDo.jar
COMPONENT_MANIFESTFILE
=
Manifest
REGISTERFLAG
=
$(OUT_MISC)$(PS)$(COMPONENT_NAME)
_register_component.flag
COMPONENTJARFLAG
=
$(OUT_MISC)$(PS)$(COMPONENT_NAME)
_create_component_jar.flag
TYPEFLAG
=
$(OUT_MISC)$(PS)$(COMPONENT_NAME)
_type_generation.flag
JAVAFLAG
=
$(OUT_MISC)$(PS)$(COMPONENT_NAME)
_javac.flag
IDLFILES
=
XToDo.idl
IDLFILES
=
XToDo.idl
# normally the idl file should be stored in a directory tree fitting the module structure,
# normally the idl file should be stored in a directory tree fitting the module structure,
# for the example we know the module structure
# for the example we know the module structure
PACKAGE
=
org
$(PS)
OpenO
ffice
PACKAGE
=
org
$(PS)
openo
ffice
JAVAFILES
=
ToDo.java
JAVAFILES
=
ToDo.java
...
@@ -35,6 +38,8 @@ GENURDFILES = $(subst \\,\,$(patsubst %.idl,$(OUT_MISC)$(PS)%.urd,$(IDLFILES)))
...
@@ -35,6 +38,8 @@ GENURDFILES = $(subst \\,\,$(patsubst %.idl,$(OUT_MISC)$(PS)%.urd,$(IDLFILES)))
CLASSFILES
=
$
(
patsubst %.java,
$(OUT_COMPONENT)$(PS)
%.class,
$(JAVAFILES)
)
CLASSFILES
=
$
(
patsubst %.java,
$(OUT_COMPONENT)$(PS)
%.class,
$(JAVAFILES)
)
CLASSFILES
+=
$
(
patsubst %.java,
$(OUT_COMPONENT)$(PS)$(PACKAGE)$(PS)
%.class,
$(GENJAVAFILES)
)
CLASSFILES
+=
$
(
patsubst %.java,
$(OUT_COMPONENT)$(PS)$(PACKAGE)$(PS)
%.class,
$(GENJAVAFILES)
)
COMPONENT_CLASSFILES
=
$(COMPONENT_NAME)
.class
$(COMPONENT_NAME)$$$(COMPONENT_NAME)
Implementation.class
COMPONENT_CLASSFILES
+=
$
(
subst
$(OUT_MISC)$(PS)
,,
$
(
GENJAVAFILES:.java
=
.class
))
SDK_CLASSPATH
=
$
(
subst
$(EMPTYSTRING)
$(PATH_SEPARATOR)
,
$(PATH_SEPARATOR)
,
$(OFFICE_CLASSES_DIR)$(PS)
jurt.jar
\
SDK_CLASSPATH
=
$
(
subst
$(EMPTYSTRING)
$(PATH_SEPARATOR)
,
$(PATH_SEPARATOR)
,
$(OFFICE_CLASSES_DIR)$(PS)
jurt.jar
\
$(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)$(PS)
unoil.jar
\
$(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)$(PS)
unoil.jar
\
...
@@ -57,27 +62,33 @@ include $(SETTINGS)/stdtarget.mk
...
@@ -57,27 +62,33 @@ include $(SETTINGS)/stdtarget.mk
$(OUT_COMPONENT)
:
$(OUT) $(OUT_CLASS)
$(OUT_COMPONENT)
:
$(OUT) $(OUT_CLASS)
$(MKDIR)
$@
$(MKDIR)
$@
$(OUT_COMPONENT)$(PS)$(COMPONENT_NAME).Manifest
:
$(OUT_COMPONENT)
@
echo
RegistrationClassName:
$(COMPONENT_NAME)
>
$@
$(TYPEFLAG)
:
$(IDLFILES)
$(TYPEFLAG)
:
$(IDLFILES)
$(BIN_DIR)$(PS)
idlc
-I
.
-I
$(IDL_DIR)
-O
$(OUT_MISC)
$^
$(BIN_DIR)$(PS)
idlc
-I
.
-I
$(IDL_DIR)
-O
$(OUT_MISC)
$^
$(BIN_DIR)$(PS)
regmerge
$(COMPONENT_RDB)
/UCR
$(GENURDFILES)
$(BIN_DIR)$(PS)
regmerge
$(COMPONENT_RDB)
/UCR
$(GENURDFILES)
$(BIN_DIR)$(PS)
regmerge
$(COMPONENT_RDB)
/
$(DKREGISTRYNAME)
#
$(BIN_DIR)$(PS)regmerge $(COMPONENT_RDB) / $(DKREGISTRYNAME)
$(BIN_DIR)$(PS)
javamaker
-BUCR
-Torg
.
OpenOffice.XToDo
-O
$(OUT_MISC)
$(COMPONENT_RDB
)
$(BIN_DIR)$(PS)javamaker
-BUCR
-Torg.
openoffice.XToDo
-O$(OUT_MISC)
$(COMPONENT_RDB)
$(DKREGISTRYNAME
)
@echo
bla
>
$@
@echo
bla
>
$@
$(JAVAFLAG)
:
$(OUT_COMPONENT) $(TYPEFLAG) $(JAVAFILES)
$(JAVAFLAG)
:
$(OUT_COMPONENT) $(TYPEFLAG) $(JAVAFILES)
javac
-classpath
"
$(SDK_CLASSPATH)
"
-d
$(OUT_COMPONENT)
$(GENJAVAFILES)
$(JAVAFILES)
javac
-classpath
"
$(SDK_CLASSPATH)
"
-d
$(OUT_COMPONENT)
$(GENJAVAFILES)
$(JAVAFILES)
@
echo
bla
>
$@
@
echo
bla
>
$@
$(COMPONENTJARFLAG)
:
$(JAVAFLAG)
$(COMPONENTJARFLAG)
:
$(COMPONENT_MANIFESTFILE) $(JAVAFLAG)
jar cvfm
$(COMPONENT_JAR)
$(COMPONENT_MANIFESTFILE)
-C
$(OUT_COMPONENT)
.
# jar cvfm $(COMPONENT_JAR) $(COMPONENT_MANIFESTFILE) -C $(OUT_COMPONENT) .
cd
$(OUT_COMPONENT)
&&
jar
cvfm
$(COMPONENT_JAR)
$(COMPONENT_MANIFESTFILE)
$(COMPONENT_CLASSFILES)
$(COPY)
$(COMPONENT_JAR)
$(OUT_BIN)
cd
$(OUT_BIN)
&&
jar
cvfM
$(COMPONENT_PACKAGE_NAME)
$(COMPONENT_JAR_NAME)
$(COMPONENT_RDB_NAME)
$(DEL)
$(OUT_BIN)$(PS)$(COMPONENT_JAR_NAME)
-$(DEL)
$(REGISTERFLAG)
-$(DEL)
$(REGISTERFLAG)
@echo
$(COMPONENT_PACKAGE_URL)
@echo
bla
>
$@
@echo
bla
>
$@
$(REGISTERFLAG)
:
$(COMPONENTJARFLAG)
$(REGISTERFLAG)
:
$(COMPONENTJARFLAG)
ifneq
"$(SDK_AUTO_DEPLOYMENT)"
""
ifneq
"$(SDK_AUTO_DEPLOYMENT)"
""
$(BIN_DIR)$(PS)regmerge
"$(URLPREFIX)$(OFFICE_FILEURL)/applicat.rdb"
/UCR
$(GENURDFILES)
cd
$(OFFICE_PROGRAM_PATH)
&&
pkgchk
$(COMPONENT_PACKAGE_URL)
$(COPY)
$(COMPONENT_JAR)
"$(OFFICE_CLASSES_DIR)"
java
-classpath
"$(SDK_CLASSPATH)"
com.sun.star.tools.uno.RegComp
"$(URLPREFIX)$(OFFICE_FILEURL)/applicat.rdb"
register
"$(URLPREFIX)$(OFFICE_FILEURL)/classes/ToDo.jar"
com.sun.star.loader.Java2
@echo
bla
>
$@
@echo
bla
>
$@
else
else
@echo
--------------------------------------------------------------------------------
@echo
--------------------------------------------------------------------------------
...
...
odk/examples/java/ToDo/ToDo.java
Dosyayı görüntüle @
f49575a8
import
com.sun.star.comp.loader.FactoryHelper
;
import
com.sun.star.comp.loader.FactoryHelper
;
import
com.sun.star.lang.XInitialization
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.lang.XServiceInfo
;
import
com.sun.star.lang.XSingleServiceFactory
;
import
com.sun.star.lang.XSingleServiceFactory
;
import
com.sun.star.lang.XTypeProvider
;
import
com.sun.star.lang.XTypeProvider
;
import
com.sun.star.lib.uno.helper.WeakBase
;
import
com.sun.star.registry.XRegistryKey
;
import
com.sun.star.registry.XRegistryKey
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XWeak
;
import
org.openoffice.*
;
// addintional interfaces used by the implementation
import
com.sun.star.sheet.XSpreadsheetDocument
;
import
com.sun.star.sheet.XSpreadsheetDocument
;
import
com.sun.star.sheet.XSpreadsheet
;
import
com.sun.star.sheet.XSpreadsheet
;
import
com.sun.star.sheet.XCellRangeMovement
;
import
com.sun.star.sheet.XCellRangeMovement
;
...
@@ -23,32 +30,77 @@ import com.sun.star.text.XTextCursor;
...
@@ -23,32 +30,77 @@ import com.sun.star.text.XTextCursor;
import
com.sun.star.text.XText
;
import
com.sun.star.text.XText
;
import
com.sun.star.text.XTextField
;
import
com.sun.star.text.XTextField
;
// ONLY FOR TESTING BEGIN
//import com.sun.star.container.XSet;
//import org.OpenOffice.XInstanceInspector;
// ONLY FOR TESTING END
import
java.util.GregorianCalendar
;
import
java.util.GregorianCalendar
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Vector
;
import
java.util.Vector
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.OpenOffice.XToDo
;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>) and a
/** This outer class provides an inner class to implement the service
* method, that writes the information into the given registry key
* description, a method to instantiate the
* (<CODE>__writeRegistryServiceInfo</CODE>).
* component on demand (__getServiceFactory()), and a method to give
* information about the component (__writeRegistryServiceInfo()).
* @author Bertram Nolte
*/
*/
public
class
ToDo
{
public
class
ToDo
{
/** This inner class provides the component as a concrete implementation
* of the service description. It implements the needed interfaces.
/** Gives a factory for creating the service.
* @implements XToDo
* This method is called by the <code>JavaLoader</code>
* <p>
* @return Returns a <code>XSingleServiceFactory</code> for creating the
* component.
* @see com.sun.star.comp.loader.JavaLoader#
* @param stringImplementationName The implementation name of the component.
* @param xmultiservicefactory The service manager, who gives access to every
* known service.
* @param xregistrykey Makes structural information (except regarding tree
* structures) of a single
* registry key accessible.
*/
public
static
XSingleServiceFactory
__getServiceFactory
(
String
stringImplementationName
,
XMultiServiceFactory
xmultiservicefactory
,
XRegistryKey
xregistrykey
)
{
XSingleServiceFactory
xsingleservicefactory
=
null
;
if
(
stringImplementationName
.
equals
(
ToDoImplementation
.
class
.
getName
()
)
)
xsingleservicefactory
=
FactoryHelper
.
getServiceFactory
(
ToDoImplementation
.
class
,
ToDoImplementation
.
__serviceName
,
xmultiservicefactory
,
xregistrykey
);
return
xsingleservicefactory
;
}
/** Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>.
* @return returns true if the operation succeeded
* @see com.sun.star.comp.loader.JavaLoader#
* @param xregistrykey Makes structural information (except regarding tree
* structures) of a single
* registry key accessible.
*/
public
static
boolean
__writeRegistryServiceInfo
(
XRegistryKey
xregistrykey
)
{
return
FactoryHelper
.
writeRegistryServiceInfo
(
ToDoImplementation
.
class
.
getName
(),
ToDoImplementation
.
__serviceName
,
xregistrykey
);
}
/** This class implements the component. At least the interfaces
* XInterface, XTypeProvider, and XWeak implemented by the helper class
* WeakBase and XServiceInfo should be provided by the service.
*/
public
static
class
ToDoImplementation
extends
WeakBase
implements
XServiceInfo
,
XToDo
{
/** The service name, that must be used to get an instance of this service.
*/
*/
static
public
class
_ToDo
implements
XToDo
,
XTypeProvider
{
private
static
final
String
__serviceName
=
"org.openoffice.ToDo"
;
static
private
final
String
__serviceName
=
"org.OpenOffice.ToDo"
;
/** The service manager, that gives access to all registered services.
*/
private
XMultiServiceFactory
xmultiservicefactory
;
// Implementation helper variables
static
private
final
int
INT_COLUMN_FEATURE
=
0
;
static
private
final
int
INT_COLUMN_FEATURE
=
0
;
static
private
final
int
INT_COLUMN_COMMENT
=
1
;
static
private
final
int
INT_COLUMN_COMMENT
=
1
;
static
private
final
int
INT_COLUMN_NEEDEDDAYS
=
2
;
static
private
final
int
INT_COLUMN_NEEDEDDAYS
=
2
;
...
@@ -60,20 +112,75 @@ public class ToDo {
...
@@ -60,20 +112,75 @@ public class ToDo {
static
private
final
int
INT_COLUMN_STATUS
=
8
;
static
private
final
int
INT_COLUMN_STATUS
=
8
;
static
private
final
int
INT_ROW_FROM
=
8
;
static
private
final
int
INT_ROW_FROM
=
8
;
//static private final int INT_ROW_TO = 56;
static
private
final
int
INT_ROW_HOLIDAYS_START
=
3
;
static
private
final
int
INT_ROW_HOLIDAYS_START
=
3
;
static
private
final
int
INT_COLUMN_HOLIDAYS_START
=
10
;
static
private
final
int
INT_COLUMN_HOLIDAYS_START
=
10
;
static
private
final
String
STRING_SEPARATOR
=
"."
;
static
private
final
String
STRING_SEPARATOR
=
"."
;
private
XMultiServiceFactory
xmultiservicefactory
;
/** Memorizes the multi service factory.
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xMultiServiceFactory The multi service factory.
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
*/
public
_ToDo
(
XMultiServiceFactory
xMultiServiceFactory
)
{
public
ToDoImplementation
(
XMultiServiceFactory
xmultiservicefactoryInitialization
)
{
xmultiservicefactory
=
xMultiServiceFactory
;
xmultiservicefactory
=
xmultiservicefactoryInitialization
;
}
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
public
String
[]
getSupportedServiceNames
()
{
String
[]
stringSupportedServiceNames
=
new
String
[
1
];
stringSupportedServiceNames
[
0
]
=
__serviceName
;
return
(
stringSupportedServiceNames
);
}
/** This method returns true, if the given service will be
* supported by the component.
* @param stringService Service name.
* @return True, if the given service name will be supported.
*/
public
boolean
supportsService
(
String
stringService
)
{
boolean
booleanSupportsService
=
false
;
if
(
stringService
.
equals
(
__serviceName
)
)
{
booleanSupportsService
=
true
;
}
return
(
booleanSupportsService
);
}
/** Return the class name of the component.
* @return Class name of the component.
*/
public
String
getImplementationName
()
{
return
(
ToDoImplementation
.
class
.
getName
()
);
}
/** Provides a sequence of all types (usually interface types)
* provided by the object.
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
public
Type
[]
getTypes
()
{
Type
[]
typeReturn
=
{};
try
{
typeReturn
=
new
Type
[]
{
new
Type
(
XToDo
.
class
),
new
Type
(
XTypeProvider
.
class
),
new
Type
(
XServiceInfo
.
class
),
new
Type
(
XWeak
.
class
),
new
Type
(
XInterface
.
class
)
};
}
catch
(
Exception
exception
)
{
System
.
err
.
println
(
exception
);
}
return
(
typeReturn
);
}
}
/** For every bug/feature listed in a spreadsheet document this method calculates
/** For every bug/feature listed in a spreadsheet document this method calculates
...
@@ -89,7 +196,7 @@ public class ToDo {
...
@@ -89,7 +196,7 @@ public class ToDo {
* @param aInstance Spreadsheet document.
* @param aInstance Spreadsheet document.
* @throws com.sun.star.uno.RuntimeException This exception could occur at every interface method.
* @throws com.sun.star.uno.RuntimeException This exception could occur at every interface method.
*/
*/
public
void
recalc
(
Object
aInstance
)
public
void
recalc
(
java
.
lang
.
Object
aInstance
)
throws
com
.
sun
.
star
.
uno
.
RuntimeException
{
throws
com
.
sun
.
star
.
uno
.
RuntimeException
{
try
{
try
{
// Querying for the interface XSpreadsheetDocument
// Querying for the interface XSpreadsheetDocument
...
@@ -113,8 +220,7 @@ public class ToDo {
...
@@ -113,8 +220,7 @@ public class ToDo {
/* Getting the gregorian calendar with the date on which to start the
/* Getting the gregorian calendar with the date on which to start the
calculation */
calculation */
GregorianCalendar
gregoriancalendarAbsoluteStartDate
=
GregorianCalendar
gregoriancalendarAbsoluteStartDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
this
.
getStringFromCell
(
xcellrange
,
5
,
2
)
);
this
.
getStringFromCell
(
xcellrange
,
5
,
2
)
);
gregoriancalendarAbsoluteStartDate
.
add
(
Calendar
.
DATE
,
-
1
);
gregoriancalendarAbsoluteStartDate
.
add
(
Calendar
.
DATE
,
-
1
);
// Set the start date with the absolute start date
// Set the start date with the absolute start date
...
@@ -124,8 +230,7 @@ public class ToDo {
...
@@ -124,8 +230,7 @@ public class ToDo {
/* Creating the service FunctionAccess, which allows generic access to
/* Creating the service FunctionAccess, which allows generic access to
all spreadsheet functions */
all spreadsheet functions */
Object
objectFunctionAccess
=
Object
objectFunctionAccess
=
xmultiservicefactory
.
createInstance
(
xmultiservicefactory
.
createInstance
(
"com.sun.star.sheet.FunctionAccess"
);
"com.sun.star.sheet.FunctionAccess"
);
// Querying for the interface XFunctionAccess on service
// Querying for the interface XFunctionAccess on service
// FunctionAccess
// FunctionAccess
...
@@ -142,8 +247,7 @@ public class ToDo {
...
@@ -142,8 +247,7 @@ public class ToDo {
gregoriancalendarStartDate
.
get
(
Calendar
.
YEAR
)
);
gregoriancalendarStartDate
.
get
(
Calendar
.
YEAR
)
);
// Get the private holidays
// Get the private holidays
this
.
getPrivateHolidays
(
vectorHolidays
,
xcellrange
,
this
.
getPrivateHolidays
(
vectorHolidays
,
xcellrange
,
xfunctionaccess
);
xfunctionaccess
);
// Getting the object array of holidays
// Getting the object array of holidays
Object
[]
objectSortedHolidays
=
vectorHolidays
.
toArray
();
Object
[]
objectSortedHolidays
=
vectorHolidays
.
toArray
();
...
@@ -174,8 +278,7 @@ public class ToDo {
...
@@ -174,8 +278,7 @@ public class ToDo {
final
int
INT_ROW_TO
=
intRowTo
+
1
;
final
int
INT_ROW_TO
=
intRowTo
+
1
;
// Deleting cells which will be recalculated
// Deleting cells which will be recalculated
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
+
5
;
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
+
5
;
intRow
++
)
{
intRow
++
)
{
for
(
int
intColumn
=
this
.
INT_COLUMN_STARTDATE
;
for
(
int
intColumn
=
this
.
INT_COLUMN_STARTDATE
;
intColumn
<=
this
.
INT_COLUMN_END_DAY_OF_WEEK
;
intColumn
<=
this
.
INT_COLUMN_END_DAY_OF_WEEK
;
intColumn
++
)
{
intColumn
++
)
{
...
@@ -186,8 +289,7 @@ public class ToDo {
...
@@ -186,8 +289,7 @@ public class ToDo {
/* Clearing the background color of the due date cells and setting the
/* Clearing the background color of the due date cells and setting the
the hyperlink to the bugtracker */
the hyperlink to the bugtracker */
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
;
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
;
intRow
++
)
{
intRow
++
)
{
// Querying for the interface XPropertySet for the cell providing the due date
// Querying for the interface XPropertySet for the cell providing the due date
XPropertySet
xpropertyset
=
(
XPropertySet
)
XPropertySet
xpropertyset
=
(
XPropertySet
)
...
@@ -216,16 +318,15 @@ public class ToDo {
...
@@ -216,16 +318,15 @@ public class ToDo {
// Getting the bug ID from the cell
// Getting the bug ID from the cell
String
stringBugID
=
xtextrange
.
getString
();
String
stringBugID
=
xtextrange
.
getString
();
if
(
!
stringBugID
.
startsWith
(
"http://so-web1.germany.sun.com/bis/servlet/"
+
if
(
!
stringBugID
.
startsWith
(
"http://webserver2/"
+
"intray.ControlPanel?system=1&update=true&id="
)
)
{
"Bugtracker/Source/Body_ReportDetail.asp?ID="
)
)
{
String
stringBugIDLink
=
"http://so-web1.germany.sun.com/bis/servlet/"
+
String
stringBugIDLink
=
"http://webserver2/Bugtrack"
+
"intray.ControlPanel?system=1&update=true&id="
+
stringBugID
+
"er/Source/Body_ReportDetail.asp?ID="
+
stringBugID
;
"&showframeset=true"
;
// Querying for the interface XMultiServiceFactory
// Querying for the interface XMultiServiceFactory
XMultiServiceFactory
xmultiservicefactoryTextField
=
XMultiServiceFactory
xmultiservicefactoryTextField
=
(
XMultiServiceFactory
)
(
XMultiServiceFactory
)
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
aInstance
);
aInstance
);
// Creating an instance of the text field URL
// Creating an instance of the text field URL
...
@@ -243,68 +344,28 @@ public class ToDo {
...
@@ -243,68 +344,28 @@ public class ToDo {
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
xtextfield
);
xtextfield
);
/*
// ONLY FOR TESTING BEGIN
if ( ( this.INT_ROW_FROM == intRow )
|| ( ( this.INT_ROW_FROM + 1 ) == intRow ) ) {
// Querying for the interface XSet on the XMultiServiceFactory
XSet xsetMultiServiceFactory = ( XSet ) UnoRuntime.queryInterface(
XSet.class, xmultiservicefactory );
// Getting the single service factory of the instance inspector
XSingleServiceFactory xsingleservicefactoryInstanceInspector =
InstanceInspector.__getServiceFactory(
"InstanceInspector$_InstanceInspector", xmultiservicefactory, null );
// Inserting the single service factory into the multi service factory
xsetMultiServiceFactory.insert( xsingleservicefactoryInstanceInspector );
// Creating an instance of the instance inspector with arguments
Object objectInstanceInspector =
xmultiservicefactory.createInstanceWithArguments(
"org.OpenOffice.InstanceInspector",
new Object[]{ xmultiservicefactory } );
// Create a new instance inspector
XInstanceInspector xinstanceinspector = ( XInstanceInspector )
UnoRuntime.queryInterface( XInstanceInspector.class,
objectInstanceInspector );
// Inspect the calc
xinstanceinspector.inspect( xpropertysetTextField );
);
}
// ONLY FOR TESTING END
*/
// Setting the URL
// Setting the URL
xpropertysetTextField
.
setPropertyValue
(
"URL"
,
xpropertysetTextField
.
setPropertyValue
(
"URL"
,
stringBugIDLink
);
stringBugIDLink
);
// Setting the representation of the URL
// Setting the representation of the URL
xpropertysetTextField
.
setPropertyValue
(
xpropertysetTextField
.
setPropertyValue
(
"Representation"
,
stringBugID
);
"Representation"
,
stringBugID
);
// Querying for the interface XText
// Querying for the interface XText
XText
xtext
=
(
XText
)
XText
xtext
=
(
XText
)
UnoRuntime
.
queryInterface
(
XText
.
class
,
xcell
);
UnoRuntime
.
queryInterface
(
XText
.
class
,
xcell
);
// Delete cell content
// Delete cell content
xtextrange
.
setString
(
""
);
xtextrange
.
setString
(
""
);
// Inserting the text field URL to the cell
// Inserting the text field URL to the cell
xtext
.
insertTextContent
(
xtextrange
,
xtextfield
,
xtext
.
insertTextContent
(
xtextrange
,
xtextfield
,
false
);
false
);
}
}
}
}
// Processing all features/bugs in the table
// Processing all features/bugs in the table
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
;
for
(
int
intRow
=
this
.
INT_ROW_FROM
;
intRow
<
INT_ROW_TO
;
intRow
++
)
{
intRow
++
)
{
// Getting the cell of the column "Needed Days" in the current row
// Getting the cell of the column "Needed Days" in the current row
XCell
xcell
=
xcellrange
.
getCellByPosition
(
XCell
xcell
=
xcellrange
.
getCellByPosition
(
INT_COLUMN_NEEDEDDAYS
,
intRow
);
INT_COLUMN_NEEDEDDAYS
,
intRow
);
// Getting the number of needed days to perform the feature
// Getting the number of needed days to perform the feature
int
intNeededDays
=
(
int
)
Math
.
round
(
xcell
.
getValue
()
);
int
intNeededDays
=
(
int
)
Math
.
round
(
xcell
.
getValue
()
);
...
@@ -315,16 +376,14 @@ public class ToDo {
...
@@ -315,16 +376,14 @@ public class ToDo {
/* Testing if the number of needed days is greater than zero and if
/* Testing if the number of needed days is greater than zero and if
the status is not "done" */
the status is not "done" */
if
(
(
intNeededDays
>
0
)
if
(
(
intNeededDays
>
0
)
&&
!(
stringStatus
.
toLowerCase
().
trim
().
equals
(
"done"
)
)
&&
!(
stringStatus
.
toLowerCase
().
trim
().
equals
(
"done"
)
)
)
{
)
{
// Getting the start date after a specified number of workdays
// Getting the start date after a specified number of workdays
gregoriancalendarStartDate
=
this
.
getWorkday
(
gregoriancalendarStartDate
=
this
.
getWorkday
(
gregoriancalendarStartDate
,
1
,
objectHolidays
,
gregoriancalendarStartDate
,
1
,
objectHolidays
,
xfunctionaccess
);
xfunctionaccess
);
// Getting a string with the date format jjjj-mm-dd from the gregorian calendar
// Getting a string with the date format jjjj-mm-dd from the gregorian calendar
String
stringDate
=
String
stringDate
=
this
.
getStringFromGregorianCalendar
(
this
.
getStringFromGregorianCalendar
(
gregoriancalendarStartDate
);
gregoriancalendarStartDate
);
// Set the start date in the specified cell of the table
// Set the start date in the specified cell of the table
...
@@ -364,26 +423,13 @@ public class ToDo {
...
@@ -364,26 +423,13 @@ public class ToDo {
// Testing if the due date is not empty
// Testing if the due date is not empty
if
(
!
stringDueDate
.
equals
(
""
)
)
{
if
(
!
stringDueDate
.
equals
(
""
)
)
{
GregorianCalendar
gregoriancalendarDueDate
=
GregorianCalendar
gregoriancalendarDueDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
stringDueDate
);
stringDueDate
);
// Testing if the due date is before the calculated end date
// Testing if the due date is before the calculated end date
if
(
gregoriancalendarDueDate
.
before
(
if
(
gregoriancalendarDueDate
.
before
(
gregoriancalendarEndDate
)
)
{
gregoriancalendarEndDate
)
)
{
/* Getting the date when the processing of the feature/bug should
/* Getting the date when the processing of the feature/bug should
be started at the latest */
be started at the latest */
/*
GregorianCalendar
gregoriancalendarLatestDateToStart
=
// This is only a temporary fix
GregorianCalendar gregoriancalendarLatestDateToStart = ( GregorianCalendar ) gregoriancalendarDueDate.clone();
gregoriancalendarLatestDateToStart.add( Calendar.DATE, -( intNeededDays - 1 ) );
while ( ( gregoriancalendarLatestDateToStart.get( Calendar.DAY_OF_WEEK ) == 1 ) || ( gregoriancalendarLatestDateToStart.get( Calendar.DAY_OF_WEEK ) == 7 ) ) {
gregoriancalendarLatestDateToStart.add( Calendar.DATE, -1 );
}
String stringLatestDateToStart = this.getStringFromGregorianCalendar( gregoriancalendarLatestDateToStart );
*/
GregorianCalendar
gregoriancalendarLatestDateToStart
=
this
.
getWorkday
(
gregoriancalendarDueDate
,
this
.
getWorkday
(
gregoriancalendarDueDate
,
-(
intNeededDays
-
1
),
-(
intNeededDays
-
1
),
objectHolidays
,
xfunctionaccess
);
objectHolidays
,
xfunctionaccess
);
...
@@ -392,25 +438,22 @@ public class ToDo {
...
@@ -392,25 +438,22 @@ public class ToDo {
int
intRowToInsert
=
intRow
;
int
intRowToInsert
=
intRow
;
// Get the start date for the feature/bug in the current row
// Get the start date for the feature/bug in the current row
GregorianCalendar
GregorianCalendar
gregoriancalendarPreviousStartDate
=
gregoriancalendarPreviousStartDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
this
.
getStringFromCell
(
this
.
getStringFromCell
(
xcellrange
,
intRowToInsert
,
xcellrange
,
intRowToInsert
,
this
.
INT_COLUMN_STARTDATE
)
);
this
.
INT_COLUMN_STARTDATE
)
);
// Testing if we have to search for an earlier date to begin
// Testing if we have to search for an earlier date to begin
while
(
while
(
(
gregoriancalendarLatestDateToStart
.
before
(
(
gregoriancalendarLatestDateToStart
.
before
(
gregoriancalendarPreviousStartDate
)
)
&&
gregoriancalendarPreviousStartDate
)
)
&&
(
INT_ROW_FROM
!=
intRowToInsert
)
)
{
(
INT_ROW_FROM
!=
intRowToInsert
)
)
{
// Decrease the row
// Decrease the row
intRowToInsert
--;
intRowToInsert
--;
// Get the start date for the feature/bug in the current row
// Get the start date for the feature/bug in the current row
String
stringStartDate
=
String
stringStartDate
=
this
.
getStringFromCell
(
this
.
getStringFromCell
(
xcellrange
,
xcellrange
,
intRowToInsert
,
this
.
INT_COLUMN_STARTDATE
);
intRowToInsert
,
this
.
INT_COLUMN_STARTDATE
);
// Search until a valid start date is found
// Search until a valid start date is found
while
(
stringStartDate
.
equals
(
""
)
)
{
while
(
stringStartDate
.
equals
(
""
)
)
{
...
@@ -418,56 +461,44 @@ public class ToDo {
...
@@ -418,56 +461,44 @@ public class ToDo {
intRowToInsert
--;
intRowToInsert
--;
// Get the start date for the feature/bug in the current row
// Get the start date for the feature/bug in the current row
stringStartDate
=
stringStartDate
=
this
.
getStringFromCell
(
this
.
getStringFromCell
(
xcellrange
,
xcellrange
,
intRowToInsert
,
this
.
INT_COLUMN_STARTDATE
);
intRowToInsert
,
this
.
INT_COLUMN_STARTDATE
);
}
}
// Get the GregorianCalender format for the start date
// Get the GregorianCalender format for the start date
gregoriancalendarPreviousStartDate
=
gregoriancalendarPreviousStartDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
stringStartDate
);
stringStartDate
);
}
}
// Getting the cell of the column "Needed Days" in the row where to insert
// Getting the cell of the column "Needed Days" in the row where to insert
XCell
xcellNeededDaysWhereToInsert
=
XCell
xcellNeededDaysWhereToInsert
=
xcellrange
.
getCellByPosition
(
xcellrange
.
getCellByPosition
(
INT_COLUMN_NEEDEDDAYS
,
intRowToInsert
);
INT_COLUMN_NEEDEDDAYS
,
intRowToInsert
);
// Getting the number of needed days to perform the feature
// Getting the number of needed days to perform the feature
int
intNeededDaysWhereToInsert
=
(
int
)
int
intNeededDaysWhereToInsert
=
(
int
)
Math
.
round
(
Math
.
round
(
xcellNeededDaysWhereToInsert
.
getValue
()
);
xcellNeededDaysWhereToInsert
.
getValue
()
);
GregorianCalendar
GregorianCalendar
gregoriancalendarPreviousNewEndDate
=
gregoriancalendarPreviousNewEndDate
=
this
.
getWorkday
(
gregoriancalendarPreviousStartDate
,
this
.
getWorkday
(
gregoriancalendarPreviousStartDate
,
intNeededDays
-
1
+
intNeededDaysWhereToInsert
,
intNeededDays
-
1
+
intNeededDaysWhereToInsert
,
objectHolidays
,
xfunctionaccess
);
objectHolidays
,
xfunctionaccess
);
String
stringPreviousDueDate
=
this
.
getStringFromCell
(
//String stringPreviousNewEndDate = this.getStringFromGregorianCalendar( gregoriancalendarPreviousNewEndDate );
xcellrange
,
intRowToInsert
,
this
.
INT_COLUMN_DUEDATE
);
String
stringPreviousDueDate
=
this
.
getStringFromCell
(
xcellrange
,
intRowToInsert
,
this
.
INT_COLUMN_DUEDATE
);
GregorianCalendar
GregorianCalendar
gregoriancalendarPreviousDueDate
=
null
;
gregoriancalendarPreviousDueDate
=
null
;
if
(
!
stringPreviousDueDate
.
equals
(
""
)
)
{
if
(
!
stringPreviousDueDate
.
equals
(
""
)
)
{
gregoriancalendarPreviousDueDate
=
gregoriancalendarPreviousDueDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
stringPreviousDueDate
);
stringPreviousDueDate
);
}
}
if
(
(
intRowToInsert
==
intRow
)
||
if
(
(
intRowToInsert
==
intRow
)
||
(
gregoriancalendarPreviousNewEndDate
.
after
(
(
gregoriancalendarPreviousNewEndDate
.
after
(
gregoriancalendarPreviousDueDate
)
)
)
{
gregoriancalendarPreviousDueDate
)
)
)
{
// Querying for the interface XPropertySet for the cell providing the due date
// Querying for the interface XPropertySet for the cell providing
// the due date
XPropertySet
xpropertyset
=
(
XPropertySet
)
XPropertySet
xpropertyset
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
XPropertySet
.
class
,
xcellrange
.
getCellByPosition
(
xcellrange
.
getCellByPosition
(
this
.
INT_COLUMN_DUEDATE
,
this
.
INT_COLUMN_DUEDATE
,
intRow
)
);
intRow
)
);
...
@@ -477,19 +508,15 @@ public class ToDo {
...
@@ -477,19 +508,15 @@ public class ToDo {
"CellBackColor"
,
new
Integer
(
16711680
)
);
"CellBackColor"
,
new
Integer
(
16711680
)
);
}
else
{
}
else
{
// Querying for the interface XColumnRowRange on the XCellRange
// Querying for the interface XColumnRowRange on the XCellRange
XColumnRowRange
xcolumnrowrange
=
(
XColumnRowRange
xcolumnrowrange
=
(
XColumnRowRange
)
XColumnRowRange
)
UnoRuntime
.
queryInterface
(
UnoRuntime
.
queryInterface
(
XColumnRowRange
.
class
,
xcellrange
);
XColumnRowRange
.
class
,
xcellrange
);
// Inserting one row to the table
// Inserting one row to the table
xcolumnrowrange
.
getRows
().
insertByIndex
(
xcolumnrowrange
.
getRows
().
insertByIndex
(
intRowToInsert
,
1
);
intRowToInsert
,
1
);
// Querying for the interface XCellRangeMovement on XCellRange
// Querying for the interface XCellRangeMovement on XCellRange
XCellRangeMovement
xcellrangemovement
=
XCellRangeMovement
xcellrangemovement
=
(
XCellRangeMovement
)
(
XCellRangeMovement
)
UnoRuntime
.
queryInterface
(
XCellRangeMovement
.
class
,
xcellrange
);
UnoRuntime
.
queryInterface
(
XCellRangeMovement
.
class
,
xcellrange
);
// Creating the cell address of the destination
// Creating the cell address of the destination
CellAddress
celladdress
=
new
CellAddress
();
CellAddress
celladdress
=
new
CellAddress
();
...
@@ -507,12 +534,10 @@ public class ToDo {
...
@@ -507,12 +534,10 @@ public class ToDo {
cellrangeaddress
.
EndRow
=
intRow
+
1
;
cellrangeaddress
.
EndRow
=
intRow
+
1
;
// Moves the cell range to another position in the document
// Moves the cell range to another position in the document
xcellrangemovement
.
moveRange
(
celladdress
,
xcellrangemovement
.
moveRange
(
celladdress
,
cellrangeaddress
);
cellrangeaddress
);
// Removing the row not needed anymore
// Removing the row not needed anymore
xcolumnrowrange
.
getRows
().
removeByIndex
(
xcolumnrowrange
.
getRows
().
removeByIndex
(
intRow
+
1
,
1
);
intRow
+
1
,
1
);
// Set the current row, because we want to recalculate all rows below
// Set the current row, because we want to recalculate all rows below
intRow
=
intRowToInsert
-
1
;
intRow
=
intRowToInsert
-
1
;
...
@@ -520,15 +545,13 @@ public class ToDo {
...
@@ -520,15 +545,13 @@ public class ToDo {
// Tests at which line we want to insert
// Tests at which line we want to insert
if
(
intRow
>=
this
.
INT_ROW_FROM
)
{
if
(
intRow
>=
this
.
INT_ROW_FROM
)
{
// Get the start date
// Get the start date
gregoriancalendarStartDate
=
gregoriancalendarStartDate
=
this
.
getGregorianCalendarFromString
(
this
.
getGregorianCalendarFromString
(
this
.
getStringFromCell
(
xcellrange
,
this
.
getStringFromCell
(
xcellrange
,
intRow
,
this
.
INT_COLUMN_ENDDATE
)
);
intRow
,
this
.
INT_COLUMN_ENDDATE
)
);
}
}
else
{
else
{
// Set the start date with the absolute start date
// Set the start date with the absolute start date
gregoriancalendarStartDate
=
gregoriancalendarStartDate
=
(
GregorianCalendar
)
(
GregorianCalendar
)
gregoriancalendarAbsoluteStartDate
.
clone
();
gregoriancalendarAbsoluteStartDate
.
clone
();
}
}
}
}
...
@@ -542,40 +565,11 @@ public class ToDo {
...
@@ -542,40 +565,11 @@ public class ToDo {
}
}
}
}
/** Sequence of all types (usually interface types) provided by the object.
* @return Sequence of all types.
*/
public
com
.
sun
.
star
.
uno
.
Type
[]
getTypes
()
{
Type
[]
typeReturn
=
{};
try
{
typeReturn
=
new
Type
[]
{
new
Type
(
XTypeProvider
.
class
),
new
Type
(
XToDo
.
class
)
};
}
catch
(
Exception
exception
)
{
this
.
showExceptionMessage
(
exception
);
}
return
(
typeReturn
);
}
/** Getting the implementation ID that can be used to unambigously distinguish
* between two set of types (interface XTypeProvider).
* @return ID as a sequence of bytes.
*/
public
byte
[]
getImplementationId
()
{
byte
[]
byteReturn
=
{};
return
(
byteReturn
);
}
/** Getting a string from a gregorian calendar.
/** Getting a string from a gregorian calendar.
* @param gregoriancalendar Date to be converted.
* @param gregoriancalendar Date to be converted.
* @return string (converted gregorian calendar).
* @return string (converted gregorian calendar).
*/
*/
public
String
getStringFromGregorianCalendar
(
public
String
getStringFromGregorianCalendar
(
GregorianCalendar
gregoriancalendar
)
{
GregorianCalendar
gregoriancalendar
)
{
String
stringDate
=
gregoriancalendar
.
get
(
Calendar
.
DATE
)
String
stringDate
=
gregoriancalendar
.
get
(
Calendar
.
DATE
)
+
STRING_SEPARATOR
+
(
gregoriancalendar
.
get
(
Calendar
.
MONTH
)
+
1
)
+
STRING_SEPARATOR
+
(
gregoriancalendar
.
get
(
Calendar
.
MONTH
)
+
1
)
+
STRING_SEPARATOR
+
gregoriancalendar
.
get
(
Calendar
.
YEAR
);
+
STRING_SEPARATOR
+
gregoriancalendar
.
get
(
Calendar
.
YEAR
);
...
@@ -587,8 +581,7 @@ public class ToDo {
...
@@ -587,8 +581,7 @@ public class ToDo {
* @param stringDate String to be converted.
* @param stringDate String to be converted.
* @return The result of the converting of the string.
* @return The result of the converting of the string.
*/
*/
public
GregorianCalendar
getGregorianCalendarFromString
(
public
GregorianCalendar
getGregorianCalendarFromString
(
String
stringDate
)
{
String
stringDate
)
{
int
[]
intDateValue
=
this
.
getDateValuesFromString
(
stringDate
);
int
[]
intDateValue
=
this
.
getDateValuesFromString
(
stringDate
);
return
(
new
GregorianCalendar
(
intDateValue
[
2
],
intDateValue
[
1
],
return
(
new
GregorianCalendar
(
intDateValue
[
2
],
intDateValue
[
1
],
...
@@ -611,8 +604,7 @@ public class ToDo {
...
@@ -611,8 +604,7 @@ public class ToDo {
intPositionFirstTag
)
);
intPositionFirstTag
)
);
// Getting the value of the month
// Getting the value of the month
intDateValues
[
1
]
=
Integer
.
parseInt
(
intDateValues
[
1
]
=
Integer
.
parseInt
(
stringDate
.
substring
(
intPositionFirstTag
+
1
,
stringDate
.
substring
(
intPositionFirstTag
+
1
,
intPositionSecondTag
)
)
-
1
;
intPositionSecondTag
)
)
-
1
;
// Getting the value of the day
// Getting the value of the day
...
@@ -629,14 +621,12 @@ public class ToDo {
...
@@ -629,14 +621,12 @@ public class ToDo {
* @param intColumn Number of column.
* @param intColumn Number of column.
* @return String from the specified cell.
* @return String from the specified cell.
*/
*/
public
String
getStringFromCell
(
XCellRange
xcellrange
,
int
intRow
,
public
String
getStringFromCell
(
XCellRange
xcellrange
,
int
intRow
,
int
intColumn
)
{
int
intColumn
)
{
XTextRange
xtextrangeStartDate
=
null
;
XTextRange
xtextrangeStartDate
=
null
;
try
{
try
{
// Getting the cell holding the information about the start date
// Getting the cell holding the information about the start date
XCell
xcellStartDate
=
xcellrange
.
getCellByPosition
(
intColumn
,
XCell
xcellStartDate
=
xcellrange
.
getCellByPosition
(
intColumn
,
intRow
);
intRow
);
// Querying for the interface XTextRange on the XCell
// Querying for the interface XTextRange on the XCell
xtextrangeStartDate
=
(
XTextRange
)
xtextrangeStartDate
=
(
XTextRange
)
UnoRuntime
.
queryInterface
(
XTextRange
.
class
,
xcellStartDate
);
UnoRuntime
.
queryInterface
(
XTextRange
.
class
,
xcellStartDate
);
...
@@ -659,11 +649,10 @@ public class ToDo {
...
@@ -659,11 +649,10 @@ public class ToDo {
int
intColumn
,
String
stringDate
)
{
int
intColumn
,
String
stringDate
)
{
try
{
try
{
// Getting the cell holding the information on the day to start
// Getting the cell holding the information on the day to start
XCell
xcellStartDate
=
xcellrange
.
getCellByPosition
(
intColumn
,
XCell
xcellStartDate
=
xcellrange
.
getCellByPosition
(
intColumn
,
intRow
);
intRow
);
// Querying for the interface XTextRange on the XCell
// Querying for the interface XTextRange on the XCell
XTextRange
xtextrange
=
(
XTextRange
)
UnoRuntime
.
queryInterface
(
XTextRange
xtextrange
=
(
XTextRange
)
XTextRange
.
class
,
xcellStartDate
);
UnoRuntime
.
queryInterface
(
XTextRange
.
class
,
xcellStartDate
);
// Setting the new start date
// Setting the new start date
xtextrange
.
setString
(
stringDate
);
xtextrange
.
setString
(
stringDate
);
}
}
...
@@ -724,8 +713,7 @@ public class ToDo {
...
@@ -724,8 +713,7 @@ public class ToDo {
xfunctionaccess
.
callFunction
(
xfunctionaccess
.
callFunction
(
"EASTERSUNDAY"
,
new
Object
[]
{
new
Integer
(
intYear
)
}
);
"EASTERSUNDAY"
,
new
Object
[]
{
new
Integer
(
intYear
)
}
);
int
intEasterSunday
=
(
int
)
Math
.
round
(
int
intEasterSunday
=
(
int
)
Math
.
round
(
doubleEasterSunday
.
doubleValue
()
);
doubleEasterSunday
.
doubleValue
()
);
// New-year
// New-year
vectorHolidays
.
addElement
(
xfunctionaccess
.
callFunction
(
vectorHolidays
.
addElement
(
xfunctionaccess
.
callFunction
(
...
@@ -748,12 +736,10 @@ public class ToDo {
...
@@ -748,12 +736,10 @@ public class ToDo {
new
Integer
(
1
)
}
)
);
new
Integer
(
1
)
}
)
);
// Ascension Day
// Ascension Day
vectorHolidays
.
addElement
(
vectorHolidays
.
addElement
(
new
Double
(
intEasterSunday
+
39
)
);
new
Double
(
intEasterSunday
+
39
)
);
// Pentecost monday
// Pentecost monday
vectorHolidays
.
addElement
(
vectorHolidays
.
addElement
(
new
Double
(
intEasterSunday
+
50
)
);
new
Double
(
intEasterSunday
+
50
)
);
// German Unification
// German Unification
vectorHolidays
.
addElement
(
xfunctionaccess
.
callFunction
(
vectorHolidays
.
addElement
(
xfunctionaccess
.
callFunction
(
...
@@ -798,27 +784,21 @@ public class ToDo {
...
@@ -798,27 +784,21 @@ public class ToDo {
Double
doubleDate
=
(
Double
)
xfunctionaccess
.
callFunction
(
Double
doubleDate
=
(
Double
)
xfunctionaccess
.
callFunction
(
"DATE"
,
"DATE"
,
new
Object
[]
{
new
Object
[]
{
new
Integer
(
new
Integer
(
gregoriancalendarStartDate
.
get
(
Calendar
.
YEAR
)
),
gregoriancalendarStartDate
.
get
(
Calendar
.
YEAR
)
),
new
Integer
(
gregoriancalendarStartDate
.
get
(
Calendar
.
MONTH
)
+
1
),
new
Integer
(
new
Integer
(
gregoriancalendarStartDate
.
get
(
Calendar
.
DATE
)
)
gregoriancalendarStartDate
.
get
(
Calendar
.
MONTH
)
+
1
),
new
Integer
(
gregoriancalendarStartDate
.
get
(
Calendar
.
DATE
)
)
}
);
}
);
Double
doubleWorkday
=
(
Double
)
xfunctionaccess
.
callFunction
(
Double
doubleWorkday
=
(
Double
)
xfunctionaccess
.
callFunction
(
"com.sun.star.sheet.addin.Analysis.getWorkday"
,
"com.sun.star.sheet.addin.Analysis.getWorkday"
,
new
Object
[]
{
doubleDate
,
new
Integer
(
intDays
),
new
Object
[]
{
doubleDate
,
new
Integer
(
intDays
),
objectHolidays
}
);
objectHolidays
}
);
Double
doubleYear
=
(
Double
)
xfunctionaccess
.
callFunction
(
Double
doubleYear
=
(
Double
)
xfunctionaccess
.
callFunction
(
"YEAR"
,
"YEAR"
,
new
Object
[]
{
doubleWorkday
}
);
new
Object
[]
{
doubleWorkday
}
);
Double
doubleMonth
=
(
Double
)
xfunctionaccess
.
callFunction
(
Double
doubleMonth
=
(
Double
)
xfunctionaccess
.
callFunction
(
"MONTH"
,
"MONTH"
,
new
Object
[]
{
doubleWorkday
}
);
new
Object
[]
{
doubleWorkday
}
);
Double
doubleDay
=
(
Double
)
xfunctionaccess
.
callFunction
(
Double
doubleDay
=
(
Double
)
xfunctionaccess
.
callFunction
(
"DAY"
,
"DAY"
,
new
Object
[]
{
doubleWorkday
}
);
new
Object
[]
{
doubleWorkday
}
);
gregoriancalendarWorkday
=
new
GregorianCalendar
(
gregoriancalendarWorkday
=
new
GregorianCalendar
(
doubleYear
.
intValue
(),
doubleYear
.
intValue
(),
...
@@ -845,12 +825,10 @@ public class ToDo {
...
@@ -845,12 +825,10 @@ public class ToDo {
int
intColumn
=
this
.
INT_COLUMN_HOLIDAYS_START
;
int
intColumn
=
this
.
INT_COLUMN_HOLIDAYS_START
;
double
doubleHolidayStart
=
xcellrange
.
getCellByPosition
(
double
doubleHolidayStart
=
xcellrange
.
getCellByPosition
(
intColumn
,
intColumn
,
intRow
).
getValue
();
intRow
).
getValue
();
double
doubleHolidayEnd
=
xcellrange
.
getCellByPosition
(
double
doubleHolidayEnd
=
xcellrange
.
getCellByPosition
(
intColumn
+
1
,
intColumn
+
1
,
intRow
).
getValue
();
intRow
).
getValue
();
while
(
doubleHolidayStart
!=
0
)
{
while
(
doubleHolidayStart
!=
0
)
{
if
(
doubleHolidayEnd
==
0
)
{
if
(
doubleHolidayEnd
==
0
)
{
...
@@ -863,18 +841,13 @@ public class ToDo {
...
@@ -863,18 +841,13 @@ public class ToDo {
doubleHolidayStart
);
doubleHolidayStart
);
intHoliday
<=
(
int
)
Math
.
round
(
doubleHolidayEnd
);
intHoliday
<=
(
int
)
Math
.
round
(
doubleHolidayEnd
);
intHoliday
++
)
{
intHoliday
++
)
{
vectorHolidays
.
addElement
(
vectorHolidays
.
addElement
(
new
Double
(
intHoliday
)
);
new
Double
(
intHoliday
)
);
}
}
}
}
intRow
++;
intRow
++;
doubleHolidayStart
=
doubleHolidayStart
=
xcellrange
.
getCellByPosition
(
intColumn
,
intRow
).
getValue
();
xcellrange
.
getCellByPosition
(
intColumn
,
doubleHolidayEnd
=
xcellrange
.
getCellByPosition
(
intColumn
+
1
,
intRow
).
getValue
();
intRow
).
getValue
();
doubleHolidayEnd
=
xcellrange
.
getCellByPosition
(
intColumn
+
1
,
intRow
).
getValue
();
}
}
}
}
catch
(
Exception
exception
)
{
catch
(
Exception
exception
)
{
...
@@ -912,40 +885,5 @@ public class ToDo {
...
@@ -912,40 +885,5 @@ public class ToDo {
}
}
/**
* Returns a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
* <p>
* @return returns a <code>XSingleServiceFactory</code> for creating the component
* @param implName the name of the implementation for which a service is desired
* @param multiFactory the service manager to be used if needed
* @param regKey the registryKey
* @see com.sun.star.comp.loader.JavaLoader
*/
public
static
XSingleServiceFactory
__getServiceFactory
(
String
implName
,
XMultiServiceFactory
multiFactory
,
XRegistryKey
regKey
)
{
XSingleServiceFactory
xSingleServiceFactory
=
null
;
if
(
implName
.
equals
(
_ToDo
.
class
.
getName
())
)
xSingleServiceFactory
=
FactoryHelper
.
getServiceFactory
(
_ToDo
.
class
,
_ToDo
.
__serviceName
,
multiFactory
,
regKey
);
return
xSingleServiceFactory
;
}
/**
* Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>
* <p>
* @return returns true if the operation succeeded
* @param regKey the registryKey
* @see com.sun.star.comp.loader.JavaLoader
*/
public
static
boolean
__writeRegistryServiceInfo
(
XRegistryKey
regKey
)
{
return
FactoryHelper
.
writeRegistryServiceInfo
(
_ToDo
.
class
.
getName
(),
_ToDo
.
__serviceName
,
regKey
);
}
}
}
odk/examples/java/ToDo/XToDo.idl
Dosyayı görüntüle @
f49575a8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
include
<
com
/
sun
/
star
/
uno
/
XInterface
.
idl>
#
include
<
com
/
sun
/
star
/
uno
/
XInterface
.
idl>
module
org
{
module
org
{
module
OpenO
ffice
{
module
openo
ffice
{
interface
XToDo
:
com
::
sun
::
star
::
uno
::
XInterface
interface
XToDo
:
com
::
sun
::
star
::
uno
::
XInterface
{
{
void
recalc
(
[
in
]
any
aInstance
)
;
void
recalc
(
[
in
]
any
aInstance
)
;
...
...
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