diff options
Diffstat (limited to 'soldep')
44 files changed, 13556 insertions, 0 deletions
diff --git a/soldep/bootstrp/appdef.cxx b/soldep/bootstrp/appdef.cxx new file mode 100644 index 000000000000..8ce777888781 --- /dev/null +++ b/soldep/bootstrp/appdef.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <appdef.hxx> + +const char* GetDefStandList() +{ + char* pRet; + char* pEnv = getenv("STAR_STANDLST"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( _DEF_STAND_LIST ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, _DEF_STAND_LIST ); + } + return pRet; +} + + +const char* GetIniRoot() +{ + char* pRet; + char* pEnv = getenv("STAR_INIROOT"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( _INIROOT ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, _INIROOT ); + } + return pRet; +} + +const char* GetIniRootOld() +{ + char* pRet; + char* pEnv = getenv("STAR_INIROOTOLD"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( _INIROOT_OLD ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, _INIROOT_OLD ); + } + return pRet; +} + +const char* GetSSolarIni() +{ + char* pRet; + char* pEnv = getenv("STAR_SSOLARINI"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( _DEF_SSOLARINI ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, _DEF_SSOLARINI ); + } + return pRet; +} + + +const char* GetSSCommon() +{ + char* pRet; + char* pEnv = getenv("STAR_SSCOMMON"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( _DEF_SSCOMMON ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, _DEF_SSCOMMON ); + } + return pRet; +} + + +const char* GetBServerRoot() +{ + char* pRet; + char* pEnv = getenv("STAR_BSERVERROOT"); + if ( pEnv ) + { + int nLen = strlen( pEnv ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, pEnv ); + } + else + { + int nLen = strlen( B_SERVER_ROOT ); + pRet = ( char *) malloc( nLen + 1 ); + (void) strcpy( pRet, B_SERVER_ROOT ); + } + return pRet; +} + +const char* GetEnv( const char *pVar ) +{ + char *pRet = getenv( pVar ); + if ( !pRet ) + pRet = ""; + return pRet; +} + +const char* GetEnv( const char *pVar, const char *pDefault ) +{ + char *pRet = getenv( pVar ); + if ( !pRet ) + return pDefault; + return pRet; +} diff --git a/soldep/bootstrp/build_list_converter.pl b/soldep/bootstrp/build_list_converter.pl new file mode 100644 index 000000000000..3887eca03a12 --- /dev/null +++ b/soldep/bootstrp/build_list_converter.pl @@ -0,0 +1,892 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 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 +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + + +#***************************************************************************************** +# ASCII parser for the changeover of the current build.lst files to XML files * +# programmer: Pascal Junck, Sun Microsystems GmbH * +#***************************************************************************************** + +# this is the first step for the changeover of the current 'build.lst' files to the new +# 'build.xlist'(XML) files +# before we create the new ones we have to parse all important informations from the old files +# important parameters are: +# 1. 'module name' +# 2. 'module dependency names' +# 3. 'dependency type' +# 4. 'job dir' +# 5. 'depending directories' +# 6. 'job platform'(only: 'w', 'u', 'm' and 'all') +# 7. 'job'(only: 'nmake' means 'make') +# 8. 'build requirements'(here called: 'restrictions') + + +################################# begin of main ####################################### + +use strict; +use lib ("/home/vg119683/work/modules"); + +use XMLBuildListParser; + +# get and work with each argument(build.lst files) of the commando line +# e.g. if the user wants to parse the build.lst file(s): +# user input (on unix) for all modules : 'perl -w ascii_parser.pl /so/ws/SRC680/src.m42/*/prj/build.lst' +# user input (on windows) for one module : 'perl -w ascii_parser.pl O:/SRC680/src.m42/[module]/prj/build.lst' +# get all arguments (build.lst files) of the commando line in this global variable '@buildlist_files' +my @buildlist_files = @ARGV; +# global variable for each file name that we want to parse in ASCII +my $parse_file = ""; +# set the global variable '$debug' (= 1) to see all results on the terminal, +# else (= 0) it shows nothing of the working output! +my $debug = 0; + +# open the filehandle 'ERROR_LOG' for all errors +open (ERROR_LOG, ">>ascii_parse.log") + or die "Error. Open the file <ascii_parse.log> wasn't successful!\n\n"; + +# reference of the instance of a new object +my $XMLTree; + +foreach (@buildlist_files) +{ + # get each element (= module) in '$parse_file' + $parse_file = $_; + + # open the filehandle 'PARSE_ASCII' for each module/file that we want to parse + open (PARSE_ASCII, $parse_file) + or die "Error. Open the module <$parse_file> wasn't successful!\n\n"; + + # create a new object + $XMLTree = XMLBuildListParser->new(); + + # invoking of the main subroutine + reading_file(); + + # is the file name 'build.lst' in the path on the command line? + # if not, we can not parse and create the new 'build.xlist' file + if ($parse_file =~ /build(\w+)?\.lst\S*$/) + { + my $path = $parse_file; + + $path =~ s/build(\w+)?\.lst\S*$/build\.xlist/; + + $XMLTree->saveXMLFile($path); + } + else + { + add_errorlog_no_buildlst_file_found_statement($parse_file); + } + + # close the current $parse_file + close(PARSE_ASCII); + +} +# after all files were read close the errorlog file +close(ERROR_LOG); + + +########################### begin of subroutines ##################################### +# +# global used variable: $parse_file +# +######################################################################################## + + +######################################################################################## +# sub: reading_file +# gets: $_ (current file) +# returns: - +######################################################################################## +sub reading_file +{ + # variable for the name of the current module + my $module_name = ""; + + # hashes for the infos beginning at the second line of the build.lst files + my %dir_of_job_platform = (); + my %dir_of_alias = (); + + # control variable for the module dependency line of the file + # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42) + # "sa sal : xml2cmp NULL" + my $module_dependency_line_exists = 0; + my $module_dependency_line_was_read = 0; + + # this line variables are for checking that all lines will be read + # counts each line + my $line_number = 0; + # for the sum of the informative lines (='module dependency line' and 'nmake' lines of the file) + my $info_line_sum = 0; + # for the sum of the no-info lines, like: + # job lines: 'usr1', 'get', ... and comment lines: '# ...' or empty lines + my $no_info_line_sum = 0; + + # read all lines of the file to resolve the first alias + # with the matching dir to know all aliases and directories + # at the later second file reading + while (<PARSE_ASCII>) + { + # the variable for each line of a file + my $line = $_; + + # count each line for more exact error descriptions in the log file + $line_number += 1; + + # remember it, if this line exists + if ( (is_module_dependency_line($line)) && ($module_dependency_line_exists == 0) ) + { + $module_dependency_line_exists = 1; + + # get the name of the current module + $module_name = get_module_name($line); + } + + # skip all lines, that hasn't the job 'nmake' + next if (!(is_nmake_line($line))); + + # check that the infos (job directory, job platform and alias) exist + if (my ($job_dir, $job_platform, $alias) = get_alias_resolving_infos($line)) + { + # prove that it's a valid job_platform + # and that each first alias and matching job platform exists only once + check_alias_and_job_platform($job_dir, $job_platform, $alias, \%dir_of_job_platform, + \%dir_of_alias, $module_name, $line_number); + } + else + { + chomp; + add_errorlog_unknown_format_statement($line, $module_name, $line_number); + next; + } + } + # reset the $line_number, because we count it again + $line_number = 0; + + # read the same file again + seek (PARSE_ASCII,0,0); + + # read each line of the file for all other informations + # e.g. line 8 of module 'sal' + # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL" + # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform + while (<PARSE_ASCII>) + { + # the variable for each line of a file + my $line = $_; + + # count each line to check at the end of the file that all lines were read + # and for more exact error descriptions in the log file + $line_number += 1; + + # is it a 'nmake' or a 'module dependency' line? + # if not: print this line to STDOUT, + # count one to the no-info lines, + # try to get the information about the module name from this line + # and skip the line + if ( (!(is_nmake_line($line))) && (!(is_module_dependency_line($line))) ) + { + my $no_info_line = show_no_info_line($line, $line_number); + + $no_info_line_sum += $no_info_line; + + # if no module dependency line exists get the name of the current module from another line + $module_name = get_module_name($line) if (!($module_name)); + + # skip the no-info line + next; + } + + # only if the module dependency line exists and it wasn't read get the infos about it + if ( ($module_dependency_line_exists) && (!($module_dependency_line_was_read)) ) + { + ($module_dependency_line_was_read, $info_line_sum) = get_module_dependency_line_infos + ($line, $module_name, $line_number); + } + + # get all 'nmake' line infos + my $info_line = get_nmake_line_infos($line, \%dir_of_alias, \%dir_of_job_platform, + $module_name, $line_number); + + # count the info lines; + $info_line_sum += $info_line; + } + + if ($debug == 1) + { + # show the sums of the info and no-info lines + lines_sums_output($module_name, $line_number, $info_line_sum, $no_info_line_sum); + } +} + +######################################################################################## +# sub: is_module_dependency_line +# gets: $line +# returns: 1 (true) or 0 (false) +######################################################################################## +sub is_module_dependency_line +{ + my $line = shift; + + # if the module dpendency line exists return 1, otherwise 0 + ($line =~ /^\w+\s+\S+\s+:+\s+/) + ? return 1 + : return 0; +} + +######################################################################################## +# sub: is_nmake_line +# gets: $line +# returns: '1' (true) or '0' (false) +######################################################################################## +sub is_nmake_line +{ + my $line = shift; + + # these lines are NO nmake lines: + # 1. a empty line + # 2. a comment line (perhaps with the job 'nmake') + # like line 20 of module 'bridges' (SRC680/src.m42) + # "#br bridges\source\cli_uno nmake - w,vc7 br_cli_uno br_unotypes NULL========= " + # 3. the module dependency line + # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42) + # "sa sal : xml2cmp N ULL" + # 4. a 'p' job platform line (for OS2) + # 5. a line with a job, which is not 'nmake' + ($line =~ (/^[^\s+\#]/) && (!(/\s+:+\s+/)) && (!(/\s+p\s+/)) && (/\bnmake\b/) ) + ? return 1 + : return 0; +} + +######################################################################################## +# sub: get_alias_resolving_infos +# gets: $line +# returns: $job_dir, $job_platform, $alias +######################################################################################## +sub get_alias_resolving_infos +{ + my $line = shift; + + if ($line =~ /^\w+\s+(\S+)\s+\w+\s+\-\s+(\w+)\,?(\w+)?\s+(\S+)\s+/) + { + # get the current work directory + my $temp_job_dir = $1; + + my $job_dir = change_job_directory($temp_job_dir); + + # get the job platform of the current job + # if it is a 'n' job platform transform it to 'w' + # because 'n' can be used now as 'w' (both means windows) + my $job_platform = $2; + $job_platform = "w" if($job_platform eq "n"); + + # get the first alias in each line + my $alias = $4; + + return ($job_dir, $job_platform, $alias); + } + return (undef, undef, undef); +} + +######################################################################################## +# sub: change_job_directory +# gets: $job_dir +# returns: $changed_job_dir +######################################################################################## +# we don't need the module name and the first '\' in the current directory +sub change_job_directory +{ + my $changed_job_dir = shift; + + # ignore the module name + $changed_job_dir =~ s/^\w+//; + # change all other '\' against the '/' of the current dir + $changed_job_dir =~ s/\\/\//g; + + # get only a "/" if we are in the root directory + $changed_job_dir = "/" if ($changed_job_dir eq ""); + + return $changed_job_dir; +} + +######################################################################################## +# sub: check_alias_and_job_platform +# gets: $job_dir, $job_platform, $alias, $dir_of_job_platform_ref, +# $dir_of_alias_ref, $module_name, $line_number +# returns: - +######################################################################################## +# get it in the hash only if it is a valid job platform, +# like 'w', 'u', 'm' and 'n' +# 'all' is also valid but it doesn't exist in an alias platform(!) +sub check_alias_and_job_platform +{ + my ($job_dir, $job_platform, $alias, $dir_of_job_platform_ref, + $dir_of_alias_ref, $module_name, $line_number) = @_; + + # is it a valid job_platform? + if ($job_platform =~ /(w|u|m|n|all)/) + { + # get only the 'w', 'u', 'm' and 'n' based job platforms + if ($job_platform =~ /[wumn]/) + { + # doesn't the key already exist? + (!(exists $$dir_of_job_platform_ref{$job_platform.$alias})) + # get the first alias with the matching job platform in the hash + ? get_alias_and_job_platform($job_platform, $alias, $dir_of_job_platform_ref) + # this is a line with a redundant alias and job platform + : add_errorlog_alias_redundancy_statement($module_name, $alias, $job_platform, $line_number); + } + if (!(exists $$dir_of_alias_ref{$alias})) + { + # get each first alias with the matching job platform + get_alias_and_matching_directory($dir_of_alias_ref, $alias, $job_dir); + } + } + # it's not a valid job platform + else + { + add_errorlog_invalid_platform_statement($module_name, $job_platform, $line_number); + } +} + +######################################################################################## +# sub: get_alias_and_job_platform +# gets: $job_platform, $alias, $dir_of_job_platform_ref +# returns: - +######################################################################################## +# get the the job platform and the first alias as a unique key +# and the job platform as value of the hash +# it's for checking later that the alias platform is equal to the job platform +# e.g.: line 6 + 7 of the module 'gtk' (SRC680/src.m42) +# "gt gtk\pkgconfig nmake - u gt_pkg NULL" +# "gt gtk\glib nmake - u gt_glib gt_pkg.u NULL" +# the alias 'gt_pkg' has the directory 'gtk\pkgconfig' (we need only 'pkgconfig') +# and it has the job platform 'u' - compare it with the alias platform 'gt_pkg.u' +sub get_alias_and_job_platform +{ + my ($job_platform, $alias, $dir_of_job_platform_ref) = @_; + + # key = 'job platform' and 'first alias' => value = 'job platform' + $$dir_of_job_platform_ref{$job_platform.$alias} = $job_platform; +} + +######################################################################################## +# sub: get_alias_and_matching_directory +# gets: $dir_of_alias_ref, $alias, $job_dir +# returns: - +######################################################################################## +# fill the hash with the first alias and the matching directory +# e.g. line 14 of module 'setup2' (SRC680/src.m42) +# "se setup2\win\source\unloader nmake - w se_wulo se_unotypes NULL" +# key = 'se_wulo' => value = 'win/source/unloader' +sub get_alias_and_matching_directory +{ + my ($dir_of_alias_ref, $alias, $job_dir) = @_; + + # key = 'first alias' => value = 'job directory' + $$dir_of_alias_ref{$alias} = $job_dir; +} + +######################################################################################## +# sub: show_no_info_line +# gets: $line, $line_number +# returns: $no_info_line +######################################################################################## +sub show_no_info_line +{ + my ($line, $line_number) = @_; + my $no_info_line += 1; + + chomp($line); + + print"Ignore line <$line_number>:\n\"$line\"\n\n" if ($debug); + + return $no_info_line; +} + +######################################################################################## +# sub: get_module_name +# gets: $line +# returns: $module_name +######################################################################################## +sub get_module_name +{ + my $line = shift; + my $module_name = ""; + + if ($line =~ /^\w+\s+([\w\.\-]+)\\?/) + { + $module_name = $1; + } + + # set the 'module name' in the data structure tree + $XMLTree->setModuleName($module_name); + + return $module_name; +} + +######################################################################################## +# sub: get_module_dependency_line_infos +# gets: $line, $module_name, $line_number +# returns: $module_dependency_line_was_read, $info_line_sum +######################################################################################## +# get the informations about the module dependency line +# like line 1 of module 'sal' (SRC680/src.m42) +# "sa sal : xml2cmp NULL" +# $module_name $module_dependency @module_dependency_names +sub get_module_dependency_line_infos +{ + my ($line, $module_name, $line_number) = @_; + my $module_dependency = ""; + my @module_dependency_names = (); + my %dep_modules_and_products = (); + my $product = ""; + + my $module_dependency_line_was_read = 1; + my $info_line_sum = 1; + + if ($debug) + { + print"\nline number : <$line_number>\n"; + print"module-name : <$module_name>\n"; + } + + # get the dependencies + if ($line =~ /\s+(:+)\s+/) + { + $module_dependency = $1; + print"module-dependency : <$module_dependency>\n" if ($debug); + + # transform the dependency type to the corresponding tag name + if ($module_dependency eq ":") + { + $module_dependency = "md-simple"; + } + elsif ($module_dependency eq "::") + { + $module_dependency = "md-always"; + } + elsif ($module_dependency eq ":::") + { + $module_dependency = "md-force"; + } + } + + # get a list of all depending module names + if ($line =~ /:+\s+([\S\s]+)\s+NULL/) + { + @module_dependency_names = split(/\s+/, $1); + + foreach my $module (@module_dependency_names) + { + # check whether that there is another product (as "all") of a module + if ($module =~ /(\S+):+(\S+)/) + { + $dep_modules_and_products{$2} = $1; + } + else + { + $dep_modules_and_products{$module} = "all"; + } + } + } + + # add the dependency module names, the module dependency type and the product to the data structure + foreach my $module (sort keys %dep_modules_and_products) + { + print"module-dependency-name(s) : key <$module> value <".$dep_modules_and_products{$module}.">\n" if ($debug); + + $XMLTree->addModuleDependencies($module, $module_dependency, $dep_modules_and_products{$module}); + } + + return ($module_dependency_line_was_read, $info_line_sum); +} + +######################################################################################## +# sub: get_nmake_line_infos +# gets: $line, \%dir_of_alias, \%dir_of_job_platform, $module_name, $line_number +# returns: $info_line +######################################################################################## +# get all infos about the 'nmake' lines +# e.g. line 8 of module 'sal' +# "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL" +# $job_dir $job $job_platform 1.$alias 2.$alias + alias platform +sub get_nmake_line_infos +{ + my ($line, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_; + my $directories_ref = ""; + my $info_line = 0; + + # get the infos about the 'nmake' lines + if ($line =~ /^\w+\s+(\S+)\s+(\w+)\s+\-\s+(\w+)\,?(\S+)?/) + { + # get the current working directory + my $temp_job_dir = $1; + my $job_dir = change_job_directory($temp_job_dir); + + # get the job + my $job = $2; + $job = "make" if ($job eq "nmake"); + + # get the job platform of the current job + # if it is a 'n' job platform transform it to 'wnt' + # available values are: 'wnt', 'unx', 'mac' or 'all' + my $job_platform = $3; + $job_platform = change_job_platform_name($job_platform); + + # get the first alias in each line + my $restriction = $4; + my %build_req = ( "$restriction" => "$job_platform") if ($restriction && $job_platform); + + + # get all aliases (but not the first) in an array + my $aliases_ref = get_aliases($line); + + # filter the list of aliases, which has a 'p' job platform + # and transform a 'n' ending alias platform to a 'w' ending alias platform + filter_aliases($aliases_ref); + + # resolve all aliases (alias[.job platform] => matching directory) + $directories_ref = resolve_aliases($aliases_ref, $dir_of_alias_ref, + $dir_of_job_platform_ref, $module_name, $line_number); + + # count the informative lines + $info_line = 1; + + $XMLTree->addJob($job_dir, $job, $job_platform, $directories_ref, \%build_req); + + # show the infos, that we know about each line + if ($debug == 1) + { + show_line_infos($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref); + } + } + return $info_line; +} + +######################################################################################## +# sub: change_job_platform_name +# gets: $job_platform +# returns: $job_platform +######################################################################################## +sub change_job_platform_name +{ + my $job_platform = shift; + + $job_platform = "wnt" if($job_platform eq "n" || $job_platform eq "w"); + $job_platform = "unx" if($job_platform eq "u"); + $job_platform = "mac" if($job_platform eq "m"); + + return $job_platform; +} + +######################################################################################## +# sub: get_aliases +# gets: $_ (current line) +# returns: \@aliases +######################################################################################## +# get all aliases of the line in an array +sub get_aliases +{ + my $line = shift; + my @aliases = (); + + # get all aliases in an array (but cut out the first alias) + if ($line =~ /\-\s+[\w+\,]+\s+([\S\s]+)\s+NULL$/) + { + print"\nall job aliases : <$1>\n" if ($debug); + + @aliases = split /\s+/, $1; + + # we don't need the first alias (it stands for the current job directory) + shift @aliases; + } + return \@aliases; +} + +######################################################################################## +# sub: filter_aliases +# gets: $aliases_ref +# returns: - +######################################################################################## +# filter all aliases, because we only need the 'w', 'u' and 'm' job platform based aliases +sub filter_aliases +{ + my $aliases_ref = shift; + + # get the highest index of the array (number of elements of the array - 1) + # also works: my $index = scalar(@$aliases_ref)-1; + my $index = $#{@{$aliases_ref}}; + + for (; $index >= 0; $index--) + { + # filter the 'p' job platform based aliases from '@aliases' + splice(@$aliases_ref, $index, 1) if ($$aliases_ref[$index] =~ /\.p$/); + + # transform a '.n' ending alias platform to '.w' ending alias platform + if ($$aliases_ref[$index] =~ /\.n$/) + { + $$aliases_ref[$index] =~ s/\.n$/\.w/; + splice(@$aliases_ref, $index, 1, $$aliases_ref[$index]); + } + } +} + +######################################################################################## +# sub: resolve_aliases +# gets: $aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, +# $module_name, $line_number +# returns: \@directories +######################################################################################## +# here we get each alias with the matching job directory +sub resolve_aliases +{ + my ($aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_; + + my @directories = (); + my ($alias_platform, $alias, $temp_alias) = ""; + + # resolving all directory aliases + foreach $temp_alias (@$aliases_ref) + { + ($alias, $alias_platform) = compare_job_platform_with_alias_platform + ($temp_alias, $dir_of_job_platform_ref, $module_name, $line_number); + + # does the alias exist? + if (exists $$dir_of_alias_ref{$alias}) + { + # then get the matching directory in the array + push (@directories, $$dir_of_alias_ref{$alias}); + } + else + { + add_errorlog_no_directory_of_alias_statement($module_name, $alias, $line_number); + } + } + return \@directories; +} + +######################################################################################## +# sub: compare_job_platform_with_alias_platform +# gets: $alias, $dir_of_job_platform_ref, $module_name, $line_number +# returns: $alias +######################################################################################## +sub compare_job_platform_with_alias_platform +{ + my ($alias, $dir_of_job_platform_ref, $module_name, $line_number) = @_; + + my $alias_platform = ""; + + # compare the alias platform (with a dot and an ending letter, like "al_alib.u") + # with the job platform of the line in which this alias was resolved + if ($alias =~ /\.([wum])$/) + { + $alias_platform = $1; + + # don't memorize the ending dot and letter + $alias =~ s/\.\w$//; + + # if the value(= job platform) of the hash or the alias platform has no value + # set it to "no valid value" + if (!(exists $$dir_of_job_platform_ref{$alias_platform.$alias})) + { + $$dir_of_job_platform_ref{$alias_platform.$alias} = "no valid value"; + } + $alias_platform = "no valid value" if (!($alias_platform)); + + # are the job platform and the alias platform equal? + if ($$dir_of_job_platform_ref{$alias_platform.$alias} ne $alias_platform) + { + add_errorlog_not_equal_platforms_statement + ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number); + } + } + return ($alias, $alias_platform); +} + +######################################################################################## +# sub: show_line_infos +# gets: $line_number, $job_dir, $job, $job_platform, $restriction, +# $aliases_ref, $directories_ref +# returns: - +######################################################################################## +# print the infos about each line +sub show_line_infos +{ + my ($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref) = @_; + + print"line number : <$line_number>\n"; + print"job directory : <$job_dir>\n"; + print"job : <$job>\n"; + print"job platform : <$job_platform>\n" if ($job_platform =~ /(w|u|m|all)/); + print"restriction : <$restriction>\n" if ($restriction); + print"alias dependencies : <@$aliases_ref>\n"; + print"directory dependencies : <@$directories_ref>\n\n"; +} + +######################################################################################## +# sub: lines_sums_output +# gets: $module_name, $line_number, $info_line_sum, $no_info_line_sum +# returns: - +######################################################################################## +sub lines_sums_output +{ + # this line variables are for checking that all lines will be read: + my ($module_name, $line_number, $info_line_sum, $no_info_line_sum) = @_; + my $lines_sum = 0; + + add_errorlog_no_module_name_statement() if (!($module_name)); + + # were all lines read? and is the checksum okay? + $lines_sum = $info_line_sum + $no_info_line_sum; + if ($lines_sum == $line_number) + { + print"All $line_number line(s) of module <$module_name> were read and checked!\n\n"; + } + else + { + add_errorlog_different_lines_sums_statement($module_name); + } + + print"module: <$module_name>\n". + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n". + " info line(s) sum = $info_line_sum\n". + "no-info line(s) sum = $no_info_line_sum\n". + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n". + " total line(s) sum = $line_number\n\n\n"; +} + + +############################ ERROR_LOG subroutines ##################################### + + +######################################################################################## +# sub: add_errorlog_invalid_job_platform_statement +# gets: $module_name, $platform, $line_number +# returns: - +######################################################################################## +sub add_errorlog_invalid_job_platform_statement +{ + my ($module_name, $job_platform, $line_number) = @_; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". + "The job platform <$job_platform> is not valid.\n\n"; +} + +######################################################################################## +# sub: add_errorlog_not_equal_platforms_statement +# gets: $module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number +# returns: - +######################################################################################## +sub add_errorlog_not_equal_platforms_statement +{ + my ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number) = @_; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". + "The alias platform <$alias.$alias_platform> is not equal ". + "with the job platform <$$dir_of_job_platform_ref{$alias_platform.$alias}>.\n\n"; +} + +######################################################################################## +# sub: add_errorlog_no_directory_of_alias_statement +# gets: $module_name, $alias, $line_number +# returns: - +######################################################################################## +sub add_errorlog_no_directory_of_alias_statement +{ + my ($module_name, $alias, $line_number) = @_; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". + "The directory of the alias <$alias> doesn't exist!\n\n"; +} + +######################################################################################## +# sub: add_errorlog_no_module_name_statement +# gets: - +# returns: - +######################################################################################## +sub add_errorlog_no_module_name_statement +{ + print ERROR_LOG "Error. No module name found in dir/file <$parse_file>.\n\n"; +} + +######################################################################################## +# sub: add_errorlog_alias_redundancy_statement +# gets: $module_name, $alias, $job_platform, $line_number +# returns: - +######################################################################################## +sub add_errorlog_alias_redundancy_statement +{ + my ($module_name, $alias, $job_platform, $line_number)= @_; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". + "The alias <$alias> with the job platform <$job_platform> is redundant.\n\n"; +} + +######################################################################################## +# sub: add_errorlog_unknown_format_statement +# gets: $module_name, $line_number +# returns: - +######################################################################################## +sub add_errorlog_unknown_format_statement +{ + my ($line, $module_name, $line_number) = @_; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.". + "\nUnknown format:\n\"$line\"\n\n"; +} + +######################################################################################## +# sub: add_errorlog_different_lines_sums_statement +# gets: $module_name +# returns: - +######################################################################################## +sub add_errorlog_different_lines_sums_statement +{ + my $module_name = shift; + + print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file>.\n". + "The sums of all info and no-info lines are not correct!\n\n"; +} + +######################################################################################## +# sub: add_errorlog_no_buildlst_file_found_statement +# gets: $parse_file +# returns: - +######################################################################################## +sub add_errorlog_no_buildlst_file_found_statement +{ + my $parse_file = shift; + + print ERROR_LOG "Error in command line argument <$parse_file>.\n". + "File 'build.lst' not found!\n"; +} + +############################# end of the subroutines ################################### diff --git a/soldep/bootstrp/dep.cxx b/soldep/bootstrp/dep.cxx new file mode 100644 index 000000000000..fb4edcc998bc --- /dev/null +++ b/soldep/bootstrp/dep.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dep.hxx" + +// class SByteExtStringList + +/*****************************************************************************/ +SByteExtStringList::~SByteExtStringList() +/*****************************************************************************/ +{ + if (bDeleteStrings) + while( Count()) { + delete GetObject((ULONG)0); + Remove((ULONG)0); + } +} + +// class VersionDepInfo + +/*****************************************************************************/ +VersionDepInfo::~VersionDepInfo() +/*****************************************************************************/ +{ + if (pVersion) + delete pVersion; +} + +/*****************************************************************************/ +void VersionDepInfo::Clear() +/*****************************************************************************/ +{ + while( Count()) { + delete GetObject((ULONG)0); + Remove((ULONG)0); + } +} + +// class VersionDepInfoList + +/*****************************************************************************/ +VersionDepInfo* VersionDepInfoList::GetVersion (ByteString& rVersion) +/*****************************************************************************/ +{ + VersionDepInfo* pInfo = First(); + while (pInfo) + { + const ByteString* pStr = pInfo->GetVersion(); + if (*pStr == rVersion) + return pInfo; + pInfo = Next(); + } + return NULL; +} + +/*****************************************************************************/ +void VersionDepInfoList::RemoveVersion (ByteString& rVersion) +/*****************************************************************************/ +{ + VersionDepInfo* pInfo = First(); + while (pInfo) + { + const ByteString* pStr = pInfo->GetVersion(); + if (*pStr == rVersion) + { + Remove (pInfo); + delete pInfo; + return; + } + pInfo = Next(); + } +} + +/*****************************************************************************/ +VersionDepInfo* VersionDepInfoList::InsertVersion (ByteString& rVersion) +/*****************************************************************************/ +{ + VersionDepInfo* pInfo = First(); + while (pInfo) + { + const ByteString* pStr = pInfo->GetVersion(); + if (*pStr == rVersion) + { + pInfo->Clear(); + return pInfo; + } + pInfo = Next(); + } + pInfo = new VersionDepInfo (rVersion); + Insert (pInfo, LIST_APPEND); + return pInfo; +} diff --git a/soldep/bootstrp/hashtbl.cxx b/soldep/bootstrp/hashtbl.cxx new file mode 100644 index 000000000000..b6f9b0b7826a --- /dev/null +++ b/soldep/bootstrp/hashtbl.cxx @@ -0,0 +1,511 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/gen.hxx> +#include <tools/debug.hxx> +#include <soldep/hashtbl.hxx> + +// ------------------------------------------------------------- +// class HashItem +// +class HashItem +{ + enum ETag { TAG_EMPTY, TAG_USED, TAG_DELETED }; + + void* m_pObject; + ETag m_Tag; + ByteString m_Key; + +public: + HashItem() { m_Tag = TAG_EMPTY; m_pObject = NULL; } + + BOOL IsDeleted() const + { return m_Tag == TAG_DELETED; } + + BOOL IsEmpty() const + { return m_Tag == TAG_DELETED || m_Tag == TAG_EMPTY; } + + BOOL IsFree() const + { return m_Tag == TAG_EMPTY; } + + BOOL IsUsed() const + { return m_Tag == TAG_USED; } + + void Delete() + { m_Tag = TAG_DELETED; m_Key = ""; m_pObject = NULL; } + + ByteString const& GetKey() const + { return m_Key; } + + void* GetObject() const + { return m_pObject; } + + void SetObject(ByteString const Key, void *pObject) + { m_Tag = TAG_USED; m_Key = Key; m_pObject = pObject; } +}; + +#define MIN(a,b) (a)<(b)?(a):(b) +#define MAX(a,b) (a)>(b)?(a):(b) + +// ------------------------------------------------------------- +// class HashTable +// + +/*static*/ double HashTable::m_defMaxLoadFactor = 0.8; +/*static*/ double HashTable::m_defDefGrowFactor = 2.0; + +HashTable::HashTable(ULONG lSize, BOOL bOwner, double dMaxLoadFactor, double dGrowFactor) +{ + m_lSize = lSize; + m_bOwner = bOwner; + m_lElem = 0; + m_dMaxLoadFactor = MAX(0.5,MIN(1.0,dMaxLoadFactor)); // 0.5 ... 1.0 + m_dGrowFactor = MAX(1.3,MIN(5.0,dGrowFactor)); // 1.3 ... 5.0 + m_pData = new HashItem [lSize]; + +// Statistik +#ifdef DBG_UTIL + m_aStatistic.m_lSingleHash = 0; + m_aStatistic.m_lDoubleHash = 0; + m_aStatistic.m_lProbe = 0; +#endif +} + +HashTable::~HashTable() +{ + // Wenn die HashTable der Owner der Objecte ist, + // müssen die Destruktoren separat gerufen werden. + // Dies geschieht über die virtuelle Methode OnDeleteObject() + // + // Problem: Virtuelle Funktionen sind im Destructor nicht virtuell!! + // Der Code muß deshalb ins Macro + + /* + if (m_bOwner) + { + for (ULONG i=0; i<GetSize(); i++) + { + void *pObject = GetObjectAt(i); + + if (pObject != NULL) + OnDeleteObject(pObject()); + } + } + */ + + // Speicher für HashItems freigeben + delete [] m_pData; +} + +void* HashTable::GetObjectAt(ULONG lPos) const +// Gibt Objekt zurück, wenn es eines gibt, sonst NULL; +{ + DBG_ASSERT(lPos<m_lSize, "HashTable::GetObjectAt()"); + + HashItem *pItem = &m_pData[lPos]; + + return pItem->IsUsed() ? pItem->GetObject() : NULL; +} + +void HashTable::OnDeleteObject(void*) +{ + DBG_ERROR("HashTable::OnDeleteObject(void*) nicht überladen"); +} + +ULONG HashTable::Hash(ByteString const& Key) const +{ + /* + ULONG lHash = 0; + ULONG i,n; + + for (i=0,n=Key.Len(); i<n; i++) + { + lHash *= 256L; + lHash += (ULONG)(USHORT)Key.GetStr()[i]; + lHash %= m_lSize; + } + return lHash; + */ + + // Hashfunktion von P.J. Weinberger + // aus dem "Drachenbuch" von Aho/Sethi/Ullman + ULONG i,n; + ULONG h = 0; + ULONG g = 0; + + for (i=0,n=Key.Len(); i<n; i++) + { + h = (h<<4) + (ULONG)(USHORT)Key.GetBuffer()[i]; + g = h & 0xf0000000; + + if (g != 0) + { + h = h ^ (g >> 24); + h = h ^ g; + } + } + + return h % m_lSize; +} + +ULONG HashTable::DHash(ByteString const& Key, ULONG lOldHash) const +{ + ULONG lHash = lOldHash; + ULONG i,n; + + for (i=0,n=Key.Len(); i<n; i++) + { + lHash *= 256L; + lHash += (ULONG)(USHORT)Key.GetBuffer()[i]; + lHash %= m_lSize; + } + return lHash; + +/* return + ( + lHash + + (char)Key.GetStr()[0] * 256 + + (char)Key.GetStr()[Key.Len()-1] + + 1 + ) + % m_lSize; +*/ +} + +ULONG HashTable::Probe(ULONG lPos) const +// gibt den Folgewert von lPos zurück +{ + lPos++; if (lPos==m_lSize) lPos=0; + return lPos; +} + +BOOL HashTable::IsFull() const +{ + return m_lElem>=m_lSize; +} + +BOOL HashTable::Insert(ByteString const& Key, void* pObject) +// pre: Key ist nicht im Dictionary enthalten, sonst return FALSE +// Dictionary ist nicht voll, sonst return FALSE +// post: pObject ist unter Key im Dictionary; m_nElem wurde erhöht +{ + SmartGrow(); + + if (IsFull()) + { + DBG_ERROR("HashTable::Insert() is full"); + return FALSE; + } + + if (FindPos(Key) != NULL ) + return FALSE; + + ULONG lPos = Hash(Key); + HashItem *pItem = &m_pData[lPos]; + + // first hashing + // + if (pItem->IsEmpty()) + { + pItem->SetObject(Key, pObject); + m_lElem++; + + #ifdef DBG_UTIL + m_aStatistic.m_lSingleHash++; + #endif + + return TRUE; + } + + // double hashing + // + lPos = DHash(Key,lPos); + pItem = &m_pData[lPos]; + + if (pItem->IsEmpty()) + { + pItem->SetObject(Key, pObject); + m_lElem++; + + #ifdef DBG_UTIL + m_aStatistic.m_lDoubleHash++; + #endif + + return TRUE; + } + + // linear probing + // + do + { + #ifdef DBG_UTIL + m_aStatistic.m_lProbe++; + #endif + + lPos = Probe(lPos); + pItem = &m_pData[lPos]; + } + while(!pItem->IsEmpty()); + + pItem->SetObject(Key, pObject); + m_lElem++; + return TRUE; +} + +HashItem* HashTable::FindPos(ByteString const& Key) const +// sucht den Key; gibt Refrenz auf den Eintrag (gefunden) +// oder NULL (nicht gefunden) zurück +// +// pre: - +// post: - +{ + // first hashing + // + ULONG lPos = Hash(Key); + HashItem *pItem = &m_pData[lPos]; + + if (pItem->IsUsed() + && pItem->GetKey() == Key) + { + return pItem; + } + + // double hashing + // + if (pItem->IsDeleted() || pItem->IsUsed()) + { + lPos = DHash(Key,lPos); + pItem = &m_pData[lPos]; + + if (pItem->IsUsed() + && pItem->GetKey() == Key) + { + return pItem; + } + + // linear probing + // + if (pItem->IsDeleted() || pItem->IsUsed()) + { + ULONG n = 0; + BOOL bFound = FALSE; + BOOL bEnd = FALSE; + + do + { + n++; + lPos = Probe(lPos); + pItem = &m_pData[lPos]; + + bFound = pItem->IsUsed() + && pItem->GetKey() == Key; + + bEnd = !(n<m_lSize || pItem->IsFree()); + } + while(!bFound && !bEnd); + + return bFound ? pItem : NULL; + } + } + + // nicht gefunden + // + return NULL; +} + +void* HashTable::Find(ByteString const& Key) const +// Gibt Verweis des Objektes zurück, das unter Key abgespeichert ist, +// oder NULL wenn nicht vorhanden. +// +// pre: - +// post: - +{ + HashItem *pItem = FindPos(Key); + + if (pItem != NULL + && pItem->GetKey() == Key) + return pItem->GetObject(); + else + return NULL; +} + +void* HashTable::Delete(ByteString const& Key) +// Löscht Objekt, das unter Key abgespeichert ist und gibt Verweis +// darauf zurück. +// Gibt NULL zurück, wenn Key nicht vorhanden ist. +// +// pre: - +// post: Objekt ist nicht mehr enthalten; m_lElem dekrementiert +// Wenn die HashTable der Owner ist, wurde das Object gelöscht +{ + HashItem *pItem = FindPos(Key); + + if (pItem != NULL + && pItem->GetKey() == Key) + { + void* pObject = pItem->GetObject(); + + if (m_bOwner) + OnDeleteObject(pObject); + + pItem->Delete(); + m_lElem--; + return pObject; + } + else + { + return NULL; + } +} + +double HashTable::CalcLoadFactor() const +// prozentuale Belegung der Hashtabelle berechnen +{ + return double(m_lElem) / double(m_lSize); +} + +void HashTable::SmartGrow() +// Achtung: da die Objekte umkopiert werden, darf die OnDeleteObject-Methode +// nicht gerufen werden +{ + double dLoadFactor = CalcLoadFactor(); + + if (dLoadFactor <= m_dMaxLoadFactor) + return; // nothing to grow + + ULONG lOldSize = m_lSize; // alte Daten sichern + HashItem* pOldData = m_pData; + + m_lSize = ULONG (m_dGrowFactor * m_lSize); // neue Größe + m_pData = new HashItem[m_lSize]; // neue Daten holen + + // kein Speicher: + // Zustand "Tabelle voll" wird in Insert abgefangen + // + if (m_pData == NULL) + { + m_lSize = lOldSize; + m_pData = pOldData; + return; + } + + m_lElem = 0; // noch keine neuen Daten + + // Umkopieren der Daten + // + for (ULONG i=0; i<lOldSize; i++) + { + HashItem *pItem = &pOldData[i]; + + if (pItem->IsUsed()) + Insert(pItem->GetKey(),pItem->GetObject()); + } + + delete [] pOldData; +} + +// Iterator --------------------------------------------------------- +// + +HashTableIterator::HashTableIterator(HashTable const& aTable) +: m_aTable(aTable) +{ + m_lAt = 0; +} + +void* HashTableIterator::GetFirst() +{ + m_lAt = 0; + return FindValidObject(TRUE /* forward */); +} + +void* HashTableIterator::GetLast() +{ + m_lAt = m_aTable.GetSize() -1; + return FindValidObject(FALSE /* backward */); +} + +void* HashTableIterator::GetNext() +{ + if (m_lAt+1 >= m_aTable.GetSize()) + return NULL; + + m_lAt++; + return FindValidObject(TRUE /* forward */); +} + +void* HashTableIterator::GetPrev() +{ + if (m_lAt <= 0) + return NULL; + + m_lAt--; + return FindValidObject(FALSE /* backward */); +} + +void* HashTableIterator::FindValidObject(BOOL bForward) +// Sucht nach einem vorhandenen Objekt ab der aktuellen +// Position. +// +// pre: ab inkl. m_lAt soll die Suche beginnen +// post: if not found then +// if bForward == TRUE then +// m_lAt == m_aTable.GetSize() -1 +// else +// m_lAt == 0 +// else +// m_lAt ist die gefundene Position +{ + void *pObject = m_aTable.GetObjectAt(m_lAt); + + if (pObject != NULL) + return pObject; + + while (pObject == NULL + && (bForward ? ((m_lAt+1) < m_aTable.GetSize()) + : m_lAt > 0)) + { + if (bForward) + m_lAt++; + else + m_lAt--; + + pObject = m_aTable.GetObjectAt(m_lAt); + } + +#ifdef DBG_UTIL + + if (pObject == NULL) + { + DBG_ASSERT(bForward ? m_lAt == m_aTable.GetSize() -1 : m_lAt == 0, + "HashTableIterator::FindValidObject()"); + } + +#endif + + return pObject; +} diff --git a/soldep/bootstrp/makefile.mk b/soldep/bootstrp/makefile.mk new file mode 100644 index 000000000000..56d3fa1f07f4 --- /dev/null +++ b/soldep/bootstrp/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# 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 +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=soldep +TARGET=bootstrpdt +ENABLE_EXCEPTIONS=true + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# fixme, code is not yet 64 bit clean +.IF "$(OS)$(CPU)"=="LINUXX" || ("$(COM)"=="C52" && "$(CPU)"=="U") +all: + @echo nothing to do +.ENDIF + +# --- Files -------------------------------------------------------- + +EXCEPTIONSFILES= \ + $(SLO)$/prj.obj + +SLOFILES=\ + $(SLO)$/dep.obj \ + $(SLO)$/minormk.obj \ + $(SLO)$/prodmap.obj \ + $(SLO)$/appdef.obj \ + $(SLO)$/hashtbl.obj \ + $(SLO)$/prj.obj + + +SHL1TARGET =$(TARGET)$(DLLPOSTFIX) +SHL1IMPLIB =$(TARGET) +SHL1LIBS =$(SLB)$/$(TARGET).lib +SHL1DEF =$(MISC)$/$(SHL1TARGET).def +SHL1DEPN =$(SHL1LIBS) +SHL1STDLIBS=\ + $(TOOLSLIB) \ + $(BTSTRPLIB) \ + $(VOSLIB) \ + $(SALLIB) + +DEF1NAME =$(SHL1TARGET) +DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt +DEFLIB1NAME =$(TARGET) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo WEP > $@ + @echo LIBMAIN >> $@ + @echo LibMain >> $@ + @echo __CT >> $@ diff --git a/soldep/bootstrp/minormk.cxx b/soldep/bootstrp/minormk.cxx new file mode 100644 index 000000000000..8c08d3a69840 --- /dev/null +++ b/soldep/bootstrp/minormk.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "minormk.hxx" +#include "prodmap.hxx" +#include <appdef.hxx> +#include <tools/fsys.hxx> +#include <tools/geninfo.hxx> + +// +// class MinorMk +// + +/*****************************************************************************/ +MinorMk::MinorMk( + GenericInformationList *pList, + const ByteString &rVersion, + const ByteString &rWorkStamp, + const ByteString &rEnvironment, + const ByteString &rMinor +) +/*****************************************************************************/ +{ + String sRoot( ProductMapper::GetVersionRoot( pList, rVersion )); + if ( sRoot.Len()) { + ByteString sPath( sRoot, RTL_TEXTENCODING_ASCII_US ); + sPath += "/"; + sPath += rEnvironment; + sPath += "/"; + sPath += "inc"; + if ( rMinor.Len()) { + sPath += "."; + sPath += rMinor; + } +#ifdef UNX + sPath.SearchAndReplaceAll( "\\", "/" ); + while( sPath.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) {}; +#else + sPath.SearchAndReplaceAll( "/", "\\" ); + while( sPath.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND ) {}; +#endif + DirEntry aPath( String( sPath, RTL_TEXTENCODING_ASCII_US )); + + ByteString sFile( rWorkStamp ); + sFile += "minor.mk"; + + DirEntry aFile( aPath ); + aFile += DirEntry( String( sFile, RTL_TEXTENCODING_ASCII_US )); + if ( !aFile.Exists()) { + sFile = sFile.Copy( 3 ); + aFile = aPath; + aFile += DirEntry( String( sFile, RTL_TEXTENCODING_ASCII_US )); + } + ReadMinorMk( aFile.GetFull()); + } +} + +/*****************************************************************************/ +MinorMk::MinorMk( GenericInformationList *pList, const ByteString rVersion ) +/*****************************************************************************/ +{ + String sRoot( ProductMapper::GetVersionRoot( pList, rVersion )); + if ( sRoot.Len()) { + ByteString sPath( sRoot, RTL_TEXTENCODING_ASCII_US ); + sPath += "/src/solenv/inc"; +#ifdef UNX + sPath.SearchAndReplaceAll( "\\", "/" ); + while( sPath.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) {}; +#else + sPath.SearchAndReplaceAll( "/", "\\" ); + while( sPath.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND ) {}; +#endif + DirEntry aPath( String( sPath, RTL_TEXTENCODING_ASCII_US )); + + ByteString sFile( "minor.mk" ); + + DirEntry aFile( aPath ); + aFile += DirEntry( String( sFile, RTL_TEXTENCODING_ASCII_US )); + + ReadMinorMk( aFile.GetFull()); + } +} + +/*****************************************************************************/ +MinorMk::MinorMk( const ByteString &rMinor, const ByteString &rEnvironment ) +/*****************************************************************************/ + : bExists( FALSE ) +{ + ByteString sDelimiter( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + + + ByteString sSolver( GetEnv( "SOLARVERSION" )); + BOOL bNewEnv = TRUE; + if ( !sSolver.Len()) { + sSolver = GetEnv( "SOLARVER" ); + bNewEnv = FALSE; + } + ByteString sUPD( GetEnv( "UPD" )); + + ByteString sMinorMk( sSolver ); + sMinorMk += sDelimiter; + if ( !bNewEnv ) { + sMinorMk += sUPD; + sMinorMk += sDelimiter; + } + + if ( rEnvironment.Len()) { + sMinorMk += rEnvironment; + sMinorMk += sDelimiter; + sMinorMk += "inc"; + if( rMinor.Len()) { + sMinorMk += "."; + sMinorMk += rMinor; + } + sMinorMk += sDelimiter; + } + + sMinorMk += sUPD; + sMinorMk += "minor.mk"; + + String sFile( sMinorMk, RTL_TEXTENCODING_ASCII_US ); + + ReadMinorMk( sFile ); +} + +/*****************************************************************************/ +void MinorMk::ReadMinorMk( const String &rFileName ) +/*****************************************************************************/ +{ + if ( DirEntry( rFileName ).Exists()) { + bExists = TRUE; + SvFileStream aStream( rFileName, STREAM_STD_READ ); + while ( !aStream.IsOpen()) + aStream.Open( rFileName, STREAM_STD_READ ); + + ByteString sLine; + while ( !aStream.IsEof()) { + aStream.ReadLine( sLine ); + + if ( sLine.GetToken( 0, '=' ) == "RSCVERSION" ) + sRSCVERSION = sLine.GetToken( 1, '=' ); + else if ( sLine.GetToken( 0, '=' ) == "RSCREVISION" ) + sRSCREVISION = sLine.GetToken( 1, '=' ); + else if ( sLine.GetToken( 0, '=' ) == "BUILD" ) + sBUILD = sLine.GetToken( 1, '=' ); + else if ( sLine.GetToken( 0, '=' ) == "LAST_MINOR" ) + sLAST_MINOR = sLine.GetToken( 1, '=' ); + } + aStream.Close(); + + sRSCVERSION.EraseTrailingChars(); + sRSCREVISION.EraseTrailingChars(); + sBUILD.EraseTrailingChars(); + sLAST_MINOR.EraseTrailingChars(); + } +} + +/*****************************************************************************/ +MinorMk::~MinorMk() +/*****************************************************************************/ +{ +} + diff --git a/soldep/bootstrp/prj.cxx b/soldep/bootstrp/prj.cxx new file mode 100644 index 000000000000..d13e08a05283 --- /dev/null +++ b/soldep/bootstrp/prj.cxx @@ -0,0 +1,3100 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <stdlib.h> +#include <stdio.h> +#include <bootstrp/sstring.hxx> +#include <vos/mutex.hxx> + +#define ENABLE_BYTESTRING_STREAM_OPERATORS +#include <tools/stream.hxx> +#include <tools/geninfo.hxx> +#include <soldep/prj.hxx> +#include <bootstrp/inimgr.hxx> + +#ifndef MACOSX +#pragma hdrstop +#endif + +//#define TEST 1 + +#ifdef MAC +#define putenv(x) +#endif + +#if defined(DOS) || defined(WNT) || defined(OS2) +#define LIST_DELIMETER ';' +#else +#ifdef UNX +#define LIST_DELIMETER ':' +#else +#ifdef MAC +#define LIST_DELIMETER ',' +#endif +#endif +#endif + +#if defined(DOS) || defined(WNT) || defined(OS2) || defined(WIN) +#define PATH_DELIMETER '\\' +#else +#ifdef UNX +#define PATH_DELIMETER '/' +#else +#ifdef MAC +#define PATH_DELIMETER ':' +#endif +#endif +#endif + +//static const char * XML_ALL = "all"; + +// +// class SimpleConfig +// + +/*****************************************************************************/ +SimpleConfig::SimpleConfig( String aSimpleConfigFileName ) +/*****************************************************************************/ +{ + nLine = 0; + aFileName = aSimpleConfigFileName; + aFileStream.Open ( aFileName, STREAM_READ ); +} + +/*****************************************************************************/ +SimpleConfig::SimpleConfig( DirEntry& rDirEntry ) +/*****************************************************************************/ +{ + nLine = 0; + aFileName = rDirEntry.GetFull(); + aFileStream.Open ( aFileName, STREAM_READ ); +} + +/*****************************************************************************/ +SimpleConfig::~SimpleConfig() +/*****************************************************************************/ +{ + aFileStream.Close (); +} + +/*****************************************************************************/ +ByteString SimpleConfig::GetNext() +/*****************************************************************************/ +{ + ByteString aString; + + if ( aStringBuffer =="" ) + while ((aStringBuffer = GetNextLine()) == "\t"); //solange bis != "\t" + if ( aStringBuffer =="" ) + return ByteString(); + + aString = aStringBuffer.GetToken(0,'\t'); + aStringBuffer.Erase(0, aString.Len()+1); + + aStringBuffer.EraseLeadingChars( '\t' ); + + return aString; +} + +/*****************************************************************************/ +ByteString SimpleConfig::GetNextLine() +/*****************************************************************************/ +{ + ByteString aSecStr; + sal_Bool bStreamOk; +// USHORT iret = 0; + nLine++; + + bStreamOk = aFileStream.ReadLine ( aTmpStr ); + if ( (aTmpStr.Search( "#" ) == 0) ) + return "\t"; + aTmpStr = aTmpStr.EraseLeadingChars(); + aTmpStr = aTmpStr.EraseTrailingChars(); + while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ); + int nLength = aTmpStr.Len(); + if ( bStreamOk && (nLength == 0) ) + return "\t"; +// USHORT nPos = 0; + BOOL bFound = FALSE; + ByteString aEraseString; + for ( USHORT i = 0; i<= nLength; i++) + { +#ifdef MAC + if ( aTmpStr.GetChar( i ) == '"') + { + if ( bFound) bFound = FALSE; + else bFound = TRUE; + aTmpStr.SetChar( i, '\t' ); + } +#endif + if ( aTmpStr.GetChar( i ) == 0x20 && !bFound ) + aTmpStr.SetChar( i, 0x09 ); + } + return aTmpStr; +} + +/*****************************************************************************/ +ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) +/*****************************************************************************/ +{ + + aFileStream.ReadLine ( aTmpStr ); + if ( aTmpStr.Search( "#" ) == 0 ) + if (bReadComments ) + return aTmpStr; + else + while ( aTmpStr.Search( "#" ) == 0 ) + { + aFileStream.ReadLine ( aTmpStr ); + } + + aTmpStr = aTmpStr.EraseLeadingChars(); + aTmpStr = aTmpStr.EraseTrailingChars(); +// while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 ); + int nLength = aTmpStr.Len(); +// USHORT nPos = 0; + ByteString aEraseString; + BOOL bFirstTab = TRUE; + for ( USHORT i = 0; i<= nLength; i++) + { + if ( aTmpStr.GetChar( i ) == 0x20 ) + aTmpStr.SetChar( i, 0x09 ); + + if ( aTmpStr.GetChar( i ) == 0x09 ) + { + if ( bFirstTab ) + bFirstTab = FALSE; + else + { + aTmpStr.SetChar( i, 0x20 ); + } + } + else + bFirstTab = TRUE; + + } + aTmpStr.EraseAllChars(' '); + return aTmpStr; + +} + + +// +// class CommandData +// + +/*****************************************************************************/ +CommandData::CommandData() +/*****************************************************************************/ +{ + nOSType = 0; + nCommand = 0; + pDepList = 0; + pCommandList = 0; +} + +/*****************************************************************************/ +CommandData::~CommandData() +/*****************************************************************************/ +{ + if ( pDepList ) + { + ByteString *pString = pDepList->First(); + while ( pString ) + { + delete pString; + pString = pDepList->Next(); + } + delete pDepList; + + pDepList = NULL; + } + if ( pCommandList ) + { + ByteString *pString = pCommandList->First(); + while ( pString ) + { + delete pString; + pString = pCommandList->Next(); + } + delete pCommandList; + + pCommandList = NULL; + } +} + +/*****************************************************************************/ +ByteString CommandData::GetOSTypeString() +/*****************************************************************************/ +{ + ByteString aRetStr; + + switch (nOSType) + { + case OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC : + aRetStr = "all"; + break; + case OS_WIN32 | OS_WIN16 : + aRetStr = "w"; + break; + case OS_OS2 : + aRetStr = "p"; + break; + case OS_UNX : + aRetStr = "u"; + break; + case OS_WIN16 : + aRetStr = "d"; + break; + case OS_WIN32 : + aRetStr = "n"; + break; + case OS_MAC : + aRetStr = "m"; + break; + default : + aRetStr = "none"; + } + + return aRetStr; +} + +/*****************************************************************************/ +ByteString CommandData::GetCommandTypeString() +/*****************************************************************************/ +{ + ByteString aRetStr; + + switch (nCommand) + { + case COMMAND_NMAKE : + aRetStr = "nmake"; + break; + case COMMAND_GET : + aRetStr = "get"; + break; + default : + aRetStr = "usr"; + aRetStr += ByteString::CreateFromInt64( nCommand + 1 - COMMAND_USER_START ); + + } + + return aRetStr; +} + +/*****************************************************************************/ +void CommandData::AddCommand(ByteString* pCommand) +/*****************************************************************************/ +{ + if (!pCommandList) + pCommandList = new SByteStringList(); + pCommandList->Insert(pCommand, LIST_APPEND); +} + +/*****************************************************************************/ +CommandData& CommandData::operator>> ( SvStream& rStream ) +/*****************************************************************************/ +{ + rStream << aPrj; + rStream << aLogFileName; + rStream << aInpath; + rStream << aUpd; + rStream << aUpdMinor; + rStream << aProduct; + rStream << aCommand; + rStream << aPath; + rStream << aPrePath; + rStream << aPreFix; + rStream << aCommandPara; + rStream << aComment; + rStream << sClientRestriction; + + rStream << nOSType; + rStream << nCommand; + rStream << nDepth; + + if (pDepList) + { + rStream << sal_True; + *pDepList >> rStream; + } + else + rStream << sal_False; + + if (pCommandList) + { + rStream << sal_True; + *pCommandList >> rStream; + } + else + rStream << sal_False; + + return *this; +} + +/*****************************************************************************/ +CommandData& CommandData::operator<< ( SvStream& rStream ) +/*****************************************************************************/ +{ + rStream >> aPrj; + rStream >> aLogFileName; + rStream >> aInpath; + rStream >> aUpd; + rStream >> aUpdMinor; + rStream >> aProduct; + rStream >> aCommand; + rStream >> aPath; + rStream >> aPrePath; + rStream >> aPreFix; + rStream >> aCommandPara; + rStream >> aComment; + rStream >> sClientRestriction; + + rStream >> nOSType; + rStream >> nCommand; + rStream >> nDepth; + + BOOL bDepList; + rStream >> bDepList; + if (pDepList) + pDepList->CleanUp(); + if (bDepList) + { + if (!pDepList) + pDepList = new SByteStringList(); + *pDepList << rStream; + } + else + { + if (pDepList) + DELETEZ (pDepList); + } + + BOOL bCommandList; + rStream >> bCommandList; + if (pCommandList) + pCommandList->CleanUp(); + if (bCommandList) + { + if (!pCommandList) + pCommandList = new SByteStringList(); + *pCommandList << rStream; + } + else + { + if (pCommandList) + DELETEZ (pCommandList); + } + + return *this; +} + + + +// +// class DepInfo +// + +/*****************************************************************************/ +DepInfo::~DepInfo() +/*****************************************************************************/ +{ + RemoveProject(); + + if ( pModeList ) + { + ByteString *pString = pModeList->First(); + while ( pString ) + { + delete pString; + pString = pModeList->Next(); + } + delete pModeList; + + pModeList = NULL; + } +} + +/*****************************************************************************/ +void DepInfo::SetProject (ByteString* pStr) +/*****************************************************************************/ +{ + RemoveProject(); + pProject = pStr; +} + +/*****************************************************************************/ +void DepInfo::RemoveProject () +/*****************************************************************************/ +{ + if (pProject) + { + delete pProject; + pProject = NULL; + } +} + +/*****************************************************************************/ +DepInfo& DepInfo::operator<< ( SvStream& rStream ) +/*****************************************************************************/ +{ + RemoveProject(); + pProject = new ByteString(); + rStream >> *pProject; + + BOOL bModeList; + rStream >> bModeList; + if (pModeList) + pModeList->CleanUp(); + if (bModeList) + { + if (!pModeList) + pModeList = new SByteStringList(); + *pModeList << rStream; + } + else + DELETEZ (pModeList); + + rStream >> bAllModes; + return *this; +} + +/*****************************************************************************/ +DepInfo& DepInfo::operator>> ( SvStream& rStream ) +/*****************************************************************************/ +{ + rStream << *pProject; + if (pModeList) + { + rStream << sal_True; + *pModeList >> rStream; + } + else + rStream << sal_False; + rStream << bAllModes; + + return *this; +} + +// +// class SDepInfoList +// + +/*****************************************************************************/ +SDepInfoList::SDepInfoList() +/*****************************************************************************/ + : pAllModeList(0) +{ +} + +/*****************************************************************************/ +SDepInfoList::~SDepInfoList() +/*****************************************************************************/ +{ + if (pAllModeList) + delete pAllModeList; +} + +/*****************************************************************************/ +ULONG SDepInfoList::IsString( ByteString* pStr ) +/*****************************************************************************/ +{ + ULONG nRet = NOT_THERE; + if ( (nRet = GetPrevString( pStr )) != 0 ) + { + ByteString* pString = GetObject( nRet )->GetProject(); + if ( *pString == *pStr ) + return nRet; + else + return NOT_THERE; + } + else + { + ByteString* pString = GetObject( 0 )->GetProject(); + if ( pString && (*pString == *pStr) ) + return 0; + else + return NOT_THERE; + } + return nRet; +} + +/*****************************************************************************/ +ULONG SDepInfoList::GetPrevString( ByteString* pStr ) +/*****************************************************************************/ +{ + ULONG nRet = 0; + BOOL bFound = FALSE; + ULONG nCount_l = Count(); + ULONG nUpper = nCount_l; + ULONG nLower = 0; + ULONG nCurrent = nUpper / 2; + ULONG nRem = 0; + ByteString* pString; + + do + { + if ( (nCurrent == nLower) || (nCurrent == nUpper) ) + return nLower; + pString = GetObject( nCurrent )->GetProject(); + int nResult = pStr->CompareTo( *pString ); + if ( nResult == COMPARE_LESS ) + { + nUpper = nCurrent; + nCurrent = (nCurrent + nLower) /2; + } + else if ( nResult == COMPARE_GREATER ) + { + nLower = nCurrent; + nCurrent = (nUpper + nCurrent) /2; + } + else if ( nResult == COMPARE_EQUAL ) + return nCurrent; + if ( nRem == nCurrent ) + return nCurrent; + nRem = nCurrent; + } + while ( !bFound ); + return nRet; +} + +/*****************************************************************************/ +void SDepInfoList::PutModeString( DepInfo* pInfoList, ByteString* pStr ) +/*****************************************************************************/ +{ + SByteStringList* pList = pInfoList->GetModeList(); + if (!pList) + { + pList = new SByteStringList; + pInfoList->SetModeList(pList); + + } + + if (pList) + { + // check if string exists + ByteString *pString = pList->First(); + while ( pString ) + { + if (*pString == *pStr) + { + delete pStr; + return; + } + pString = pList->Next(); + } + pList->PutString( pStr ); + } + else + delete pStr; +} + +/*****************************************************************************/ +ULONG SDepInfoList::PutString( ByteString* pStr) +/*****************************************************************************/ +{ + return PutString( pStr, NULL); +} + +/************************************************************************** +* +* Sortiert einen ByteString in die Liste ein und gibt die Position, +* an der einsortiert wurde, zurueck +* +**************************************************************************/ + +ULONG SDepInfoList::PutString( ByteString* pStr, ByteString* pModeStr) +{ + if (pAllModeList) + { + delete pAllModeList; + pAllModeList = NULL; + } + + ULONG nPos = GetPrevString ( pStr ); + if ( Count() ) + { + { + DepInfo* pInfo = GetObject( 0 ); + ByteString* pString = pInfo->GetProject(); + if ( pString->CompareTo( *pStr ) == COMPARE_GREATER ) + { + pInfo = new DepInfo; + if (pInfo) + { + pInfo->SetProject(pStr); + if (pModeStr) + PutModeString(pInfo, pModeStr); + else + pInfo->SetAllModes(); + Insert( pInfo, (ULONG)0 ); + } + return (ULONG)0; + } + } + ByteString* pString = GetObject( nPos )->GetProject(); + if ( *pStr != *pString ) + { + DepInfo* pInfo = new DepInfo; + if (pInfo) + { + pInfo->SetProject(pStr); + if (pModeStr) + PutModeString(pInfo, pModeStr); + else + pInfo->SetAllModes(); + Insert( pInfo, nPos+1 ); + } + return ( nPos +1 ); + } + else + { + delete pStr; + DepInfo* pInfo = GetObject( nPos ); + if (pModeStr) + PutModeString(pInfo, pModeStr); + else + pInfo->SetAllModes(); + return ( nPos +1 ); + } + } + else + { + DepInfo* pInfo = new DepInfo; + if (pInfo) + { + pInfo->SetProject(pStr); + if (pModeStr) + PutModeString(pInfo, pModeStr); + else + pInfo->SetAllModes(); + Insert( pInfo); + return (ULONG)0; + } + } + + delete pStr; + if (pModeStr) + delete pModeStr; + return NOT_THERE; +} + +/*****************************************************************************/ +ByteString* SDepInfoList::RemoveString( const ByteString& rName ) +/*****************************************************************************/ +{ + ULONG i; + ByteString* pReturn; + if (pAllModeList) + { + delete pAllModeList; + pAllModeList = NULL; + } + + for( i = 0 ; i < Count(); i++ ) + { + if ( rName == *(GetObject( i )->GetProject()) ) + { + pReturn = new ByteString(*(GetObject(i)->GetProject())); + DepInfo* pInfo; + pInfo = GetObject(i); + delete pInfo; + Remove(i); + return pReturn; + } + } + + return NULL; +} + +/*****************************************************************************/ +SByteStringList* SDepInfoList::GetAllDepModes() +/*****************************************************************************/ +{ + if (pAllModeList) + return pAllModeList; + + DepInfo *pInfo = First(); + while ( pInfo ) + { + if (!pInfo->IsAllModes() && pInfo->GetModeList()) + { + if (!pAllModeList) + pAllModeList = new SByteStringList(); + ByteString* pStr = pInfo->GetModeList()->First(); + while (pStr) + { + if (pAllModeList->IsString(pStr) == NOT_THERE) + pAllModeList->PutString(pStr); + pStr = pInfo->GetModeList()->Next(); + } + } + pInfo = Next(); + } + return pAllModeList; +} + +/*****************************************************************************/ +SDepInfoList& SDepInfoList::operator<< ( SvStream& rStream ) +/*****************************************************************************/ +{ + ULONG nCount_l; + rStream >> nCount_l; + for ( USHORT i = 0; i < nCount_l; i++ ) { + DepInfo* pDepInfo = new DepInfo(); + *pDepInfo << rStream; + Insert (pDepInfo, LIST_APPEND); + } + return *this; +} + +/*****************************************************************************/ +SDepInfoList& SDepInfoList::operator>> ( SvStream& rStream ) +/*****************************************************************************/ +{ + ULONG nCount_l = Count(); + rStream << nCount_l; + DepInfo* pDepInfo = First(); + while (pDepInfo) { + *pDepInfo >> rStream; + pDepInfo = Next(); + } + + return *this; +} + +/*****************************************************************************/ +CommandData* Prj::GetDirectoryList ( USHORT nWhatOS, USHORT nCommand ) +/*****************************************************************************/ +{ + return (CommandData *)NULL; +} + +/*****************************************************************************/ +CommandData* Prj::GetDirectoryData( ByteString aLogFileName ) +/*****************************************************************************/ +{ + PrjList* pPrjList = GetCommandDataList (); + CommandData *pData = NULL; + ULONG nCount_l = pPrjList->Count(); + for ( ULONG i=0; i<nCount_l; i++ ) + { + pData = pPrjList->GetObject(i); + if ( pData->GetLogFile() == aLogFileName ) + return pData; + } + return NULL; +} + +// +// class Prj +// + +/*****************************************************************************/ +Prj::Prj() : + pPrjInitialDepList(0), + pPrjDepList(0), + pPrjDepInfoList(0), + bSorted( FALSE ), + bHardDependencies( FALSE ), + bFixedDependencies( FALSE ), + bVisited( FALSE ), + bIsAvailable( TRUE ), + pTempCommandDataList (0), + bTempCommandDataListPermanent (FALSE) +/*****************************************************************************/ +{ +} + +/*****************************************************************************/ +Prj::Prj( ByteString aName ) : + aProjectName( aName ), + pPrjInitialDepList(0), + pPrjDepList(0), + pPrjDepInfoList(0), + bSorted( FALSE ), + bHardDependencies( FALSE ), + bFixedDependencies( FALSE ), + bVisited( FALSE ), + bIsAvailable( TRUE ), + pTempCommandDataList (0), + bTempCommandDataListPermanent (FALSE) +/*****************************************************************************/ +{ +} + +/*****************************************************************************/ +Prj::~Prj() +/*****************************************************************************/ +{ + pPrjDepList = RemoveStringList (pPrjDepList); + pPrjInitialDepList = RemoveStringList (pPrjInitialDepList); + pPrjDepInfoList = RemoveDepInfoList (pPrjDepInfoList); +} + +/*****************************************************************************/ +SByteStringList* Prj::RemoveStringList(SByteStringList* pStringList ) +/*****************************************************************************/ +{ + if ( pStringList ) + { + ByteString *pString = pStringList->First(); + while ( pString ) + { + delete pString; + pString = pStringList->Next(); + } + + delete pStringList; + + pStringList = NULL; + } + return pStringList; +} + +/*****************************************************************************/ +SDepInfoList* Prj::RemoveDepInfoList(SDepInfoList* pInfoList ) +/*****************************************************************************/ +{ + if ( pInfoList ) + { + DepInfo *pInfo = pInfoList->First(); + while ( pInfo ) + { + delete pInfo; + pInfo = pInfoList->Next(); + } + + delete pInfoList; + + pInfoList = NULL; + } + return pInfoList; +} + +/*****************************************************************************/ +void Prj::AddDependencies( ByteString aStr ) +/*****************************************************************************/ +{ + + if ( !pPrjDepInfoList ) + pPrjDepInfoList = new SDepInfoList; + + pPrjDepInfoList->PutString( new ByteString(aStr) ); +} + +/*****************************************************************************/ +void Prj::AddDependencies( ByteString aStr, ByteString aModeStr ) +/*****************************************************************************/ +{ + + // needs dirty flag - not expanded + if ( !pPrjDepInfoList ) + pPrjDepInfoList = new SDepInfoList; + + pPrjDepInfoList->PutString( new ByteString(aStr), new ByteString(aModeStr) ); +} + +/*****************************************************************************/ +SByteStringList* Prj::GetDependencies( BOOL bExpanded ) +/*****************************************************************************/ +{ + if ( bExpanded ) + { + if (!pPrjDepList) + SetMode (NULL); + return pPrjDepList; + } + else + { + if (!pPrjInitialDepList) + SetMode (NULL); + return pPrjInitialDepList; + } +} + +/*****************************************************************************/ +void Prj::SetMode(SByteStringList* pModList) +/*****************************************************************************/ +{ + pPrjDepList = RemoveStringList (pPrjDepList); + pPrjInitialDepList = RemoveStringList (pPrjInitialDepList); + + if (!pPrjDepInfoList) + return; + + pPrjDepList = new SByteStringList; + pPrjInitialDepList = new SByteStringList; + + DepInfo *pInfo = pPrjDepInfoList->First(); + while ( pInfo ) + { + if (pInfo->IsAllModes() || !pInfo->GetModeList() || !pModList) + { + pPrjDepList->PutString( new ByteString((ByteString) *(pInfo->GetProject()))); + pPrjInitialDepList->PutString( new ByteString((ByteString) *(pInfo->GetProject()))); + //pPrjDepList->PutString( pInfo->GetProject()); + //pPrjInitialDepList->PutString( pInfo->GetProject()); + } + else + { + BOOL bStringFound = FALSE; + SByteStringList * pDepList = pInfo->GetModeList(); + ByteString *pModString = pDepList->First(); + while ( pModString ) + { + ByteString *pDefModString = pModList->First(); + while ( pDefModString ) + { + if (*pDefModString == *pModString) + { + pPrjDepList->PutString( new ByteString((ByteString) *(pInfo->GetProject()))); + pPrjInitialDepList->PutString( new ByteString((ByteString) *(pInfo->GetProject()))); + //pPrjDepList->PutString( pInfo->GetProject()); + //pPrjInitialDepList->PutString( pInfo->GetProject()); + bStringFound = TRUE; + break; + } + pDefModString = pModList->Next(); + } + if (bStringFound) + break; + pModString = pDepList->Next(); + } + + } + + pInfo = pPrjDepInfoList->Next(); + } +} + +/*****************************************************************************/ +BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, + USHORT aWhatOS, ByteString aLogFileName, + const ByteString &rClientRestriction ) +/*****************************************************************************/ +{ + CommandData* pData = new CommandData(); + + pData->SetPath( aDirName ); + pData->SetCommandType( aWhat ); + pData->SetOSType( aWhatOS ); + pData->SetLogFile( aLogFileName ); + pData->SetClientRestriction( rClientRestriction ); + + PrjList* pPrjList = GetCommandDataList (); + pPrjList->Insert( pData ); + + return FALSE; +} + +/*****************************************************************************/ +// +// removes directory and existing dependencies on it +// +CommandData* Prj::RemoveDirectory ( ByteString aLogFileName ) +/*****************************************************************************/ +{ + PrjList* pPrjList = GetCommandDataList (); + ULONG nCount_l = pPrjList->Count(); + CommandData* pData; + CommandData* pDataFound = NULL; + SByteStringList* pDataDeps; + + for ( USHORT i = 0; i < nCount_l; i++ ) + { + pData = pPrjList->GetObject( i ); + if ( pData->GetLogFile() == aLogFileName ) + pDataFound = pData; + else + { + pDataDeps = pData->GetDependencies(); + if ( pDataDeps ) + { + ByteString* pString; + ULONG nDataDepsCount = pDataDeps->Count(); + for ( ULONG j = nDataDepsCount; j > 0; j-- ) + { + pString = pDataDeps->GetObject( j - 1 ); + if ( pString->GetToken( 0, '.') == aLogFileName ) + pDataDeps->Remove( pString ); + } + } + } + } + + Remove( pDataFound ); + + return pDataFound; +} + +/*****************************************************************************/ +void Prj::ExtractDependencies() +/*****************************************************************************/ +{ + ULONG nPos = 0; + CommandData* pData = GetObject(nPos); + while (pData) + { + SByteStringList* pDepList = pData->GetDependencies(); + if (pDepList) + { + ByteString * pDepStr = pDepList->First(); + while (pDepStr) + { + CommandData* pSearchData = First(); + while (pSearchData) + { + if ((*pDepStr == pSearchData->GetPath()) && (pData->GetOSType() & pSearchData->GetOSType())) + { + *pDepStr = pSearchData->GetLogFile(); + break; + } + + pSearchData = Next(); + } + + pDepStr = pDepList->Next(); + } + } + nPos ++; + pData = GetObject(nPos); + } +} + +/*****************************************************************************/ +PrjList* Prj::GetCommandDataList () +/*****************************************************************************/ +{ + if (pTempCommandDataList) + return pTempCommandDataList; + else + return (PrjList*)this; +} + +/*****************************************************************************/ +void Prj::RemoveTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + { + delete pTempCommandDataList; // this list remove the elements by itself + pTempCommandDataList = NULL; + } +} + +/*****************************************************************************/ +void Prj::GenerateTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + RemoveTempCommandDataList(); + pTempCommandDataList = new PrjList(); + CommandData* pCommandData = First(); + while (pCommandData) { + SvMemoryStream* pStream = new SvMemoryStream(); + *pCommandData >> *pStream; + CommandData* pNewCommandData = new CommandData(); + pStream->Seek( STREAM_SEEK_TO_BEGIN ); + *pNewCommandData << *pStream; + pTempCommandDataList->Insert(pNewCommandData, LIST_APPEND); + delete pStream; + pCommandData = Next(); + } +} + +/*****************************************************************************/ +void Prj::GenerateEmptyTempCommandDataList() +/*****************************************************************************/ +{ + if (pTempCommandDataList) + RemoveTempCommandDataList(); + pTempCommandDataList = new PrjList(); +} + +/*****************************************************************************/ +Prj& Prj::operator>> ( SvStream& rStream ) +/*****************************************************************************/ +{ + rStream << bVisited; + rStream << aProjectName; + rStream << aProjectPrefix; + rStream << bHardDependencies; + rStream << bFixedDependencies; + rStream << bSorted; + rStream << bIsAvailable; + + if (pPrjDepInfoList) + { + rStream << sal_True; + *pPrjDepInfoList >> rStream; + } + else + rStream << sal_False; + + ULONG nCount_l = Count(); + rStream << nCount_l; + + CommandData* pData = First(); + while (pData) { + *pData >> rStream; + pData = Next(); + } + + return *this; +} + +/*****************************************************************************/ +Prj& Prj::operator<< ( SvStream& rStream ) +/*****************************************************************************/ +{ + rStream >> bVisited; + rStream >> aProjectName; + rStream >> aProjectPrefix; + rStream >> bHardDependencies; + rStream >> bFixedDependencies; + rStream >> bSorted; + rStream >> bIsAvailable; + + BOOL bDepList; + rStream >> bDepList; + DELETEZ (pPrjDepInfoList); + if (bDepList) + { + pPrjDepInfoList = new SDepInfoList(); + *pPrjDepInfoList << rStream; + } + + ULONG nCount_l; + rStream >> nCount_l; + + for ( USHORT i = 0; i < nCount_l; i++ ) { + CommandData* pData = new CommandData(); + *pData << rStream; + Insert (pData, LIST_APPEND); + } + + return *this; +} + + +// +// class Star +// + +/*****************************************************************************/ +Star::Star() +/*****************************************************************************/ + : pDepMode (NULL), + pAllDepMode (NULL) +{ + // this ctor is only used by StarWriter +} + +/*****************************************************************************/ +Star::Star(String aFileName, USHORT nMode ) +/*****************************************************************************/ + : nStarMode( nMode ), + sFileName( aFileName ), + pDepMode (NULL), + pAllDepMode (NULL) +{ + Read( aFileName ); +} + +/*****************************************************************************/ +Star::Star(SolarFileList *pSolarFiles ) +/*****************************************************************************/ + : nStarMode( STAR_MODE_MULTIPLE_PARSE ), + pDepMode (NULL), + pAllDepMode (NULL) +{ + // this ctor is used by StarBuilder to get the information for the whole workspace + Read( pSolarFiles ); +} + +/*****************************************************************************/ +Star::Star(GenericInformationList *pStandLst, ByteString &rVersion, + BOOL bLocal, const char *pSourceRoot ) +/*****************************************************************************/ + : pDepMode (NULL), + pAllDepMode (NULL) +{ + UpdateFileList (pStandLst, rVersion, TRUE, bLocal, pSourceRoot); +} + +/*****************************************************************************/ +void Star::UpdateFileList( GenericInformationList *pStandLst, ByteString &rVersion, + BOOL bRead, BOOL bLocal, const char *pSourceRoot ) +/*****************************************************************************/ +{ + sSourceRoot=String::CreateFromAscii(""); // clear old SourceRoot + ByteString sPath( rVersion ); + if ( pSourceRoot ) + sSourceRoot = String::CreateFromAscii( pSourceRoot ); + +#ifdef UNX + sPath += "/settings/UNXSOLARLIST"; +#else + sPath += "/settings/SOLARLIST"; +#endif + GenericInformation *pInfo = pStandLst->GetInfo( sPath, TRUE ); + + if( pInfo && pInfo->GetValue().Len()) { + ByteString sFile( pInfo->GetValue()); + if ( bLocal ) { + IniManager aIniManager; + aIniManager.ToLocal( sFile ); + } + String sFileName_l( sFile, RTL_TEXTENCODING_ASCII_US ); + nStarMode = STAR_MODE_SINGLE_PARSE; + if (bRead) + Read( sFileName_l ); + } + else { + SolarFileList *pFileList = new SolarFileList(); + + sPath = rVersion; + sPath += "/drives"; + + GenericInformation *pInfo_l = pStandLst->GetInfo( sPath, TRUE ); + if ( pInfo_l && pInfo_l->GetSubList()) { + GenericInformationList *pDrives = pInfo_l->GetSubList(); + for ( ULONG i = 0; i < pDrives->Count(); i++ ) { + GenericInformation *pDrive = pDrives->GetObject( i ); + if ( pDrive ) { + DirEntry aEntry; + BOOL bOk = FALSE; + if ( sSourceRoot.Len()) { + aEntry = DirEntry( sSourceRoot ); + bOk = TRUE; + } + else { +#ifdef UNX + sPath = "UnixVolume"; + GenericInformation *pUnixVolume = pDrive->GetSubInfo( sPath ); + if ( pUnixVolume ) { + String sRoot( pUnixVolume->GetValue(), RTL_TEXTENCODING_ASCII_US ); + aEntry = DirEntry( sRoot ); + bOk = TRUE; + } +#else + bOk = TRUE; + String sRoot( *pDrive, RTL_TEXTENCODING_ASCII_US ); + sRoot += String::CreateFromAscii( "\\" ); + aEntry = DirEntry( sRoot ); +#endif + } + if ( bOk ) { + sPath = "projects"; + GenericInformation *pProjectsKey = pDrive->GetSubInfo( sPath, TRUE ); + if ( pProjectsKey ) { + if ( !sSourceRoot.Len()) { + sPath = rVersion; + sPath += "/settings/PATH"; + GenericInformation *pPath = pStandLst->GetInfo( sPath, TRUE ); + if( pPath ) { + ByteString sAddPath( pPath->GetValue()); +#ifdef UNX + sAddPath.SearchAndReplaceAll( "\\", "/" ); +#else + sAddPath.SearchAndReplaceAll( "/", "\\" ); +#endif + String ssAddPath( sAddPath, RTL_TEXTENCODING_ASCII_US ); + aEntry += DirEntry( ssAddPath ); + } + } + sPath = rVersion; + sPath += "/settings/SHORTPATH"; + GenericInformation *pShortPath = pStandLst->GetInfo( sPath, TRUE ); + BOOL bShortPath = FALSE; + if (pShortPath && (pShortPath->GetValue() == "_TRUE")) + bShortPath = TRUE; + sSourceRoot = aEntry.GetFull(); + GenericInformationList *pProjects = pProjectsKey->GetSubList(); + if ( pProjects ) { + GenericInformation * pProject = pProjects->First(); + while (pProject) { + String sLocalSourceRoot = sSourceRoot; + ByteString sProject( *pProject ); + String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); + + ByteString aDirStr ("Directory"); + GenericInformation * pDir = pProject->GetSubInfo (aDirStr); + if (pDir) { + ByteString aDir = pDir->GetValue(); + DirEntry aRootEntry; + if (bShortPath) + aRootEntry = aEntry + DirEntry(aDir); + else + aRootEntry = aEntry.GetPath() + DirEntry(aDir); + sLocalSourceRoot = aRootEntry.GetFull(); + } + + String aBuildListPath = CreateFileName(ssProject, sLocalSourceRoot); + + pFileList->Insert( new String( aBuildListPath ), LIST_APPEND ); + ByteString sFile( aBuildListPath, RTL_TEXTENCODING_ASCII_US ); + pProject = pProjects->Next(); + } + } + } + } + } + } + } + + if (!CheckFileLoadList(pFileList)) + { + ClearAvailableDeps(); + ClearCurrentDeps(); + ClearLoadedFilesList(); + RemoveAllPrj(); + bRead = TRUE; // read new list because old list is deleted + } + + if (bRead) + Read( pFileList ); + else + GenerateFileLoadList( pFileList ); + } +} + +/*****************************************************************************/ +void Star::FullReload( GenericInformationList *pStandLst, ByteString &rVersion, + BOOL bRead, BOOL bLocal, const char *pSourceRoot ) +/*****************************************************************************/ +{ + ClearAvailableDeps(); + ClearCurrentDeps(); + ClearLoadedFilesList(); + RemoveAllPrj(); + UpdateFileList( pStandLst, rVersion, bRead, bLocal, pSourceRoot ); +} + +/*****************************************************************************/ +BOOL Star::CheckFileLoadList(SolarFileList *pSolarFiles) +/*****************************************************************************/ +{ + BOOL bRet = TRUE; + if (aLoadedFilesList.Count() == 0) + return bRet; + StarFile * pLoadFile = aLoadedFilesList.First(); + while (pLoadFile) + { + BOOL bIsAvailable = FALSE; + String * pFile = pSolarFiles->First(); + while (pFile) + { + if (*pFile == pLoadFile->GetName()) + { + bIsAvailable = TRUE; + break; + } + pFile = pSolarFiles->Next(); + } + if (!bIsAvailable) + { + bRet = FALSE; + break; + } + pLoadFile = aLoadedFilesList.Next(); + } + return bRet; +} + +/*****************************************************************************/ +Star::~Star() +/*****************************************************************************/ +{ + ClearAvailableDeps(); + ClearCurrentDeps(); + ClearLoadedFilesList(); + RemoveAllPrj(); +} + +/*****************************************************************************/ +void Star::GenerateFileLoadList( SolarFileList *pSolarFiles ) +/*****************************************************************************/ +{ + SolarFileList* pNewSolarFiles = NULL; + while( pSolarFiles->Count()) { + StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 )); + aMutex.acquire(); + ULONG nPos = SearchFileEntry(&aLoadedFilesList, pFile); + if ( nPos == LIST_ENTRY_NOTFOUND ) + { + if (!pNewSolarFiles) + pNewSolarFiles = new SolarFileList(); + + pNewSolarFiles->Insert(new String(pFile->GetName()), LIST_APPEND ); + } + aMutex.release(); + delete pSolarFiles->Remove(( ULONG ) 0 ); + delete pFile; + } + delete pSolarFiles; + if (pNewSolarFiles) + Read (pNewSolarFiles); +} + +/*****************************************************************************/ +SolarFileList* Star::NeedsFilesForUpdate() +/*****************************************************************************/ +{ + aMutex.acquire(); + SolarFileList* pPrjList = NULL; + for ( ULONG i = 0; i < aLoadedFilesList.Count(); i++ ) + if ( aLoadedFilesList.GetObject( i )->NeedsUpdate()) { + if (!pPrjList) + pPrjList = new SolarFileList(); + + pPrjList->Insert(new String (aLoadedFilesList.GetObject( i )->GetName()), LIST_APPEND); + } + + aMutex.release(); + return pPrjList; +} + +/*****************************************************************************/ +BOOL Star::NeedsUpdate() +/*****************************************************************************/ +{ + aMutex.acquire(); + for ( ULONG i = 0; i < aLoadedFilesList.Count(); i++ ) + if ( aLoadedFilesList.GetObject( i )->NeedsUpdate()) { + aMutex.release(); + return TRUE; + } + + aMutex.release(); + return FALSE; +} + +/*****************************************************************************/ +void Star::Read( String &rFileName ) +/*****************************************************************************/ +{ + ClearAvailableDeps (); + ByteString aString; + aFileList.Insert( new String( rFileName )); + + DirEntry aEntry( rFileName ); + aEntry.ToAbs(); + aEntry = aEntry.GetPath().GetPath().GetPath(); + sSourceRoot = aEntry.GetFull(); + + while( aFileList.Count()) { + String ssFileName = *aFileList.GetObject(( ULONG ) 0 ); + ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); + StarFile *pFile = new StarFile( ssFileName ); + if ( pFile->Exists()) { +// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) +// { +// ReadXmlBuildList(sFileName_l); +// } else { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetNext()) != "" ) + InsertToken (( char * ) aString.GetBuffer()); +// } + } + aMutex.acquire(); + ReplaceFileEntry (&aLoadedFilesList, pFile); + //aLoadedFilesList.Insert( pFile, LIST_APPEND ); + aMutex.release(); + aFileList.Remove(( ULONG ) 0 ); + } + // resolve all dependencies recursive + Expand_Impl(); +} + +/*****************************************************************************/ +ULONG Star::SearchFileEntry( StarFileList *pStarFiles, StarFile* pFile ) +/*****************************************************************************/ +{ + StarFile *pSearchFile; + ULONG nCount_l; + + nCount_l = pStarFiles->Count(); + + for ( ULONG i=0; i<nCount_l; i++) + { + pSearchFile = pStarFiles->GetObject(i); + if ( pSearchFile->GetName() == pFile->GetName() ) + { + return i; + } + } + return LIST_ENTRY_NOTFOUND; +} + +/*****************************************************************************/ +void Star::ReplaceFileEntry( StarFileList *pStarFiles, StarFile* pFile ) +/*****************************************************************************/ +{ + ULONG nPos = SearchFileEntry(pStarFiles, pFile); + if ( nPos != LIST_ENTRY_NOTFOUND ) + { + StarFile* pTmpStarFile = pStarFiles->GetObject(nPos); + delete pTmpStarFile; + pStarFiles->Replace(pFile, nPos); + return; + } + pStarFiles->Insert( pFile, LIST_APPEND ); +} + +/*****************************************************************************/ +void Star::Read( SolarFileList *pSolarFiles ) +/*****************************************************************************/ +{ + ClearAvailableDeps (); + while( pSolarFiles->Count()) { + ByteString aString; + + String ssFileName = *pSolarFiles->GetObject(( ULONG ) 0 ); + ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); + StarFile *pFile = new StarFile( ssFileName ); + + if ( pFile->Exists()) { +// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) +// { +// ReadXmlBuildList(sFileName_l); +// } else { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetNext()) != "" ) + InsertToken (( char * ) aString.GetBuffer()); +// } + + DirEntry aEntry( pFile->GetName() ); + DirEntry aEntryPrj = aEntry.GetPath().GetPath(); + if (aEntryPrj.GetExtension() != String::CreateFromAscii( "" )) + { + aEntryPrj.CutExtension(); + ByteString aPrjName = ByteString( aEntryPrj.GetName(), gsl_getSystemTextEncoding()); + Prj* pPrj = GetPrj(aPrjName); + if (pPrj) + pPrj->IsAvailable (FALSE); + } + + } + + aMutex.acquire(); + ReplaceFileEntry (&aLoadedFilesList, pFile); + //aLoadedFilesList.Insert( pFile, LIST_APPEND ); + aMutex.release(); + delete pSolarFiles->Remove(( ULONG ) 0 ); + } + delete pSolarFiles; + + Expand_Impl(); +} + +/*****************************************************************************/ +String Star::CreateFileName( String& rProject, String& rSourceRoot ) +/*****************************************************************************/ +{ + // this method is used to find solarlist parts of nabours (other projects) + String sPrjDir( String::CreateFromAscii( "prj" )); + String sBuildList( String::CreateFromAscii( "build.lst" )); +// String sXmlBuildList( String::CreateFromAscii( "build.xlist" )); + + DirEntry aEntry( rSourceRoot ); + aEntry += DirEntry( rProject ); + + // if this project not exists, maybe it's a not added project of a CWS + + if ( !aEntry.Exists() ) { + aEntry.SetExtension(String::CreateFromAscii( "lnk" )); + if ( !aEntry.Exists() ) + aEntry.CutExtension(); + + aEntry.SetExtension(String::CreateFromAscii( "link" )); + if ( !aEntry.Exists() ) + aEntry.CutExtension(); + } + + aEntry += DirEntry( sPrjDir ); + +// DirEntry aPossibleEntry(aEntry); +// aPossibleEntry += DirEntry( sXmlBuildList ); + + aEntry += DirEntry( sBuildList ); + + DirEntry& aActualEntry = aEntry; +/* + if (aPossibleEntry.Exists()) { + aActualEntry = aPossibleEntry; + } else */ + if ( !aActualEntry.Exists() && aDBNotFoundHdl.IsSet()) + aDBNotFoundHdl.Call( &rProject ); + return aActualEntry.GetFull(); +} + +/*****************************************************************************/ +void Star::InsertSolarList( String sProject ) +/*****************************************************************************/ +{ + // inserts a new solarlist part of another project + String sFileName_l( CreateFileName( sProject, sSourceRoot )); + + for ( ULONG i = 0; i < aFileList.Count(); i++ ) { + if (( *aFileList.GetObject( i )) == sFileName_l ) + return; + } + + ByteString ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); + if ( HasProject( ssProject )) + return; + + aFileList.Insert( new String( sFileName_l ), LIST_APPEND ); +} + +/*****************************************************************************/ +void Star::ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj ) +/*****************************************************************************/ +{ + if ( pDepPrj->bVisited ) + return; + + pDepPrj->bVisited = TRUE; + + SByteStringList* pPrjLst = pPrj->GetDependencies(); + SByteStringList* pDepLst = NULL; + ByteString* pDepend; + ByteString* pPutStr; + Prj *pNextPrj = NULL; + ULONG i, nRetPos; + + if ( pPrjLst ) { + pDepLst = pDepPrj->GetDependencies(); + if ( pDepLst ) { + for ( i = 0; i < pDepLst->Count(); i++ ) { + pDepend = pDepLst->GetObject( i ); + pPutStr = new ByteString( *pDepend ); + nRetPos = pPrjLst->PutString( pPutStr ); + if( nRetPos == NOT_THERE ) + delete pPutStr; + pNextPrj = GetPrj( *pDepend ); + if ( pNextPrj ) { + ExpandPrj_Impl( pPrj, pNextPrj ); + } + } + } + } +} + +/*****************************************************************************/ +void Star::Expand_Impl() +/*****************************************************************************/ +{ + for ( ULONG i = 0; i < Count(); i++ ) { + for ( ULONG j = 0; j < Count(); j++ ) + GetObject( j )->bVisited = FALSE; + + Prj* pPrj = GetObject( i ); + pPrj->SetMode(pDepMode); // DepList für Mode initialisieren + ExpandPrj_Impl( pPrj, pPrj ); + } +} + +/*****************************************************************************/ +void Star::InsertToken ( char *yytext ) +/*****************************************************************************/ +{ + static int i = 0; + static ByteString aDirName, aWhat, aWhatOS, + sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara; + static BOOL bPrjDep = FALSE; + static BOOL bHardDep = FALSE; + static BOOL bFixedDep = FALSE; + static int nCommandType, nOSType; + CommandData* pCmdData; + static SByteStringList *pStaticDepList; + Prj* pPrj; + + switch (i) + { + case 0: + aPrefix = yytext; + pStaticDepList = 0; + break; + case 1: + aDirName = yytext; + aProjectName = aDirName.GetToken ( 0, 0x5c); + break; + case 2: + if ( !strcmp( yytext, ":" )) + { + bPrjDep = TRUE; + bHardDep = FALSE; + bFixedDep = FALSE; + i = 9; + } + else if ( !strcmp( yytext, "::" )) + { + bPrjDep = TRUE; + bHardDep = TRUE; + bFixedDep = FALSE; + i = 9; + } + else if ( !strcmp( yytext, ":::" )) + { + bPrjDep = TRUE; + bHardDep = TRUE; + bFixedDep = TRUE; + i = 9; + } + else + { + bPrjDep = FALSE; + bHardDep = FALSE; + bFixedDep = FALSE; + + aWhat = yytext; + nCommandType = GetJobType(aWhat); + } + if (bPrjDep) + { + if ( HasProject( aProjectName )) + { + RemovePrj(GetPrj(aProjectName)); + // Projekt exist. schon, entfernen, später neue anlegen + } + } + break; + case 3: + if ( !bPrjDep ) + { + aWhat = yytext; + if ( aWhat == "-" ) + { + aCommandPara = ByteString(); + } + else + aCommandPara = aWhat; + } + break; + case 4: + if ( !bPrjDep ) + { + aWhatOS = yytext; + if ( aWhatOS.GetTokenCount( ',' ) > 1 ) { + sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 ); + aWhatOS = aWhatOS.GetToken( 0, ',' ); + } + nOSType = GetOSType (aWhatOS); + } + break; + case 5: + if ( !bPrjDep ) + { + aLogFileName = (ByteString(aProjectName).Append("_")).Append(yytext); + } + break; + default: + if ( !bPrjDep ) + { + ByteString aItem = yytext; + if ( aItem == "NULL" ) + { + // Liste zu Ende + i = -1; + } + else + { + // ggfs. Dependency liste anlegen und ergaenzen + if ( !pStaticDepList ) + pStaticDepList = new SByteStringList; + ByteString* pStr = new ByteString ((ByteString (aProjectName).Append("_")).Append(aItem)); + pStaticDepList->PutString( pStr ); + } + } + else + { + ByteString aItem = yytext; + if ( aItem == "NULL" ) + { + // Liste zu Ende + i = -1; + bPrjDep= FALSE; + } + else + { + ByteString sMode; + BOOL bHasModes = FALSE; + if (aItem.Search(":") != STRING_NOTFOUND) + { + sMode = aItem.GetToken ( 0, ':'); + aItem = aItem.GetToken ( 1, ':'); + bHasModes = TRUE; + } + + if ( HasProject( aProjectName )) + { + pPrj = GetPrj( aProjectName ); + // Projekt exist. schon, neue Eintraege anhaengen + } + else + { + // neues Project anlegen + pPrj = new Prj ( aProjectName ); + pPrj->SetPreFix( aPrefix ); + Insert(pPrj,LIST_APPEND); + } + if (bHasModes) + pPrj->AddDependencies( aItem, sMode ); + else + pPrj->AddDependencies( aItem ); + pPrj->HasHardDependencies( bHardDep ); + pPrj->HasFixedDependencies( bFixedDep ); + +/* + if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) { + String sItem( aItem, RTL_TEXTENCODING_ASCII_US ); + InsertSolarList( sItem ); + } + */ + } + } + break; + } + /* Wenn dieses Project noch nicht vertreten ist, in die Liste + der Solar-Projekte einfuegen */ + if ( i == -1 ) + { + if ( HasProject( aProjectName )) + { + pPrj = GetPrj( aProjectName ); + // Projekt exist. schon, neue Eintraege anhaengen + } + else + { + // neues Project anlegen + pPrj = new Prj ( aProjectName ); + pPrj->SetPreFix( aPrefix ); + Insert(pPrj,LIST_APPEND); + } + + pCmdData = new CommandData; + pCmdData->SetPath( aDirName ); + pCmdData->SetCommandType( nCommandType ); + pCmdData->SetCommandPara( aCommandPara ); + pCmdData->SetOSType( nOSType ); + pCmdData->SetLogFile( aLogFileName ); + pCmdData->SetClientRestriction( sClientRestriction ); + if ( pStaticDepList ) + pCmdData->SetDependencies( pStaticDepList ); + + pStaticDepList = 0; + pPrj->Insert ( pCmdData, LIST_APPEND ); + aDirName =""; + aWhat =""; + aWhatOS = ""; + sClientRestriction = ""; + aLogFileName = ""; + nCommandType = 0; + nOSType = 0; + } + i++; + + // und wer raeumt die depLst wieder ab ? + // CommandData macht das +} + +/*****************************************************************************/ +BOOL Star::HasProject ( ByteString aProjectName ) +/*****************************************************************************/ +{ + Prj *pPrj; + int nCount_l; + + nCount_l = Count(); + + for ( int i=0; i<nCount_l; i++) + { + pPrj = GetObject(i); + if ( pPrj->GetProjectName().ToLowerAscii() == aProjectName.ToLowerAscii() ) + return TRUE; + } + return FALSE; +} + +/*****************************************************************************/ +Prj* Star::GetPrj ( ByteString aProjectName ) +/*****************************************************************************/ +{ + Prj* pPrj; + int nCount_l = Count(); + for ( int i=0;i<nCount_l;i++) + { + pPrj = GetObject(i); + if ( pPrj->GetProjectName().ToLowerAscii() == aProjectName.ToLowerAscii() ) + return pPrj; + } +// return (Prj*)NULL; + return 0L ; +} + +/*****************************************************************************/ +BOOL Star::RemovePrj ( Prj* pPrj ) +/*****************************************************************************/ +{ + ULONG nPos = GetPos(pPrj); + if (nPos != LIST_ENTRY_NOTFOUND) { + delete pPrj; + Remove(nPos); + return TRUE; + } + return FALSE; +} + +/*****************************************************************************/ +void Star::RemoveAllPrj () +/*****************************************************************************/ +{ + Prj* pPrj = First(); + while (pPrj) + { + delete pPrj; + pPrj = Next(); + } + Clear(); +} + +/*****************************************************************************/ +ByteString Star::GetPrjName( DirEntry &aPath ) +/*****************************************************************************/ +{ + ByteString aRetPrj, aDirName; + ByteString aFullPathName = ByteString( aPath.GetFull(), gsl_getSystemTextEncoding()); + + USHORT nToken = aFullPathName.GetTokenCount(PATH_DELIMETER); + for ( int i=0; i< nToken; i++ ) + { + aDirName = aFullPathName.GetToken( i, PATH_DELIMETER ); + if ( HasProject( aDirName )) + { + aRetPrj = aDirName; + break; + } + } + + return aRetPrj; +} + +/*****************************************************************************/ +void Star::ClearAvailableDeps () +/*****************************************************************************/ +{ + if ( pAllDepMode ) + { + ByteString *pString = pAllDepMode->First(); + while ( pString ) + { + delete pString; + pString = pAllDepMode->Next(); + } + delete pAllDepMode; + pAllDepMode = NULL; + } +} + +/*****************************************************************************/ +void Star::ClearLoadedFilesList () +/*****************************************************************************/ +{ + StarFile *pStarFile = aLoadedFilesList.First(); + while ( pStarFile ) + { + delete pStarFile; + pStarFile = aLoadedFilesList.Next(); + } + aLoadedFilesList.Clear(); +} + +/*****************************************************************************/ +void Star::ClearCurrentDeps () +/*****************************************************************************/ +{ + if ( pDepMode ) + { + ByteString *pString = pDepMode->First(); + while ( pString ) + { + delete pString; + pString = pDepMode->Next(); + } + delete pDepMode; + pDepMode = NULL; + } +} + +/*****************************************************************************/ +SByteStringList* Star::GetAvailableDeps () +/*****************************************************************************/ +{ + if ( pAllDepMode ) + return pAllDepMode; + + Prj *pPrj; + ByteString* pStr; + pPrj = First(); + while (pPrj) + { + SByteStringList* pModeList = NULL; + if (pPrj->GetModeAndDependencies() && (pModeList = pPrj->GetModeAndDependencies()->GetAllDepModes())) + { + pStr = pModeList->First(); + while (pStr) + { + if ( !pAllDepMode ) + pAllDepMode = new SByteStringList(); + + if (pAllDepMode->IsString(pStr) == NOT_THERE) + pAllDepMode->PutString(new ByteString(*pStr)); + + pStr = pModeList->Next(); + } + } + pPrj = Next(); + } + return pAllDepMode; +} + +/*****************************************************************************/ +void Star::SetCurrentDeps (SByteStringList* pDepList) +/*****************************************************************************/ +{ + ClearCurrentDeps(); + + if (pDepList) + { + pDepMode = new SByteStringList(); + ByteString *pString = pDepList->First(); + while ( pString ) + { + ByteString* pStr = new ByteString (*pString); + if (pDepMode->PutString(pStr) == NOT_THERE) + delete pStr; // String is not in List + pString = pDepList->Next(); + } + } + Expand_Impl(); +} + +///*****************************************************************************/ +//void Star::ReadXmlBuildList(const ByteString& sBuildLstPath) { +///*****************************************************************************/ +// if (mpXmlBuildList) { +// Prj* pPrj = NULL; +// +// try { +// mpXmlBuildList->loadXMLFile(sBuildLstPath); +// } +// catch (XmlBuildListException) { +// DirEntry aDirEntry (sBuildLstPath); +// String ssPrjName = aDirEntry.GetPath().GetPath().GetBase(); +// ByteString sPrjName = ByteString(ssPrjName, RTL_TEXTENCODING_ASCII_US); +// pPrj = GetPrj( sPrjName ); +// if (pPrj) +// { +// //remove old Project +// RemovePrj (pPrj); +// } +// return; +// } +// +// try { +// ByteString sProjectName = mpXmlBuildList->getModuleName(); +// pPrj = GetPrj( sProjectName ); +// if (pPrj) +// { +// //remove old Project +// RemovePrj (pPrj); +// } +// +// // insert new Project +// pPrj = new Prj ( sProjectName ); +// pPrj->SetPreFix( sProjectName ); // use ProjectName as Prefix +// Insert(pPrj,LIST_APPEND); +// +// // get global dependencies +// FullByteStringListWrapper aProducts = mpXmlBuildList->getProducts(); +// ByteString aDepType = ByteString(DEP_MD_ALWAYS_STR); +// if (mpXmlBuildList->hasModuleDepType(aProducts, aDepType)) +// pPrj->HasHardDependencies( TRUE ); +// +// aDepType = ByteString(DEP_MD_FORCE_STR); +// if (mpXmlBuildList->hasModuleDepType(aProducts, aDepType)) +// { +// pPrj->HasHardDependencies( TRUE ); +// pPrj->HasFixedDependencies( TRUE ); +// } +// +// // modul dependencies +// ByteString sModulDepType = ByteString(); +// FullByteStringListWrapper aModulDeps = mpXmlBuildList->getModuleDependencies(aProducts, sModulDepType); +// ByteString * pModulDep = aModulDeps.First(); +// while (pModulDep) +// { +// FullByteStringListWrapper aModulProducts = mpXmlBuildList->getModuleProducts(*pModulDep); +// ByteString *pModulePoduct = aModulProducts.First(); +// while (pModulePoduct) +// { +// if (*pModulePoduct == XML_ALL) +// pPrj->AddDependencies( *pModulDep ); +// else +// pPrj->AddDependencies( *pModulDep, *pModulePoduct); +// +// pModulePoduct = aModulProducts.Next(); +// } +// pModulDep = aModulDeps.Next(); +// } +// +// // job dirs +// ByteString sJobType = ByteString(); +// ByteString sJobPlatforms = ByteString(); +// FullByteStringListWrapper aJobDirs = mpXmlBuildList->getJobDirectories(sJobType, sJobPlatforms); // all dirs +// ByteString* pJobDir = aJobDirs.First(); +// while (pJobDir) +// { +// FullByteStringListWrapper aJobPlatforms = mpXmlBuildList->getJobPlatforms (*pJobDir); +// ByteString* pJobPlatform = aJobPlatforms.First(); +// while (pJobPlatform) +// { +// ByteString sJobRestriction = ByteString(); +// FullByteStringListWrapper aJobReq = mpXmlBuildList->getJobBuildReqs (*pJobDir, *pJobPlatform); +// // nur ein Req pro Platform wird zur Zeit unterstützt +// // mehr geht wegen der Struktur zur Zeit nicht! +// // lese sie trotzdem kommasepariert ein, wenn nötig +// if (aJobReq.Count() > 0) +// { +// ByteString* pRestriction = aJobReq.First(); +// sJobRestriction = ByteString (*pRestriction); +// pRestriction = aJobReq.Next(); +// while (pRestriction) +// { +// sJobRestriction += ByteString (","); +// sJobRestriction += ByteString (*pRestriction); +// pRestriction = aJobReq.Next(); +// } +// } +// +// FullByteStringListWrapper aJobTypes = mpXmlBuildList->getJobTypes (*pJobDir); +// ByteString * pJobType = aJobTypes.First(); +// while(pJobType) +// { +// FullByteStringListWrapper aDirDependencies = mpXmlBuildList->getDirDependencies(*pJobDir, *pJobType, *pJobPlatform); +// SByteStringList *pDepList = NULL; +// if (aDirDependencies.Count() > 0) +// { +// pDepList = new SByteStringList; +// ByteString* pDirDep = aDirDependencies.First(); +// while (pDirDep) +// { +// ByteString sFullDir = sProjectName; +// sFullDir += *pDirDep; +// sFullDir.SearchAndReplaceAll('/', '\\'); +// *pDirDep = sFullDir; +// pDepList->PutString(pDirDep); // String wird übergeben +// aDirDependencies.Remove(); // Zeiger aus alter Liste löschen +// pDirDep = aDirDependencies.First(); +// } +// } +// // insert CommandData +// CommandData * pCmdData = new CommandData; +// ByteString sRequiredPath = sProjectName; +// sRequiredPath += *pJobDir; +// sRequiredPath.SearchAndReplaceAll('/', '\\'); +// pCmdData->SetPath(sRequiredPath); +// pCmdData->SetCommandType( GetJobType(*pJobType) ); +// pCmdData->SetCommandPara( ByteString() ); +// pCmdData->SetOSType( GetOSType(*pJobPlatform) ); +// ByteString sLogFileName = sProjectName; +// sLogFileName += ByteString::CreateFromInt64( pPrj->Count() ); +// pCmdData->SetLogFile( sLogFileName ); +// pCmdData->SetClientRestriction( sJobRestriction ); +// if ( pDepList ) +// pCmdData->SetDependencies( pDepList ); +// +// pPrj->Insert ( pCmdData, LIST_APPEND ); +// +// pJobType = aJobTypes.Next(); +// } +// +// pJobPlatform = aJobPlatforms.Next(); +// } +// +// pJobDir = aJobDirs.Next(); +// } +// pPrj->ExtractDependencies(); +// } +// catch (XmlBuildListException) { +// if (pPrj) +// { +// RemovePrj (pPrj); +// delete pPrj; +// } +// +// } +// } +//} + +/*****************************************************************************/ +int Star::GetOSType ( ByteString& aWhatOS ) { +/*****************************************************************************/ + int nOSType = OS_NONE; + if ( aWhatOS == "all" ) + nOSType = ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC ); + else if ( aWhatOS == "w" || aWhatOS == "wnt" ) + nOSType = ( OS_WIN16 | OS_WIN32 ); + else if ( aWhatOS == "p" ) + nOSType = OS_OS2; + else if ( aWhatOS == "u" || aWhatOS == "unx" ) + nOSType = OS_UNX; + else if ( aWhatOS == "d" ) + nOSType = OS_WIN16; + else if ( aWhatOS == "n" ) + nOSType = OS_WIN32; + else if ( aWhatOS == "m" || aWhatOS == "mac" ) + nOSType = OS_MAC; + return nOSType; + +}; + +/*****************************************************************************/ +int Star::GetJobType ( ByteString& JobType ) { +/*****************************************************************************/ + int nCommandType = 0; + if ( JobType == "nmake" || JobType == "make") + nCommandType = COMMAND_NMAKE; + else if ( JobType == "get" ) + nCommandType = COMMAND_GET; + else { + ULONG nOffset = JobType.Copy( 3 ).ToInt32(); + nCommandType = COMMAND_USER_START + nOffset - 1; + } + return nCommandType; +}; + +/*****************************************************************************/ +void Star::PutPrjIntoStream (SByteStringList* pPrjNameList, SvStream* pStream) +/*****************************************************************************/ +{ + aMutex.acquire(); + *pStream << sal_False; // not full Star / only some Projects + + ULONG nCount_l = pPrjNameList->Count(); + *pStream << nCount_l; + ByteString* pStr = pPrjNameList->First(); + while (pStr) { + Prj* pPrj = GetPrj (*pStr); + *pPrj >> *pStream; + pStr = pPrjNameList->Next(); + } + aMutex.release(); +} + +/*****************************************************************************/ +Star& Star::operator>> ( SvStream& rStream ) +/*****************************************************************************/ +{ + aMutex.acquire(); + rStream << sal_True; // full Star + rStream << nStarMode; + if (pDepMode) + { + rStream << sal_True; + *pDepMode >> rStream; + } + else + rStream << sal_False; + + ULONG nCount_l = Count(); + rStream << nCount_l; + Prj* pPrj = First(); + while (pPrj) { + *pPrj >> rStream; + pPrj = Next(); + } + aMutex.release(); + + return *this; +} + +/*****************************************************************************/ +Star& Star::operator<< ( SvStream& rStream ) +/*****************************************************************************/ +{ + aMutex.acquire(); + BOOL bFullList; + rStream >> bFullList; + if (bFullList) + { + rStream >> nStarMode; + BOOL bDepMode; + rStream >> bDepMode; + if (pDepMode) + pDepMode->CleanUp(); + if (bDepMode) + { + if (!pDepMode) + pDepMode = new SByteStringList(); + *pDepMode << rStream; + } + else + DELETEZ (pDepMode); + + } + ULONG nCount_l; + rStream >> nCount_l; + for ( USHORT i = 0; i < nCount_l; i++ ) { + Prj* pPrj = new Prj(); + *pPrj << rStream; + pPrj->SetMode(pDepMode); + if (HasProject (pPrj->GetProjectName())) { + Prj* pTmpPrj = GetPrj( pPrj->GetProjectName() ); + Replace (pPrj, pTmpPrj); + delete pTmpPrj; + } + else + Insert (pPrj, LIST_APPEND); + } + Expand_Impl(); + aMutex.release(); + return *this; +} + + + +// +// class StarWriter +// + +/*****************************************************************************/ +StarWriter::StarWriter( String aFileName, BOOL bReadComments, USHORT nMode ) +/*****************************************************************************/ + : Star () +{ + sFileName = aFileName; + Read ( aFileName, bReadComments, nMode ); +} + +/*****************************************************************************/ +StarWriter::StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments ) +/*****************************************************************************/ + : Star () +{ + Read( pSolarFiles, bReadComments ); +} + +/*****************************************************************************/ +StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, + ByteString &rMinor, BOOL bReadComments, BOOL bLocal, const char *pSourceRoot ) +/*****************************************************************************/ + : Star () +{ + ByteString sPath( rVersion ); + if ( pSourceRoot ) + sSourceRoot = String::CreateFromAscii( pSourceRoot ); + +#ifdef UNX + sPath += "/settings/UNXSOLARLIST"; +#else + sPath += "/settings/SOLARLIST"; +#endif + GenericInformation *pInfo_l = pStandLst->GetInfo( sPath, TRUE ); + + if( pInfo_l && pInfo_l->GetValue().Len()) { + ByteString sFile( pInfo_l->GetValue()); + if ( bLocal ) { + IniManager aIniManager; + aIniManager.ToLocal( sFile ); + } + String sFileName_l( sFile, RTL_TEXTENCODING_ASCII_US ); + nStarMode = STAR_MODE_SINGLE_PARSE; + Read( sFileName_l, bReadComments ); + } + else { + SolarFileList *pFileList = new SolarFileList(); + + sPath = rVersion; + sPath += "/drives"; + + GenericInformation *pInfo_k = pStandLst->GetInfo( sPath, TRUE ); + if ( pInfo_k && pInfo_k->GetSubList()) { + GenericInformationList *pDrives = pInfo_k->GetSubList(); + for ( ULONG i = 0; i < pDrives->Count(); i++ ) { + GenericInformation *pDrive = pDrives->GetObject( i ); + if ( pDrive ) { + DirEntry aEntry; + BOOL bOk = FALSE; + if ( sSourceRoot.Len()) { + aEntry = DirEntry( sSourceRoot ); + bOk = TRUE; + } + else { +#ifdef UNX + sPath = "UnixVolume"; + GenericInformation *pUnixVolume = pDrive->GetSubInfo( sPath ); + if ( pUnixVolume ) { + String sRoot( pUnixVolume->GetValue(), RTL_TEXTENCODING_ASCII_US ); + aEntry = DirEntry( sRoot ); + bOk = TRUE; + } +#else + bOk = TRUE; + String sRoot( *pDrive, RTL_TEXTENCODING_ASCII_US ); + sRoot += String::CreateFromAscii( "\\" ); + aEntry = DirEntry( sRoot ); +#endif + } + if ( bOk ) { + sPath = "projects"; + GenericInformation *pProjectsKey = pDrive->GetSubInfo( sPath, TRUE ); + if ( pProjectsKey ) { + if ( !sSourceRoot.Len()) { + sPath = rVersion; + sPath += "/settings/PATH"; + GenericInformation *pPath = pStandLst->GetInfo( sPath, TRUE ); + if( pPath ) { + ByteString sAddPath( pPath->GetValue()); +#ifdef UNX + sAddPath.SearchAndReplaceAll( "\\", "/" ); +#else + sAddPath.SearchAndReplaceAll( "/", "\\" ); +#endif + //If Minor has been set add it to path + if (rMinor.Len()>0) { + sAddPath += "."; + sAddPath += rMinor; + } + String ssAddPath( sAddPath, RTL_TEXTENCODING_ASCII_US ); + + aEntry += DirEntry( ssAddPath ); + } + } + sPath = rVersion; + sPath += "/settings/SHORTPATH"; + GenericInformation *pShortPath = pStandLst->GetInfo( sPath, TRUE ); + BOOL bShortPath = FALSE; + if (pShortPath && (pShortPath->GetValue() == "_TRUE")) + bShortPath = TRUE; + sSourceRoot = aEntry.GetFull(); + GenericInformationList *pProjects = pProjectsKey->GetSubList(); + if ( pProjects ) { + String sPrjDir( String::CreateFromAscii( "prj" )); + String sSolarFile( String::CreateFromAscii( "build.lst" )); + + GenericInformation * pProject = pProjects->First(); + while (pProject) { + ByteString sProject( *pProject); + String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); + + DirEntry aPrjEntry( aEntry ); + + ByteString aDirStr ("Directory"); + GenericInformation * pDir = pProject->GetSubInfo (aDirStr); + if (pDir) { + ByteString aDir = pDir->GetValue(); + if (bShortPath) + aPrjEntry = aEntry; + else + aPrjEntry = aEntry.GetPath(); + aPrjEntry += DirEntry(aDir); + } + + aPrjEntry += DirEntry( ssProject ); + aPrjEntry += DirEntry( sPrjDir ); + aPrjEntry += DirEntry( sSolarFile ); + + pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND ); + + ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + fprintf( stdout, "%s\n", sFile.GetBuffer()); + pProject = pProjects->Next(); + } + } + } + } + } + } + } + Read( pFileList, bReadComments ); + } +} + +/*****************************************************************************/ +void StarWriter::CleanUp() +/*****************************************************************************/ +{ + Expand_Impl(); +} + +/*****************************************************************************/ +USHORT StarWriter::Read( String aFileName, BOOL bReadComments, USHORT nMode ) +/*****************************************************************************/ +{ + sFileName = aFileName; + + nStarMode = nMode; + + ByteString aString; + aFileList.Insert( new String( aFileName )); + + DirEntry aEntry( aFileName ); + aEntry.ToAbs(); + aEntry = aEntry.GetPath().GetPath().GetPath(); + sSourceRoot = aEntry.GetFull(); + + while( aFileList.Count()) { + String ssFileName = *aFileList.GetObject(( ULONG ) 0 ); + ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); + StarFile *pFile = new StarFile( ssFileName ); + if ( pFile->Exists()) { +// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) +// { +// ReadXmlBuildList(sFileName_l); +// } else { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) + InsertTokenLine ( aString ); + } +// } + + aMutex.acquire(); + aLoadedFilesList.Insert( pFile, LIST_APPEND ); + aMutex.release(); + delete aFileList.Remove(( ULONG ) 0 ); + } + // resolve all dependencies recursive + Expand_Impl(); + + // Die gefundenen Abhaengigkeiten rekursiv aufloesen + Expand_Impl(); + return 0; +} + +/*****************************************************************************/ +USHORT StarWriter::Read( SolarFileList *pSolarFiles, BOOL bReadComments ) +/*****************************************************************************/ +{ + nStarMode = STAR_MODE_MULTIPLE_PARSE; + + // this ctor is used by StarBuilder to get the information for the whole workspace + while( pSolarFiles->Count()) { + ByteString aString; + String ssFileName = *pSolarFiles->GetObject(( ULONG ) 0 ); + ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); + StarFile *pFile = new StarFile( ssFileName); + if ( pFile->Exists()) { +// if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) +// { +// ReadXmlBuildList(sFileName_l); +// } +// else +// { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) + InsertTokenLine ( aString ); +// } + } + + aMutex.acquire(); + aLoadedFilesList.Insert( pFile, LIST_APPEND ); + aMutex.release(); + delete pSolarFiles->Remove(( ULONG ) 0 ); + } + delete pSolarFiles; + + Expand_Impl(); + return 0; +} + +/*****************************************************************************/ +USHORT StarWriter::WritePrj( Prj *pPrj, SvFileStream& rStream ) +/*****************************************************************************/ +{ + ByteString aDataString; + ByteString aTab('\t'); + ByteString aSpace(' '); + ByteString aEmptyString(""); + SByteStringList* pCmdDepList; + SByteStringList* pPrjDepList; + + CommandData* pCmdData = NULL; + if ( pPrj->Count() > 0 ) + { + pCmdData = pPrj->First(); + if ( (pPrjDepList = pPrj->GetDependencies( FALSE )) ) + { + aDataString = pPrj->GetPreFix(); + aDataString += aTab; + aDataString += pPrj->GetProjectName(); + aDataString += aTab; + if ( pPrj->HasFixedDependencies()) + aDataString+= ByteString(":::"); + else if ( pPrj->HasHardDependencies()) + aDataString+= ByteString("::"); + else + aDataString+= ByteString(":"); + aDataString += aTab; + for ( USHORT i = 0; i< pPrjDepList->Count(); i++ ) { + aDataString += *pPrjDepList->GetObject( i ); + aDataString += aSpace; + } + aDataString+= "NULL"; + + rStream.WriteLine( aDataString ); + + pCmdData = pPrj->Next(); + } + if ( pCmdData ) { + do + { + if (( aDataString = pCmdData->GetComment()) == aEmptyString ) + { + aDataString = pPrj->GetPreFix(); + aDataString += aTab; + + aDataString+= pCmdData->GetPath(); + aDataString += aTab; + USHORT nPathLen = pCmdData->GetPath().Len(); + if ( nPathLen < 40 ) + for ( int i = 0; i < 9 - pCmdData->GetPath().Len() / 4 ; i++ ) + aDataString += aTab; + else + for ( int i = 0; i < 12 - pCmdData->GetPath().Len() / 4 ; i++ ) + aDataString += aTab; + aDataString += pCmdData->GetCommandTypeString(); + aDataString += aTab; + if ( pCmdData->GetCommandType() == COMMAND_GET ) + aDataString += aTab; + if ( pCmdData->GetCommandPara() == aEmptyString ) + aDataString+= ByteString("-"); + else + aDataString+= pCmdData->GetCommandPara(); + aDataString += aTab; + aDataString+= pCmdData->GetOSTypeString(); + if ( pCmdData->GetClientRestriction().Len()) { + aDataString += ByteString( "," ); + aDataString += pCmdData->GetClientRestriction(); + } + aDataString += aTab; + aDataString += pCmdData->GetLogFile(); + aDataString += aSpace; + + pCmdDepList = pCmdData->GetDependencies(); + if ( pCmdDepList ) + for ( USHORT i = 0; i< pCmdDepList->Count(); i++ ) { + aDataString += *pCmdDepList->GetObject( i ); + aDataString += aSpace; + } + aDataString += "NULL"; + } + + rStream.WriteLine( aDataString ); + + pCmdData = pPrj->Next(); + } while ( pCmdData ); + } + } + return 0; +} + +/*****************************************************************************/ +USHORT StarWriter::Write( String aFileName ) +/*****************************************************************************/ +{ + sFileName = aFileName; + + FileStat::SetReadOnlyFlag( DirEntry( aFileName ), FALSE ); + + SvFileStream aFileStream; + + aFileStream.Open( aFileName, STREAM_WRITE | STREAM_TRUNC); + if ( !aFileStream.IsOpen() && aFileIOErrorHdl.IsSet()) { + String sError( String::CreateFromAscii( "Error: Unable to open \"" )); + sError += aFileName; + sError += String::CreateFromAscii( "for writing!" ); + aFileIOErrorHdl.Call( &sError ); + } + + if ( Count() > 0 ) + { + Prj* pPrj = First(); + do + { + WritePrj( pPrj, aFileStream ); + pPrj = Next(); + } while ( pPrj ); + } + + aFileStream.Close(); + + return 0; +} + +/*****************************************************************************/ +USHORT StarWriter::WriteMultiple( String rSourceRoot ) +/*****************************************************************************/ +{ + sSourceRoot = rSourceRoot; + + if ( Count() > 0 ) + { + String sPrjDir( String::CreateFromAscii( "prj" )); + String sSolarFile( String::CreateFromAscii( "build.lst" )); + + Prj* pPrj = First(); + do + { + String sName( pPrj->GetProjectName(), RTL_TEXTENCODING_ASCII_US ); + + DirEntry aEntry( rSourceRoot ); + aEntry += DirEntry( sName ); + aEntry += DirEntry( sPrjDir ); + aEntry += DirEntry( sSolarFile ); + + FileStat::SetReadOnlyFlag( aEntry, FALSE ); + + SvFileStream aFileStream; + aFileStream.Open( aEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC); + + if ( !aFileStream.IsOpen() && aFileIOErrorHdl.IsSet()) { + String sError( String::CreateFromAscii( "Error: Unable to open \"" )); + sError += aEntry.GetFull(); + sError += String::CreateFromAscii( "for writing!" ); + aFileIOErrorHdl.Call( &sError ); + } + + WritePrj( pPrj, aFileStream ); + + aFileStream.Close(); + + pPrj = Next(); + } while ( pPrj ); + } + + return 0; +} + +/*****************************************************************************/ +void StarWriter::InsertTokenLine ( ByteString& rString ) +/*****************************************************************************/ +{ + int i = 0; + ByteString aWhat, aWhatOS, + sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara; + static ByteString aDirName; + BOOL bPrjDep = FALSE; + BOOL bHardDep = FALSE; + BOOL bFixedDep = FALSE; + int nCommandType=0, nOSType=0; + CommandData* pCmdData; + SByteStringList *pDepList2 = NULL; + Prj* pPrj; + + ByteString aEmptyString; + ByteString aToken = rString.GetToken( 0, '\t' ); + ByteString aCommentString; + + const char* yytext = aToken.GetBuffer(); + + while ( !( aToken == aEmptyString ) ) + { + switch (i) + { + case 0: + if ( rString.Search( "#" ) == 0 ) + { + i = -1; + aCommentString = rString; + rString = aEmptyString; + if ( Count() == 0 ) + aDirName = "null_entry" ; //comments at begin of file + break; + } + aPrefix = yytext; + pDepList2 = NULL; + break; + case 1: + aDirName = yytext; + break; + case 2: + if ( !strcmp( yytext, ":" )) + { + bPrjDep = TRUE; + bHardDep = FALSE; + bFixedDep = FALSE; + i = 9; + } + else if ( !strcmp( yytext, "::" )) + { + bPrjDep = TRUE; + bHardDep = TRUE; + bFixedDep = FALSE; + i = 9; + } + else if ( !strcmp( yytext, ":::" )) + { + bPrjDep = TRUE; + bHardDep = TRUE; + bFixedDep = TRUE; + i = 9; + } + else + { + bPrjDep = FALSE; + bHardDep = FALSE; + bFixedDep = FALSE; + + aWhat = yytext; + nCommandType = GetJobType(aWhat); + } + break; + case 3: + if ( !bPrjDep ) + { + aWhat = yytext; + if ( aWhat == "-" ) + { + aCommandPara = ByteString(); + } + else + aCommandPara = aWhat; + } + break; + case 4: + if ( !bPrjDep ) + { + aWhatOS = yytext; + if ( aWhatOS.GetTokenCount( ',' ) > 1 ) { + sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 ); + aWhatOS = aWhatOS.GetToken( 0, ',' ); + } + nOSType = GetOSType (aWhatOS); + } + break; + case 5: + if ( !bPrjDep ) + { + aLogFileName = yytext; + } + break; + default: + if ( !bPrjDep ) + { + ByteString aItem = yytext; + if ( aItem == "NULL" ) + { + // Liste zu Ende + i = -1; + } + else + { + // ggfs. Dependency liste anlegen und ergaenzen + if ( !pDepList2 ) + pDepList2 = new SByteStringList; + pDepList2->PutString( new ByteString( aItem )); + } + } + else + { + ByteString aItem = yytext; + if ( aItem == "NULL" ) + { + // Liste zu Ende + i = -1; + bPrjDep= FALSE; + } + else + { + ByteString sMode; + BOOL bHasModes = FALSE; + if (aItem.Search(":") != STRING_NOTFOUND) + { + sMode = aItem.GetToken ( 0, ':'); + aItem = aItem.GetToken ( 1, ':'); + bHasModes = TRUE; + } + + aProjectName = aDirName.GetToken ( 0, 0x5c); + if ( HasProject( aProjectName )) + { + pPrj = GetPrj( aProjectName ); + // Projekt exist. schon, neue Eintraege anhaengen + } + else + { + // neues Project anlegen + pPrj = new Prj ( aProjectName ); + pPrj->SetPreFix( aPrefix ); + Insert(pPrj,LIST_APPEND); + } + if (bHasModes) + pPrj->AddDependencies( aItem, sMode ); + else + pPrj->AddDependencies( aItem ); + pPrj->HasHardDependencies( bHardDep ); + pPrj->HasFixedDependencies( bFixedDep ); + + /* + if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) { + String sItem( aItem, RTL_TEXTENCODING_ASCII_US ); + InsertSolarList( sItem ); + } + */ + } + + } + break; + } + /* Wenn dieses Project noch nicht vertreten ist, in die Liste + der Solar-Projekte einfuegen */ + if ( i == -1 ) + { + aProjectName = aDirName.GetToken ( 0, 0x5c); + if ( HasProject( aProjectName )) + { + pPrj = GetPrj( aProjectName ); + // Projekt exist. schon, neue Eintraege anhaengen + } + else + { + // neues Project anlegen + pPrj = new Prj ( aProjectName ); + pPrj->SetPreFix( aPrefix ); + Insert(pPrj,LIST_APPEND); + } + + pCmdData = new CommandData; + pCmdData->SetPath( aDirName ); + pCmdData->SetCommandType( nCommandType ); + pCmdData->SetCommandPara( aCommandPara ); + pCmdData->SetOSType( nOSType ); + pCmdData->SetLogFile( aLogFileName ); + pCmdData->SetComment( aCommentString ); + pCmdData->SetClientRestriction( sClientRestriction ); + if ( pDepList2 ) + pCmdData->SetDependencies( pDepList2 ); + + pPrj->Insert ( pCmdData, LIST_APPEND ); + + } + i++; + + rString.Erase(0, aToken.Len()+1); + aToken = rString.GetToken( 0, '\t' ); + yytext = aToken.GetBuffer(); + + } + // und wer raeumt die depLst wieder ab ? + // macht CommandData selber +} + +/*****************************************************************************/ +BOOL StarWriter::InsertProject ( Prj* /*pNewPrj*/ ) +/*****************************************************************************/ +{ + return FALSE; +} + +/*****************************************************************************/ +Prj* StarWriter::RemoveProject ( ByteString aProjectName ) +/*****************************************************************************/ +{ + ULONG nCount_l = Count(); + Prj* pPrj; + Prj* pPrjFound = NULL; + SByteStringList* pPrjDeps; + + for ( USHORT i = 0; i < nCount_l; i++ ) + { + pPrj = GetObject( i ); + if ( pPrj->GetProjectName() == aProjectName ) + pPrjFound = pPrj; + else + { + pPrjDeps = pPrj->GetDependencies( FALSE ); + if ( pPrjDeps ) + { + ByteString* pString; + ULONG nPrjDepsCount = pPrjDeps->Count(); + for ( ULONG j = nPrjDepsCount; j > 0; j-- ) + { + pString = pPrjDeps->GetObject( j - 1 ); + if ( pString->GetToken( 0, '.') == aProjectName ) + pPrjDeps->Remove( pString ); + } + } + } + } + + Remove( pPrjFound ); + + return pPrjFound; +} + +// +// class StarFile +// + +/*****************************************************************************/ +StarFile::StarFile( const String &rFile ) +/*****************************************************************************/ + : aFileName( rFile ) +{ + DirEntry aEntry( aFileName ); + if ( aEntry.Exists()) { + bExists = TRUE; + FileStat aStat( aEntry ); + aDate = aStat.DateModified(); + aTime = aStat.TimeModified(); + aDateCreated = aStat.DateCreated(); + aTimeCreated = aStat.TimeCreated(); + } + else + bExists = FALSE; +} + +/*****************************************************************************/ +BOOL StarFile::NeedsUpdate() +/*****************************************************************************/ +{ + DirEntry aEntry( aFileName ); + if ( aEntry.Exists()) { + if ( !bExists ) { + bExists = TRUE; + return TRUE; + } + FileStat aStat( aEntry ); + if (( aStat.DateModified() != aDate ) || ( aStat.TimeModified() != aTime ) + || ( aStat.DateCreated() != aDateCreated ) || ( aStat.TimeCreated() != aTimeCreated )) + return TRUE; + } + return FALSE; +} diff --git a/soldep/bootstrp/prodmap.cxx b/soldep/bootstrp/prodmap.cxx new file mode 100644 index 000000000000..166d111b563b --- /dev/null +++ b/soldep/bootstrp/prodmap.cxx @@ -0,0 +1,517 @@ + /************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "prodmap.hxx" +#include <tools/geninfo.hxx> +#include <tools/fsys.hxx> +#include "minormk.hxx" + +#include <stdio.h> + +#define PRODUCT_KEY "TARGETDESCRIPTION/PRODUCTS" +#define DEPENDS_ON_KEY "TARGETDESCRIPTION/DEPENDSON" +#define BASED_ON_KEY "TARGETDESCRIPTION/BASEDON" + +// +// class ProductMapper +// + +/*****************************************************************************/ +ProductMapper::ProductMapper() +/*****************************************************************************/ + : pVersionList( NULL ), + pProductList( NULL ) +{ +} + +/*****************************************************************************/ +ProductMapper::ProductMapper( GenericInformationList *pVerList ) +/*****************************************************************************/ + : pVersionList( pVerList ), + pProductList( NULL ) +{ + if ( pVerList ) + CreateProductList( pVerList ); +} + +/*****************************************************************************/ +ProductMapper::~ProductMapper() +/*****************************************************************************/ +{ + delete pProductList; +} + +/*****************************************************************************/ +void ProductMapper::CreateProductList( GenericInformationList *pVerList ) +/*****************************************************************************/ +{ + /* + creates a list of the following format: + + ProductName Workspace // 6.0 Final SRC641 + { // { + DependsOn // DependsOn + { // { + product1 // + product2 // + ... // + } // + BasedOn // + { // + productX // + productY // + ... // + } // + } // + */ + + delete pProductList; + pProductList = NULL; + + pVersionList = pVerList; + + if ( pVersionList ) { + ByteString sProductKey( PRODUCT_KEY ); + ByteString sDependsOnKey( DEPENDS_ON_KEY ); + ByteString sBasedOnKey( BASED_ON_KEY ); + + for ( ULONG i = 0; i < pVersionList->Count(); i++ ) { + GenericInformation *pVersion = pVersionList->GetObject( i ); + + GenericInformation *pProducts = pVersion->GetSubInfo( sProductKey, TRUE ); + if ( pProducts ) { + ByteString sProducts = pProducts->GetValue(); + + ByteString sDependsOn; + GenericInformation *pDependsOn = pVersion->GetSubInfo( sDependsOnKey, TRUE ); + if ( pDependsOn ) + sDependsOn = pDependsOn->GetValue(); + + ByteString sBasedOn; + GenericInformation *pBasedOn = pVersion->GetSubInfo( sBasedOnKey, TRUE ); + if ( pBasedOn ) + sBasedOn = pBasedOn->GetValue(); + + for ( USHORT x = 0; x < sProducts.GetTokenCount( ';' ); x++ ) { + ByteString sProduct( sProducts.GetToken( x, ';' )); + if( sProduct.Len()) { + if ( !pProductList ) + pProductList = new GenericInformationList(); + + pProductList->InsertInfo( sProduct, *pVersion, TRUE, TRUE ); + + for ( USHORT y = 0; y < sDependsOn.GetTokenCount( ';' ); y++ ) { + ByteString sDependsOnKey_l = sProduct; + sDependsOnKey_l += "/DependsOn/"; + sDependsOnKey_l += sDependsOn.GetToken( y, ';' ); + + pProductList->InsertInfo( sDependsOnKey_l, "", TRUE, TRUE ); + } + for ( USHORT z = 0; z < sBasedOn.GetTokenCount( ';' ); z++ ) { + ByteString sBasedOnKey_l = sProduct; + sBasedOnKey_l += "/BasedOn/"; + sBasedOnKey_l += sBasedOn.GetToken( z, ';' ); + + pProductList->InsertInfo( sBasedOnKey_l, "", TRUE, TRUE ); + } + } + } + } + } + } +} + +/*****************************************************************************/ +USHORT ProductMapper::GetProductInformation( + const ByteString &rProduct, GenericInformation *& pProductInfo ) +/*****************************************************************************/ +{ + pProductInfo = NULL; + + if ( !pVersionList ) + return PRODUCT_MAPPER_NO_VERSION_INFORMATION; + + if ( !pProductList ) + return PRODUCT_MAPPER_NO_PRODUCT; + + ByteString sProductKey( rProduct ); + pProductInfo = pProductList->GetInfo( sProductKey, TRUE ); + + if ( !pProductInfo ) + return PRODUCT_MAPPER_NO_PRODUCT; + + return PRODUCT_MAPPER_OK; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintDependentTargets( + const ByteString &rProduct, USHORT nLevel ) +/*****************************************************************************/ +{ + GenericInformation *pProductInfo; + + USHORT nReturn = GetProductInformation( rProduct, pProductInfo ); + + if ( nReturn == PRODUCT_MAPPER_OK ) { + for ( USHORT i = 0; i < nLevel; i++ ) + fprintf( stdout, " " ); + fprintf( stdout, "%s (%s)\n", pProductInfo->GetBuffer(), + pProductInfo->GetValue().GetBuffer()); + aPrintedList.PutString( new ByteString( *pProductInfo )); + + for ( ULONG j = 0; j < pProductList->Count(); j++ ) { + GenericInformation *pCandidate = pProductList->GetObject( j ); + ByteString sKey( "DEPENDSON/" ); + sKey += rProduct; + GenericInformation *pDependsOn = pCandidate->GetSubInfo( sKey, TRUE ); + if ( pDependsOn ) + PrintDependentTargets( *pCandidate, nLevel + 1 ); + } + if ( !nLevel ) { + ByteString sKey( "BASEDON" ); + GenericInformation *pBasedOn = pProductInfo->GetSubInfo( sKey ); + if ( pBasedOn ) { + GenericInformationList *pBases = pBasedOn->GetSubList(); + if ( pBases ) { + for ( ULONG k = 0; k < pBases->Count(); k++ ) { + aBaseList.PutString( new ByteString( *pBases->GetObject( k ))); + } + } + } + } + } + + return nReturn; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintAndDeleteBaseList() +/*****************************************************************************/ +{ + if ( aBaseList.Count()) { + fprintf( stdout, "\nbased on\n" ); + while ( aBaseList.Count()) { + ByteString sProduct( *aBaseList.GetObject(( ULONG ) 0 )); + if ( aPrintedList.IsString( aBaseList.GetObject(( ULONG ) 0 )) == NOT_THERE ) { + aPrintedList.PutString( aBaseList.GetObject(( ULONG ) 0 )); + PrintDependentTargets( sProduct ); + } + else + delete aBaseList.GetObject(( ULONG ) 0 ); + + aBaseList.Remove(( ULONG ) 0 ); + } + while ( aPrintedList.Count()) + delete aPrintedList.Remove(( ULONG ) 0 ); + + fprintf( stdout, "\n" ); + } + return PRODUCT_MAPPER_OK; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintDependencies( const ByteString &rProduct ) +/*****************************************************************************/ +{ + USHORT nResult = PrintDependentTargets( rProduct ); + PrintAndDeleteBaseList(); + return nResult; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintProductList() +/*****************************************************************************/ +{ + if ( !pVersionList ) + return PRODUCT_MAPPER_NO_VERSION_INFORMATION; + + if ( !pProductList || !pProductList->Count()) + return PRODUCT_MAPPER_NO_PRODUCT; + + if ( pProductList->Count()) { + for ( ULONG i = 0; i < pProductList->Count(); i++ ) + fprintf( stdout, "%s (%s)\n", + pProductList->GetObject( i )->GetBuffer(), + pProductList->GetObject( i )->GetValue().GetBuffer()); + fprintf( stdout, "\n" ); + } + + return PRODUCT_MAPPER_OK; +} + +/*****************************************************************************/ +SByteStringList *ProductMapper::GetMinorList( + const ByteString &rVersion, const ByteString &rEnvironment ) +/*****************************************************************************/ +{ + SByteStringList *pList = NULL; + + if ( pVersionList ) { + String sRoot( GetVersionRoot( pVersionList, rVersion )); + if ( sRoot.Len()) { + DirEntry aEntry( sRoot ); + aEntry += DirEntry( String( rEnvironment, RTL_TEXTENCODING_ASCII_US )); + String sWildcard( String::CreateFromAscii( "inc.*" )); + aEntry += DirEntry( sWildcard ); + + Dir aDir( aEntry, FSYS_KIND_DIR ); + for ( USHORT i = 0; i < aDir.Count(); i++ ) { + ByteString sInc( aDir[ i ].GetName(), RTL_TEXTENCODING_ASCII_US ); + if ( sInc.GetTokenCount( '.' ) > 1 ) { + if ( !pList ) + pList = new SByteStringList(); + pList->PutString( new ByteString( sInc.GetToken( 1, '.' ))); + } + } + } + } + return pList; +} + +/*****************************************************************************/ +String ProductMapper::GetVersionRoot( + GenericInformationList *pList, const ByteString &rVersion ) +/*****************************************************************************/ +{ + ByteString sKey( rVersion ); + GenericInformation *pVersion = pList->GetInfo( sKey ); + if ( pVersion ) { +#ifdef UNX + sKey = "drives/o:/unixvolume"; + GenericInformation *pUnixVolume = pVersion->GetSubInfo( sKey, TRUE ); + ByteString sPath; + if ( pUnixVolume ) + sPath = pUnixVolume->GetValue(); + sPath += "/"; +#else + ByteString sPath( "o:\\" ); +#endif + sKey = "settings/path"; + GenericInformation *pPath = pVersion->GetSubInfo( sKey, TRUE ); + if ( pPath ) { + sPath += pPath->GetValue().GetToken( 0, '\\' ); + sPath += "/"; + } +#ifdef UNX + sPath.SearchAndReplaceAll( "\\", "/" ); + while( sPath.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) {}; +#else + sPath.SearchAndReplaceAll( "/", "\\" ); + while( sPath.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND ) {}; +#endif + + return String( sPath, RTL_TEXTENCODING_ASCII_US ); + } + return String(); +} + +/*****************************************************************************/ +BaseProductList *ProductMapper::GetBases( + GenericInformation *pProductInfo, USHORT nLevel, + BaseProductList *pBases ) +/*****************************************************************************/ +{ + if ( !pBases ) + pBases = new BaseProductList(); + + if ( pProductInfo ) { + ByteString sCandidate( *pProductInfo ); + sCandidate += " ("; + sCandidate += pProductInfo->GetValue(); + sCandidate += ")"; + + ByteString sKey( "BASEDON" ); + GenericInformation *pBasedOn = pProductInfo->GetSubInfo( sKey ); + if ( pBasedOn ) { + GenericInformationList *pBasesInfo = pBasedOn->GetSubList(); + if ( pBasesInfo ) { + for ( ULONG k = 0; k < pBasesInfo->Count(); k++ ) { + GenericInformation *pBaseProduct; + if ( GetProductInformation( *pBasesInfo->GetObject( k ), pBaseProduct ) == PRODUCT_MAPPER_OK ) + GetBases( pBaseProduct, ++ nLevel, pBases ); + } + } + } + BOOL bFound = FALSE; + ByteString sUpperCandidate( sCandidate ); + sUpperCandidate.ToUpperAscii(); + for ( USHORT i = 0; i < pBases->Count() && !bFound; i++ ) { + ByteString sTest( *pBases->GetObject( i )); + if ( sTest.ToUpperAscii() == sUpperCandidate ) + bFound = TRUE; + } + if ( !bFound ) + pBases->Insert( new ByteString( sCandidate ), ( ULONG ) 0 ); + } + return pBases; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintMinorList( + const ByteString rProduct, const ByteString rEnvironment ) +/*****************************************************************************/ +{ + if ( !pVersionList ) + return PRODUCT_MAPPER_NO_VERSION_INFORMATION; + + if ( !pProductList || !pProductList->Count()) + return PRODUCT_MAPPER_NO_PRODUCT; + + GenericInformation *pProductInfo; + GetProductInformation( rProduct, pProductInfo ); + if ( !pProductInfo ) + return PRODUCT_MAPPER_NO_PRODUCT; + + BaseProductList *pBases = GetBases( pProductInfo ); + if ( pBases->Count()) { + if ( pBases->Count() > 1 ) + fprintf( stdout, "Product \"%s\" based on ", pBases->GetObject(( ULONG ) 0 )->GetBuffer()); + else + fprintf( stdout, "Product \"%s\" based on no other products", pBases->GetObject(( ULONG ) 0 )->GetBuffer()); + + for ( ULONG i = 1; i < pBases->Count(); i++ ) { + fprintf( stdout, "\"%s\"", pBases->GetObject( i )->GetBuffer()); + if ( i < pBases->Count() - 1 ) + fprintf( stdout, ", " ); + } + fprintf( stdout, "\n\n" ); + } + USHORT nResult = PRODUCT_MAPPER_OK; + + if ( rEnvironment.Len()) + nResult = PrintSingleMinorList( pProductInfo, pBases, rEnvironment ); + else { + ByteString sEnvKey( pProductInfo->GetValue()); + sEnvKey += "/Environments"; + + GenericInformation *pEnvironmentInfo = pVersionList->GetInfo( sEnvKey, TRUE ); + if ( pEnvironmentInfo ) { + GenericInformationList *pEnvironmentList = pEnvironmentInfo->GetSubList(); + if ( pEnvironmentList ) { + for ( ULONG i = 0; i < pEnvironmentList->Count(); i++ ) { + USHORT nTmp = PrintSingleMinorList( pProductInfo, pBases, *pEnvironmentList->GetObject( i )); + if ( nTmp != PRODUCT_MAPPER_OK ) + nResult = nTmp; + } + } + } + } + + for ( ULONG m = 0; m < pBases->Count(); m++ ) + delete pBases->GetObject( m ); + delete pBases; + + return nResult; +} + +/*****************************************************************************/ +USHORT ProductMapper::PrintSingleMinorList( + GenericInformation *pProductInfo, BaseProductList *pBases, + const ByteString rEnvironment ) +/*****************************************************************************/ +{ + DirEntry aRoot( GetVersionRoot( pVersionList, pProductInfo->GetValue())); + aRoot += DirEntry( String( rEnvironment, RTL_TEXTENCODING_ASCII_US )); + if ( !aRoot.Exists()) + return PRODUCT_MAPPER_OK; + + SByteStringList *pMinors = GetMinorList( pProductInfo->GetValue(), rEnvironment ); + if ( !pMinors ) + pMinors = new SByteStringList(); + pMinors->Insert( new ByteString( "" ), LIST_APPEND ); + + SByteStringList aOutputList; + BOOL bUnknownMinor = FALSE; + for ( ULONG i = 0; i < pMinors->Count(); i++ ) { + ByteString sOutput; + ByteString sProductVersion; + + for ( ULONG j = 0; j < pBases->Count(); j++ ) { + ByteString sCurProduct( *pBases->GetObject( j )); + ByteString sVersion( sCurProduct.GetToken( sCurProduct.GetTokenCount( '(' ) - 1, '(' ).GetToken( 0, ')' )); + if ( !j ) + sProductVersion = sVersion; + + MinorMk *pMinorMk = new MinorMk( + pVersionList, sProductVersion, sVersion, rEnvironment, *pMinors->GetObject( i )); + + ByteString sMinor( pMinorMk->GetLastMinor().GetBuffer()); + if ( !sMinor.Len()) { + sMinor = "!"; + bUnknownMinor = TRUE; + } + if ( j == 0 ) { + sOutput += pMinorMk->GetBuildNr(); + sOutput += " "; + + if ( i == pMinors->Count() - 1 ) + sOutput += "flat: "; + else + sOutput += " "; + } + sOutput += sVersion; + sOutput += "."; + sOutput += sMinor; + sOutput += "("; + sOutput += pMinorMk->GetBuildNr(); + sOutput += ") "; + } + aOutputList.PutString( new ByteString( sOutput )); + } + ByteString sOldMinor; + + if ( aOutputList.Count()) + fprintf( stdout, "Available builds on %s:\n", rEnvironment.GetBuffer()); + + for ( ULONG o = 0; o < aOutputList.Count(); o++ ) { + ByteString sOutput( *aOutputList.GetObject( o )); + sOutput = sOutput.Copy( sOutput.GetToken( 0, ' ' ).Len() + 1 ); + + ByteString sCurMinor( sOutput.GetToken( 1, '.' ).GetToken( 0, '(' )); + if ( sOldMinor.Len() && sCurMinor < sOldMinor ) { + fprintf( stdout, " ----------\n" ); + } + sOldMinor = sCurMinor; + + fprintf( stdout, "%s\n", sOutput.GetBuffer()); + delete aOutputList.GetObject( o ); + } + if ( bUnknownMinor ) + fprintf( stdout, "Symbol ! indcates that at least one minor could not be found\n\n" ); + else if ( aOutputList.Count()) + fprintf( stdout, "\n" ); + + for ( ULONG l = 0; l < pMinors->Count(); l++ ) + delete pMinors->GetObject( l ); + delete pMinors; + + return PRODUCT_MAPPER_OK; +} + + + + diff --git a/soldep/inc/appdef.hxx b/soldep/inc/appdef.hxx new file mode 100644 index 000000000000..cc8d5d0f2f8b --- /dev/null +++ b/soldep/inc/appdef.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MHAPPDEF_HXX +#define _MHAPPDEF_HXX + + +#ifdef UNX +#define DEFAULT_INI_ROOT "/so/env" +#define DEFAULT_BS_ROOT "/so/env/b_server" +#define DEFAULT_EIS_ROOT "/so/env/merge" +#define PATH_SEPARATOR '/' +#define S_PATH_SEPARATOR "/" +#else +#define DEFAULT_INI_ROOT "r:" +#define DEFAULT_BS_ROOT "n:" +#define DEFAULT_EIS_ROOT "w:" +#define PATH_SEPARATOR '\\' +#define S_PATH_SEPARATOR "\\" +#endif + +#define _INI_DRV DEFAULT_INI_ROOT +#define B_SERVER_ROOT DEFAULT_BS_ROOT +#define DEFAULT_INI_FILE B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "b_server.ini" +#define BINARYROOT B_SERVER_ROOT S_PATH_SEPARATOR "bin" +#define _JOB_DIR B_SERVER_ROOT S_PATH_SEPARATOR "server" S_PATH_SEPARATOR "db" +#define _INJOB_DIR B_SERVER_ROOT S_PATH_SEPARATOR "server" S_PATH_SEPARATOR "dbin" +#define _OUTJOB_DIR B_SERVER_ROOT S_PATH_SEPARATOR "server" S_PATH_SEPARATOR "dbout" +#define _ERRJOB_DIR B_SERVER_ROOT S_PATH_SEPARATOR "server" S_PATH_SEPARATOR "dberr" +#define _BUILDPATTERN_DIR B_SERVER_ROOT S_PATH_SEPARATOR "pattern" +#define _COMMENT_DIR B_SERVER_ROOT S_PATH_SEPARATOR "comment" +#define _SOLARLIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "solar.lst" +#define _DEF_STAND_LIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "stand.lst" +#define _DEF_DEFAULT_LIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "default.lst" +#define _DEF_SSOLARINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.ini" +#define _DEF_SSCOMMON B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.cmn" +#define _SERVER_IDENT_FLAG B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "server.id" +#define _CUSTOMJOBINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "custom.ini" +#define _BUILDCOMMANDINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "bcommand.ini" +#define _DATABASEINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "database.ini" +#define _ZNINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "bszn.ini" +#define _ERRORINFOFILE B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "errinf.lst" +#define _REGEXPINFOFILE B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "regexp.lst" +#define _POSITIVERRORINFOFILE B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "perrinf.lst" +#define _POSITIVREGEXPINFOFILE B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "pregexp.lst" +#define _INIROOT B_SERVER_ROOT S_PATH_SEPARATOR "config" +#define _INIROOT_OLD B_SERVER_ROOT S_PATH_SEPARATOR "config" +#define _ENV_DIR B_SERVER_ROOT S_PATH_SEPARATOR "config" +#define _REDIRECTIONPATH B_SERVER_ROOT S_PATH_SEPARATOR "redir" +#define _ZLOGSPATH B_SERVER_ROOT S_PATH_SEPARATOR "zlogs" +#define DEFAULT_PROTPATH B_SERVER_ROOT S_PATH_SEPARATOR "filesize" +#define _INI_UNC "\\\\jumbo2.germany.sun.com\\R-Laufwerk" +#define _INI_UNC_OLD "\\\\jumbo2.germany.sun.com\\R-Laufwerk" +#define LOG_DIR B_SERVER_ROOT S_PATH_SEPARATOR "log" + +#define _REDIRECTIONSIZE "10000" +#define _EISPATH DEFAULT_EIS_ROOT S_PATH_SEPARATOR "EIS" + +#define _BUILDEVENTPATH _EISPATH S_PATH_SEPARATOR "EventImport" + +#define _WRITE_LOGFILES "1" +#define _WRITE_JOBFILES "1" + +#define _VERSION_WINDOW "0" +#define _JOB_WINDOW "0" +#define _APPWIN_MAXIMIZED "0" +#define _CONTEXT_TBOX "0" + +#define _COLOR_DROPED COL_GRAY +#define _COLOR_WAIT COL_BLUE +#define _COLOR_BUILD COL_GREEN +#define _COLOR_ERROR COL_RED +#define _COLOR_BUILDERROR COL_MAGENTA +#define _COLOR_OK COL_BLACK +#define _COLOR_DELIVERED COL_CYAN +#define _COLOR_MASTERSTOP COL_LIGHTRED + +#define _ASYNCHRON "1" + +// folowing defines are used to write filesize information for binaries +#define OH_GOTT "*" +#define UNX_DEFAULT_FILESIZES "bin/" OH_GOTT ".bin;bin/" OH_GOTT ".res;bin/" OH_GOTT ".tlb;lib/" OH_GOTT ".so" +#define DOS_DEFAULT_FILESIZES "bin\\*.exe;bin\\*.res;bin\\*.dll;bin\\*.tlb" + +#ifdef UNX +#define DEFAULT_FILESIZES UNX_DEFAULT_FILESIZES +#else +#define DEFAULT_FILESIZES DOS_DEFAULT_FILESIZES +#endif + +/** States for BuildServer projects and directories +*/ +#ifndef BuildStatus +#define BuildStatus USHORT +#endif +#define BS_DROPED 0 /// project is waiting for dispatching +#define BS_BUILD 1 /// project/directory is building +#define BS_WAIT 2 /// project/directory is waiting for building +#define BS_OK 3 /// project/directory builded whithout errors +#define BS_BUILDANDERROR 4 /// project is in build, any errors accured +#define BS_ERROR 5 /// project/directory builded with errors +#define BS_NON 6 /// no state is set +#define BS_DELIVERED 7 /// project was delivered without errors +#define BS_DELIVEREDANDERROR 8 /// project was delivered with errors +#define BS_FIXED 9 /// errors are fixed +#define BS_NOTDELIVERED 10 /// project is ready to deliver +#define BS_BUILD_PRIO 11 /// build projects with prio +#define BS_BUILD_ORDER 12 /// build project in correct order +#define BS_BUILD_DEPEND 13 /// build projects using dependencies +#define BS_BUILD_DELIVER 14 /// build projects using dependencies and deliver builded projects +#define BS_BUILD_NORMAL 15 /// build projects without using dependencies +#define BS_BUILD_DELIVER_NO_DEPEND 16 /// build projects without using dependencies and deliver builded projects +#define BS_BUILD_DOUBLE_LOG 17 /// error with double log names + +#define LF_STARDIV "StarDivision" +#define LF_UNIX "UNIX" +#define LF_MAC "Macintosh" +#define LF_OS2 "OS/2" + +// path conversion +const char* GetDefStandList(); +const char* GetIniRoot(); +const char* GetIniRootOld(); +const char* GetSSolarIni(); +const char* GetSSCommon(); +const char* GetBServerRoot(); + +const char* GetEnv( const char *pVar ); +const char* GetEnv( const char *pVar, const char *pDefault ); + +#define CONVERT_R_TO_HOSTFSYS( sPath ) { sPath.ToLowerAscii().SearchAndReplace( "r:", GetEnv("ISERVERBASE", DEFAULT_INI_ROOT ) ); sPath.SearchAndReplaceAll( "\\", S_PATH_SEPARATOR ); } + +// Only for usage inside IServer! +#define ISERVER_DEF_STAND_LIST "r:\\b_server\\config\\stand.lst" +#define ISERVER_DEF_DEPEND_LIST "r:\\b_server\\config\\depend.lst" + +#endif diff --git a/soldep/inc/dep.hxx b/soldep/inc/dep.hxx new file mode 100644 index 000000000000..f7ef15ace882 --- /dev/null +++ b/soldep/inc/dep.hxx @@ -0,0 +1,69 @@ + /************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DEP_HXX +#define _DEP_HXX + +#include <bootstrp/sstring.hxx> + +class SByteExtStringList : public SByteStringList +{ + private: + BOOL bDeleteStrings; + public: + SByteExtStringList(BOOL bDelete = TRUE) : bDeleteStrings (bDelete) {} + ~SByteExtStringList(); +}; + +class VersionDepInfo : public SByteExtStringList +{ + private: + ByteString* pVersion; + public: + VersionDepInfo() : pVersion (NULL) {} + VersionDepInfo(const ByteString& rCurrentVersion) : pVersion (NULL) { pVersion = new ByteString(rCurrentVersion); } + ~VersionDepInfo(); + void Clear(); + const ByteString* GetVersion() { return pVersion; } + //void SetVersion(ByteString* pStr) { pVersion = pStr; } +}; + +DECLARE_LIST( VersionDepInfoList_Impl, VersionDepInfo* ) + +class VersionDepInfoList : public VersionDepInfoList_Impl +{ + public: + VersionDepInfoList () {} + ~VersionDepInfoList () {} + VersionDepInfo* GetVersion (ByteString& rVersion); + void RemoveVersion (ByteString& rVersion); + VersionDepInfo* InsertVersion (ByteString& rVersion); + +}; + + +#endif diff --git a/soldep/inc/dtsodcmp.hrc b/soldep/inc/dtsodcmp.hrc new file mode 100644 index 000000000000..bfeca821562b --- /dev/null +++ b/soldep/inc/dtsodcmp.hrc @@ -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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DTSODCMP_HRC +#define _DTSODCMP_HRC + +//======================================================================== +// Bereiche +#define RID_SD_STRING_START 26000 +#define RID_SD_MENU_START 27000 +#define RID_SD_CONTEXTMENU_START 28500 +#define RID_SD_TOOLBOX_START 29000 +#define RID_SD_WINDOW_START 30000 +#define RID_SD_STATUSBAR_START 30500 +#define RID_SD_IMAGE_START 31000 +#define RID_SD_BITMAP_START 31250 +#define RID_SD_DIALOG_START 31500 +#define RID_SD_DEPPER_DIALOG_START 31750 +// end is at 31999 + +#define SID_START 0 + +//======================================================================== +// Window-Ids + +//======================================================================== +// Menu-Ids +#define RID_SD_MENU_APP (RID_SD_MENU_START) +#define RID_SD_MENU_FILE (RID_SD_MENU_START + 1) +#define RID_SD_MENU_FILE_NEW (RID_SD_MENU_START + 2) +#define RID_SD_MENU_FILE_OPEN (RID_SD_MENU_START + 3) +#define RID_SD_MENU_FILE_SAVE (RID_SD_MENU_START + 4) +#define RID_SD_MENU_FILE_SAVEAS (RID_SD_MENU_START + 5) +#define RID_SD_MENU_FILE_EXIT (RID_SD_MENU_START + 6) +#define RID_SD_MENU_NEW_OBJECT (RID_SD_MENU_START + 7) +#define RID_SD_MENU_REMOVE_LAST (RID_SD_MENU_START + 8) +#define RID_SD_MENU_AUTO (RID_SD_MENU_START + 9) +#define RID_SD_MENU_RUN_TEST (RID_SD_MENU_START + 10) + +//======================================================================== +// ContextMenu-Ids + +//======================================================================== +// ToolBox-Ids +#define RID_SD_TOOLBOX_APP (RID_SD_TOOLBOX_START) +#define RID_SD_TOOLBOX_FILE_NEW (RID_SD_TOOLBOX_START + 1) +#define RID_SD_TOOLBOX_FILE_OPEN (RID_SD_TOOLBOX_START + 2) +#define RID_SD_TOOLBOX_FILE_SAVE (RID_SD_TOOLBOX_START + 3) + + +//======================================================================== +// StatusBar-Ids + +//======================================================================== +// Image-Ids +#define RID_SD_CP_IMAGE (RID_SD_IMAGE_START) + +//======================================================================== +// Dialog-Ids +#define RID_SD_DIALOG_NEWPROJECT (RID_SD_DEPPER_DIALOG_START) +#define RID_SD_DIALOG_NEWDIRECTORY (RID_SD_DEPPER_DIALOG_START + 1) +#define RID_SD_DIALOG_HELP (RID_SD_DEPPER_DIALOG_START + 2) + +//======================================================================== +// String-Ids +#define RID_SD_CP_NAME (RID_SD_STRING_START) + +//======================================================================== +// Slot-Ids + +//======================================================================== +// Format-Ids + +#endif //_DTSODCMP_HRC + diff --git a/soldep/inc/minormk.hxx b/soldep/inc/minormk.hxx new file mode 100644 index 000000000000..0f14497dbaa7 --- /dev/null +++ b/soldep/inc/minormk.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/stream.hxx> + +class GenericInformationList; + +// +// class MinorMk +// + +class MinorMk : public SvFileStream +{ +private: + ByteString sRSCVERSION; + ByteString sRSCREVISION; + ByteString sBUILD; + ByteString sLAST_MINOR; + + BOOL bExists; + + void ReadMinorMk( const String &rFileName ); + +public: + MinorMk( + GenericInformationList *pList, + const ByteString &rVersion, + const ByteString &rWorkStamp, + const ByteString &rEnvironment, + const ByteString &rMinor + ); + MinorMk( + const ByteString &rMinor, + const ByteString &rEnvironment + ); + MinorMk( + GenericInformationList *pList, + const ByteString rVersion + ); + ~MinorMk(); + + ByteString GetRscVersion() + { return sRSCVERSION; } + ByteString GetRscRevision() + { return sRSCREVISION; } + ByteString GetBuildNr() + { return sBUILD; } + ByteString GetLastMinor() + { return sLAST_MINOR; } + + BOOL Exists() + { return bExists; } +}; diff --git a/soldep/inc/prodmap.hxx b/soldep/inc/prodmap.hxx new file mode 100644 index 000000000000..97b554b9e52d --- /dev/null +++ b/soldep/inc/prodmap.hxx @@ -0,0 +1,86 @@ + /************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef PRODUCT_MAPPER_HXX +#define PRODUCT_MAPPER_HXX + +#ifndef _SSTRING_HXX +#include <bootstrp/sstring.hxx> +#endif + +class GenericInformation; +class GenericInformationList; + +DECLARE_LIST( BaseProductList, ByteString * ) + +// +// class ProductMapper +// + +#define PRODUCT_MAPPER_OK 0x0000 +#define PRODUCT_MAPPER_NO_PRODUCT 0x0001 +#define PRODUCT_MAPPER_NO_VERSION_INFORMATION 0x0002 + +class ProductMapper +{ +private: + GenericInformationList *pVersionList; + GenericInformationList *pProductList; + + SByteStringList aBaseList; + SByteStringList aPrintedList; + + USHORT PrintDependentTargets( const ByteString &rProduct, USHORT nLevel = 0 ); + USHORT PrintAndDeleteBaseList(); + + SByteStringList *GetMinorList( const ByteString &rVersion, const ByteString &rEnvironment ); + BaseProductList *GetBases( GenericInformation *pProductInfo, USHORT nLevel = 0, BaseProductList *pBases = NULL ); + + USHORT PrintSingleMinorList( GenericInformation *pProductInfo, BaseProductList *pBases, const ByteString rEnvironment ); + +public: + ProductMapper(); + ProductMapper( GenericInformationList *pVerList ); + + ~ProductMapper(); + + void CreateProductList( GenericInformationList *pVerList ); + + USHORT GetProductInformation( const ByteString &rProduct, GenericInformation *& pProductInfo ); + USHORT PrintDependencies( const ByteString &rProduct ); + USHORT PrintProductList(); + + USHORT PrintMinorList( const ByteString rProduct, const ByteString rEnvironment ); + + static String GetVersionRoot( GenericInformationList *pList, const ByteString &rVersion ); + + GenericInformationList *GetProductList() { return pProductList; } +}; + + +#endif // PRODUCT_MAPPER_HXX + diff --git a/soldep/inc/soldep/connctr.hxx b/soldep/inc/soldep/connctr.hxx new file mode 100644 index 000000000000..40ef986245e5 --- /dev/null +++ b/soldep/inc/soldep/connctr.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _FMRWRK_CONNCTR_HXX +#define _FMRWRK_CONNCTR_HXX + + +#ifndef _SV_WINDOW_HXX +#include <vcl/window.hxx> +#endif +#include <bootstrp/listmacr.hxx> +#include <tools/stream.hxx> + +class DepWin; +class ObjectWin; + +static Rectangle aEmptyRect( Point( 0, 0), Point( 0, 0)); + +class Connector +{ + ObjectWin *mpStartWin, *mpEndWin; + ULONG mnStartId, mnEndId; + Point mStart, mEnd, mCenter; + DepWin* mpParent; + + BOOL bVisible; + BOOL mbHideIndependend; + static BOOL msbHideMode; + + +public: + double len; + Connector( DepWin* pParent, WinBits nWinStyle ); + ~Connector(); + + void Initialize( ObjectWin* pStartWin, ObjectWin* pEndWin, BOOL bVis = FALSE ); + Point GetMiddle(); + void Paint( const Rectangle& rRect ); + void UpdatePosition( ObjectWin* pWin, BOOL bPaint = TRUE ); + USHORT Save( SvFileStream& rOutFile ); + USHORT Load( SvFileStream& rInFile ); + ULONG GetStartId(){ return mnStartId; }; + ULONG GetEndId(){ return mnEndId; }; + ObjectWin* GetStartWin(){ return mpStartWin; }; + ObjectWin* GetEndWin(){ return mpEndWin; }; + ObjectWin* GetOtherWin( ObjectWin* pWin ); + ULONG GetOtherId( ULONG nId ); + ULONG GetLen(); + BOOL IsStart( ObjectWin* pWin ); + void SetHideIndependend( BOOL bHide) { mbHideIndependend = bHide; }; + + BOOL IsVisible() { return bVisible; } + void SetVisibility( BOOL visible ) { bVisible = visible; } + void UpdateVisibility(); + void SetHideMode(BOOL bHide) { msbHideMode = bHide; }; + void DrawOutput( OutputDevice* pDevice, const Point& rOffset ); +}; + +DECLARE_LIST( ConnectorList, Connector* ) + +#endif diff --git a/soldep/inc/soldep/depper.hxx b/soldep/inc/soldep/depper.hxx new file mode 100644 index 000000000000..a9de33c57043 --- /dev/null +++ b/soldep/inc/soldep/depper.hxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_DEPPER_HXX +#define _FMRWRK_DEPPER_HXX + +#include <vcl/window.hxx> +#include <vcl/wrkwin.hxx> +#include <tools/resmgr.hxx> +#include <soldep/objwin.hxx> +#include <soldep/depwin.hxx> +#include <soldep/graphwin.hxx> +#include <soldep/tbox.hxx> +#include <soldep/soldlg.hrc> +#include <soldep/hashtbl.hxx> +#include <soldep/hashobj.hxx> +#include <soldep/soldlg.hxx> +#include <soldep/prj.hxx> +#include <soldep/sdtresid.hxx> + +DECLARE_HASHTABLE_OWNER(SolIdMapper,ByteString,MyHashObject*) + +// just for conversion - convert char* to String +class ProgressBar; +class FixedText; + +#define SOLDEPL_NAME "StarDepend V1.0" + +#define DEPPER_ID 4711 + +//User Events +#define VCLEVENT_USER_MOUSEBUTTON_DOWN 5000 +#define VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT 5001 +#define VCLEVENT_USER_MOUSEBUTTON_DOWN_CTRL 5002 +#define VCLEVENT_USER_MOUSEBUTTON_UP 5003 +#define VCLEVENT_USER_MOUSEBUTTON_UP_ALT 5004 +#define VCLEVENT_USER_MOUSEBUTTON_UP_CTRL 5005 +#define VCLEVENT_USER_MOUSEBUTTON_UP_SHFT 5006 +#define VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK 5007 +#define VCLEVENT_USER_TBOX_RESIZE 5008 +#define VCLEVENT_USER_TBOX_RESIZE_APP 5009 +#define VCLEVENT_USER_TBOX_FIND 5010 +#define VCLEVENT_USER_TBOX_HIDE_INDEPENDEND 5011 +#define VCLEVENT_USER_TBOX_SELECT_WORKSPACE 5012 +#define VCLEVENT_USER_TBOX_BACK 5013 + +#define OBJWIN_X_SPACING 50 +#define OBJWIN_Y_SPACING 12 +#define DEPPER_MAX_DEPTH 100 +#define DEPPER_MAX_WIDTH 12 +#define DEPPER_MAX_LEVEL_WIDTH 10 * DEPPER_MAX_WIDTH + + +#define DEP_OK 0 +#define DEP_OBJECT_NOT_FOUND 1 +#define DEP_STARTID_NOT_FOUND 2 +#define DEP_ENDID_NOT_FOUND 3 +#define DEP_CONNECTOR_NOT_FOUND 4 +#define DEP_ENDLES_RECURSION_FOUND DEPPER_MAX_DEPTH + 1 + +#define DEPPOPUP_NEW 1 +#define DEPPOPUP_AUTOARRANGE 2 +#define DEPPOPUP_LOAD 3 +#define DEPPOPUP_SAVE 4 +#define DEPPOPUP_WRITE_SOURCE 5 +#define DEPPOPUP_READ_SOURCE 6 +#define DEPPOPUP_OPEN_SOURCE 7 +#define DEPPOPUP_ZOOMIN 8 +#define DEPPOPUP_ZOOMOUT 9 +#define DEPPOPUP_CLEAR 10 +#define DEPPOPUP_CLOSE 11 +#define DEPPOPUP_HELP 12 +#define DEPPOPUP_SHOW_TOOLBOX 13 +#define DEPPOPUP_TEST 0xff + +struct depper_head +{ + ULONG nID; + ULONG nObjectCount; + ULONG nCnctrCount; + +}; + +enum DistType +{ + BOTTOMUP = 0, + TOPDOWN = 1, + BOTH = 2 +}; + + +class Depper : public SolDevDll, public Window +{ + BOOL mbIsPrjView; + ULONG mnMinDynXOffs; + Point maDefPos; + Size maDefSize; + + long nZoomed; + + ULONG mnViewMask; + + ProgressBar* pSubBar; + ProgressBar* pMainBar; + FixedText* pSubText; + FixedText* pMainText; + SolAutoarrangeDlg maArrangeDlg; + + +protected: + Prj* mpPrj; + SolIdMapper* mpSolIdMapper; + SolIdMapper* mpPrjIdMapper; + StarWriter* mpStarWriter; + StarWriter* mpPrjStarWriter; //for inside prj-view + ULONG mnSolWinCount; + ULONG mnSolLastId; + ULONG mnPrjWinCount; + ULONG mnPrjLastId; + ObjectList* mpObjectList; //Extended ObjWinList class + ObjectList* mpObjectPrjList; //for module internal dependencies + DepWin* mpBaseWin; + DepWin* mpBasePrjWin; //for inside prj-view + GraphWin* mpGraphWin; + GraphWin* mpGraphPrjWin; //for inside prj-view + Window* mpProcessWin; + Window* mpParentProcessWin; + ObjectWin* ObjIdToPtr( ObjectList* pObjLst, ULONG nId ); + SoldepToolBox maToolBox; + FloatingWindow maTaskBarFrame; // For ToolBox + + ULONG AddObjectToList(DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, BOOL bInteract=TRUE ); + ULONG AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, Point& rPos, Size& rSize ); + ObjectWin* RemoveObjectFromList( ObjectList* pObjLst, ULONG &WinCount, USHORT nId, BOOL bDelete ); + USHORT AddConnectorToObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ); + USHORT RemoveConnectorFromObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ); + USHORT AddConnectorToObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ); + USHORT RemoveConnectorFromObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ); + +public: + Depper( Window* pBaseWindow ); + ~Depper(); + BOOL TogglePrjViewStatus(); + void SetPrjViewStatus(BOOL state) { mbIsPrjView = state; } + BOOL IsPrjView() { return mbIsPrjView; } + GraphWin* GetGraphWin() { return (!mbIsPrjView) ? mpGraphWin : mpGraphPrjWin; } //scrollbar window + DepWin* GetDepWin() { return (!mbIsPrjView) ? mpBaseWin : mpBasePrjWin; } //content of scrollbar window + ProgressBar* GetMainProgressBar() { return pMainBar; } + void SetMainProgressBar( USHORT i); + void UpdateMainProgressBar(USHORT i, USHORT nScaleVal, USHORT &nStep, BOOL bCountingDown = FALSE); + void UpdateSubProgrssBar(ULONG i); + void SetTitle( const String &rTitle ) { mpProcessWin->SetText( rTitle ); } + virtual void RemoveAllObjects( ObjectList* ObjLst ); + USHORT Save( const ByteString& rFileName ); +// USHORT Load( const ByteString& rFileName ); + virtual USHORT WriteSource(); + virtual USHORT ReadSource( BOOL bUpdater ); + virtual USHORT OpenSource(); + void SetDefPos( Point& rPos ) { maDefPos = rPos; }; + Point& GetDefPos() { return maDefPos; }; + void SetDefSize( Size& rSize ) { maDefSize = rSize; }; + Size& GetDefSize() { return maDefSize; }; + virtual USHORT AutoArrangeDlgStart(); + virtual USHORT AutoArrangeDlgStop(); + virtual USHORT Zoom( MapMode& rMapMode ); + virtual BOOL ViewContent( ByteString& ) { return FALSE; }; + virtual USHORT CloseWindow() { return 0; }; + virtual void ShowHelp(){}; + ObjectList* GetObjectList() { return (!mbIsPrjView) ? mpObjectList : mpObjectPrjList; } + ULONG HandleNewPrjDialog( ByteString &rBodyText ); + ULONG HandleNewDirectoryDialog( ByteString &rBodyText ); + void HideObjectsAndConnections( ObjectList* pObjLst ); + void ShowObjectsAndConnections( ObjectList* pObjLst ); + //virtual void MouseButtonDown( const MouseEvent& rMEvt ); +//#ifdef DEBUG + virtual void test(){}; + DECL_LINK( PopupSelected, PopupMenu* ); +//#endif + + //void SetViewMask( ULONG nMask ); + ULONG GetViewMask() { return mnViewMask; } +}; + +#endif diff --git a/soldep/inc/soldep/depwin.hxx b/soldep/inc/soldep/depwin.hxx new file mode 100644 index 000000000000..4464e91aa59a --- /dev/null +++ b/soldep/inc/soldep/depwin.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_DEPWIN_HXX +#define _FMRWRK_DEPWIN_HXX + +#ifndef _SV_WRKWIN_HXX +#include <vcl/wrkwin.hxx> +#endif +#include <vcl/menu.hxx> +#include <svtools/scrwin.hxx> +#include <soldep/connctr.hxx> + +class Depper; + +class DepWin : public Window +{ +private: + ConnectorList ConList; + + ObjectWin* mpNewConWin; + BOOL mbStartNewCon; + Point maNewConStart; + Point maNewConEnd; + ObjectWin* mpSelectedProject; + +public: + PopupMenu* mpPopup; +// Depper* mpDepperDontuseme; + + DepWin( Window* pParent, WinBits nWinStyle ); + ~DepWin(); + void AddConnector( Connector* pNewCon ); + void RemoveConnector( Connector* piOldCon ); + void NewConnector( ObjectWin* pWin ); + ConnectorList* GetConnectorList(); + void ClearConnectorList() { ConList.Clear();} + void Paint( const Rectangle& rRect ); + void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void Command( const CommandEvent& rEvent); +// void Resize(); + void MouseMove( const MouseEvent& rMEvt ); + BOOL IsStartNewCon() { return mbStartNewCon; }; + void SetPopupHdl( void* pHdl ); + void SetSelectedProject( ObjectWin* object ) { mpSelectedProject = object; }; + ObjectWin* GetSelectedProject() { return mpSelectedProject; }; +// DECL_LINK( PopupSelected, PopupMenu* ); + void DrawOutput( OutputDevice* pDevice, const Point& rOffset ); +}; + +#endif diff --git a/soldep/inc/soldep/graphwin.hxx b/soldep/inc/soldep/graphwin.hxx new file mode 100644 index 000000000000..e0152d6e34f7 --- /dev/null +++ b/soldep/inc/soldep/graphwin.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_GRAPHWIN_HXX +#define _FMRWRK_GRAPHWIN_HXX + +#include <svtools/scrwin.hxx> + +class GraphWin : public ScrollableWindow +{ +private: + void* mpClass; + +protected: + Window aBufferWindow; + +public: + GraphWin( Window * pParent, void * pClass ); + void CalcSize(); + virtual void EndScroll( long nDeltaX, long nDeltaY ); + virtual void Resize(); + virtual void Command( const CommandEvent& rEvent); + Window* GetBufferWindow(){ return &aBufferWindow; }; +}; + +#define PIXELS( nLeft, nTop, nWidth, nHeight )\ + LogicToPixel( Point( nLeft, nTop ) ), LogicToPixel( Size( nWidth, nHeight ) ) + +#endif // _FMRWRK_GRAPHWIN_HXX + diff --git a/soldep/inc/soldep/hashobj.hxx b/soldep/inc/soldep/hashobj.hxx new file mode 100644 index 000000000000..73d4daf699e7 --- /dev/null +++ b/soldep/inc/soldep/hashobj.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_HASHOBJ_HXX +#define _FMRWRK_HASHOBJ_HXX + +#include <soldep/hashtbl.hxx> + +class ObjectWin; + +class MyHashObject +{ + ObjectWin* mpWin; + ULONG mnId; +public: + MyHashObject( ULONG nId, ObjectWin* pWin ); + ULONG GetId() { return mnId; }; +}; + +#endif + diff --git a/soldep/inc/soldep/hashtbl.hxx b/soldep/inc/soldep/hashtbl.hxx new file mode 100644 index 000000000000..0308a6a33e0e --- /dev/null +++ b/soldep/inc/soldep/hashtbl.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _HASHTBL_HXX +#define _HASHTBL_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> + +// ADT hash table +// +// Invariante: +// 1. m_lElem < m_lSize +// 2. die Elemente in m_Array wurden double-hashed erzeugt +// +class HashItem; + +class HashTable +{ + ULONG m_lSize; + ULONG m_lElem; + HashItem *m_pData; + double m_dMaxLoadFactor; + double m_dGrowFactor; + BOOL m_bOwner; + + ULONG Hash(ByteString const& Key) const; + ULONG DHash(ByteString const& Key, ULONG lHash) const; + ULONG Probe(ULONG lPos) const; + + HashItem* FindPos(ByteString const& Key) const; + void SmartGrow(); + double CalcLoadFactor() const; + +// Statistik +#ifdef DBG_UTIL +private: + struct + { + ULONG m_lSingleHash; + ULONG m_lDoubleHash; + ULONG m_lProbe; + } + m_aStatistic; +#endif + +protected: + friend class HashTableIterator; + + virtual void OnDeleteObject(void* pObject); + + void* GetObjectAt(ULONG lPos) const; + +// Default-Werte +public: + static double m_defMaxLoadFactor; + static double m_defDefGrowFactor; + +public: + HashTable + ( + ULONG lSize, + BOOL bOwner, + double dMaxLoadFactor = HashTable::m_defMaxLoadFactor /* 0.8 */, + double dGrowFactor = HashTable::m_defDefGrowFactor /* 2.0 */ + ); + + virtual ~HashTable(); + + BOOL IsFull() const; + ULONG GetSize() const { return m_lSize; } + + void* Find (ByteString const& Key) const; + BOOL Insert (ByteString const& Key, void* pObject); + void* Delete (ByteString const& Key); +}; + +// ADT hash table iterator +// +// Invariante: 0 <= m_lAt < m_aTable.GetCount() +// +class HashTableIterator +{ + ULONG m_lAt; + HashTable const& m_aTable; + + void* FindValidObject(BOOL bForward); + +protected: + void* GetFirst(); // Interation _ohne_ Sortierung + void* GetNext(); + void* GetLast(); + void* GetPrev(); + +public: + HashTableIterator(HashTable const&); +}; + +// typsichere Makros --------------------------------------------------- + +#define DECLARE_HASHTABLE_INTERN(ClassName,Owner,KeyType,ObjType) \ + class ClassName : public HashTable \ + { \ + public: \ + ClassName \ + ( \ + ULONG lSize, \ + double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \ + double dGrowFactor = HashTable::m_defDefGrowFactor \ + ) \ + : HashTable(lSize,Owner,dMaxLoadFactor,dGrowFactor) {} \ + \ + ObjType Find (KeyType const& Key) const \ + { return (ObjType) HashTable::Find(ByteString(Key)); } \ + \ + using HashTable::Insert; \ + BOOL Insert (KeyType const& Key, ObjType Object) \ + { return HashTable::Insert(ByteString(Key), (void*) Object); } \ + \ + ObjType Delete (KeyType const&Key) \ + { return (ObjType) HashTable::Delete (ByteString(Key)); } \ + }; + +// HashTable OHNE Owner-Verhalten +#define DECLARE_HASHTABLE(ClassName,KeyType,ObjType) \ + DECLARE_HASHTABLE_INTERN(ClassName,FALSE,KeyType,ObjType) + +// HashTable MIT Owner-Verhalten +#define DECLARE_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \ + DECLARE_HASHTABLE_INTERN(ClassName##2,TRUE,KeyType,ObjType) \ + class ClassName : public ClassName##2 \ + { \ + protected: \ + virtual void OnDeleteObject(void* pObject); \ + public: \ + ClassName \ + ( \ + ULONG lSize, \ + double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \ + double dGrowFactor = HashTable::m_defDefGrowFactor \ + ) \ + : ClassName##2(lSize,dMaxLoadFactor,dGrowFactor) {} \ + ~ClassName(); \ + }; + +#define IMPLEMENT_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \ + void ClassName::OnDeleteObject(void* pObject) \ + { delete (ObjType) pObject; } \ + \ + ClassName::~ClassName() \ + { \ + for (ULONG i=0; i<GetSize(); i++) \ + { \ + void *pObject = GetObjectAt(i); \ + if (pObject != NULL) \ + OnDeleteObject(pObject); \ + } \ + } + +// Iterator-Makros -------------------------------------------------- + +#define DECLARE_HASHTABLE_ITERATOR(ClassName,ObjType) \ + class ClassName : public HashTableIterator \ + { \ + public: \ + ClassName(HashTable const& aTable) \ + : HashTableIterator(aTable) {} \ + \ + ObjType GetFirst() \ + { return (ObjType)HashTableIterator::GetFirst(); } \ + ObjType GetNext() \ + { return (ObjType)HashTableIterator::GetNext(); } \ + ObjType GetLast() \ + { return (ObjType)HashTableIterator::GetLast(); } \ + ObjType GetPrev() \ + { return (ObjType)HashTableIterator::GetPrev(); } \ + }; + + +#endif // _HASHTBL_HXX diff --git a/soldep/inc/soldep/objwin.hxx b/soldep/inc/soldep/objwin.hxx new file mode 100644 index 000000000000..e7bc94826858 --- /dev/null +++ b/soldep/inc/soldep/objwin.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_OBJWIN_HXX +#define _FMRWRK_OBJWIN_HXX + +#ifndef _SV_WINDOW_HXX +#include <vcl/window.hxx> +#endif +#include <vcl/menu.hxx> +#include <vcl/timer.hxx> +#include <bootstrp/listmacr.hxx> +#include <tools/stream.hxx> + +#include <soldep/connctr.hxx> + +#define OBJWIN_EDIT_TEXT 1 +#define OBJWIN_ADD_CONNECTOR 2 +#define OBJWIN_REMOVE_WIN 3 +#define OBJWIN_VIEW_CONTENT 4 + +#define MARKMODE_DEFAULT 0 +#define MARKMODE_DEPENDING 1 +#define MARKMODE_NEEDED 2 +#define MARKMODE_ACTIVATED 4 +#define MARKMODE_SELECTED 8 + +class Depper; +class Connector; +class ObjectWin; + +class ObjectWin : public Window +{ + Point maMouseOffset; + Point maCalcPos; + ByteString msBodyText; + ByteString msTipText; + ULONG mnObjectId; + PopupMenu* mpPopup; + USHORT mnPopupStaticItems; + Wallpaper maObjWallpaper; + ConnectorList mConnections; + ULONG mnMarkMode; + ULONG mnViewMask; + BOOL mbVisible; + BOOL mbMenuExecute; + static BOOL msbHideMode; + static ULONG msnGlobalViewMask; //will be set by SolDep + +public: + BOOL mbVisited; +// double x, y; + + USHORT mnRootDist; + USHORT mnHeadDist; + BOOL mbFixed; + //Depper* mpDepperDontuseme; + Timer aTipTimer; + + ObjectWin( Window* pParent, WinBits nWinStyle ); + ~ObjectWin(); + void SetHideMode(BOOL bHide); + BOOL ToggleHideMode(); + BOOL IsHideMode() { return msbHideMode; }; + BOOL IsNullObject() { return (msBodyText == "null"); }; + void SetGlobalViewMask(ULONG gvm) { msnGlobalViewMask = gvm; }; + void SetBodyText( const ByteString& rNewText ); + ByteString& GetBodyText(); + ULONG GetIdByName( const ByteString& rText ); + void SetTipText( const ByteString& rNewText ); + ByteString& GetTipText(); + Point GetFixPoint( const Point& rRefPoint, BOOL bUseRealPos = TRUE ); + + void SetCalcPosPixel( const Point& rNewPos ){ maCalcPos = rNewPos; }; + Point GetCalcPosPixel() const { return maCalcPos; } + + void AddConnector( Connector* pNewCon ); + void RemoveConnector( Connector* pOldCon ); + Connector* GetConnector( ULONG nIndex ); + Connector* GetConnector( ULONG nStartId, ULONG nEndId ); + virtual void SetMarkMode( ULONG nMarkMode = 0 ); + virtual void UnsetMarkMode( ULONG nMarkMode ); + ULONG GetMarkMode(){ return mnMarkMode; }; + Wallpaper GetActualWallpaper() { return maObjWallpaper;}; + void SetActualWallpaper(const Wallpaper& aWp) { maObjWallpaper = aWp;}; + void MarkNeeded( BOOL bReset = FALSE ); + void MarkDepending( BOOL bReset = FALSE ); + void Paint( const Rectangle& rRecct ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + void MouseMove( const MouseEvent& rMEvt ); +// void DoubleClick(); + USHORT Save( SvFileStream& rOutFile ); + USHORT Load( SvFileStream& rInFile ); + void SetId( ULONG nId ); + ULONG GetId(); + void UpdateConnectors(); + void SetAllConnectorsUnvisible(); + virtual void Command( const CommandEvent& rEvent); + + void SetViewMask( ULONG nMask ); + ULONG GetViewMask() { return mnViewMask; } + using Window::IsVisible; + BOOL IsVisible() { return mbVisible; } + + DECL_LINK( PopupSelected, PopupMenu * ); + DECL_LINK( PopupDeactivated, PopupMenu * ); + DECL_LINK( TipHdl, void * ); + + //virtual void GetFocus(); + virtual void LoseFocus(); + + BOOL ConnectionExistsInAnyDirection( ObjectWin *pWin ); + void DrawOutput( OutputDevice* pDevice, const Point& rOffset ); + BOOL IsTop(); +}; + +DECL_DEST_LIST( TmpObjWinList, ObjWinList, ObjectWin* ) + +//Extend ObjWinList +class ObjectList : public ObjWinList +{ +private: + ObjectWin* pSelectedObjectWin; +protected: + BOOL mbHideMode; +public: + ObjectList(); + ~ObjectList() {}; + void ResetSelectedObject(); + ObjectWin* GetPtrByName( const ByteString& rText ); + ObjectList* FindTopLevelModules(); +}; + +#endif + diff --git a/soldep/inc/soldep/prj.hxx b/soldep/inc/soldep/prj.hxx new file mode 100644 index 000000000000..b04d6ac1fe4e --- /dev/null +++ b/soldep/inc/soldep/prj.hxx @@ -0,0 +1,480 @@ + /************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PRJ_HXX +#define _PRJ_HXX + +#include <tools/fsys.hxx> +#include <tools/stream.hxx> +#ifndef _LISTMACR_HXX +#include <bootstrp/listmacr.hxx> +#endif +#include <vos/mutex.hxx> +#include <tools/string.hxx> + +#define XML_EXT "xlist" + +#define OS_NONE 0x0000 +#define OS_WIN16 0x0001 +#define OS_WIN32 0x0002 +#define OS_OS2 0x0004 +#define OS_UNX 0x0008 +#define OS_MAC 0x0010 +#define OS_ALL ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC ) + +#define COMMAND_PROJECTROOT 0x0000 +#define COMMAND_NMAKE 0x0001 +#define COMMAND_GET 0x0002 +#define COMMAND_USER_START 0x0003 +#define COMMAND_USER_END 0xFFFE +#define COMMAND_ALLDIRS 0xFFFF + +class SByteStringList; +class GenericInformationList; + +/* +// Pfade auf Konfigurationsdateien des Build-Servers + +#define REQUEST_DIR \\src\data4\source\b_server\server\newjob +*/ +/********************************************************************* +* +* Die Klasse CommandData haelte alle Informationen, die fuer die +* Abarbeitung eines Kommandos (nmake, get) noetig sind +* +*********************************************************************/ + +class CommandData +{ + ByteString aPrj; + ByteString aLogFileName; + ByteString aInpath; + ByteString aUpd; + ByteString aUpdMinor; + ByteString aProduct; + ByteString aCommand; + ByteString aPath; + ByteString aPrePath; + ByteString aPreFix; + ByteString aCommandPara; + ByteString aComment; + ByteString sClientRestriction; + SByteStringList *pDepList; + SByteStringList *pCommandList; + USHORT nOSType; + USHORT nCommand; + + ULONG nDepth; // Tiefe der Abhaenigkeit + +public: + CommandData(); + ~CommandData(); + ByteString GetProjectName(){return aPrj;} + void SetProjectName( ByteString aName ){aPrj = aName;} + ByteString GetLogFile(){return aLogFileName;} + void SetLogFile( ByteString aName ){aLogFileName = aName;} + ByteString GetInpath(){return aInpath;} + void SetInpath( ByteString aName ){aInpath = aName;} + ByteString GetUpd(){return aUpd;} + void SetUpd( ByteString aName ){aUpd = aName;} + ByteString GetUpdMinor(){return aUpdMinor;} + void SetUpdMinor( ByteString aName ){aUpdMinor = aName;} + ByteString GetProduct(){return aProduct;} + void SetProduct( ByteString aName ){aProduct = aName;} + ByteString GetCommand(){return aCommand;} + void SetCommand ( ByteString aName ){aCommand = aName;} + ByteString GetCommandPara(){return aCommandPara;} + void SetCommandPara ( ByteString aName ){aCommandPara = aName;} + ByteString GetComment(){return aComment;} + void SetComment ( ByteString aCommentString ){aComment = aCommentString;} + ByteString GetPath(){return aPath;} + void SetPath( ByteString aName ){aPath = aName;} + ByteString GetPrePath(){return aPrePath;} + void SetPrePath( ByteString aName ){aPrePath = aName;} + USHORT GetOSType(){return nOSType;} + ByteString GetOSTypeString(); + void SetOSType( USHORT nType ){nOSType = nType;} + USHORT GetCommandType(){return nCommand;} + ByteString GetCommandTypeString(); + void SetCommandType( USHORT nCommandType ){nCommand = nCommandType;} + SByteStringList* GetDependencies(){return pDepList;} + void SetDependencies( SByteStringList *pList ){pDepList = pList;} + ByteString GetClientRestriction() { return sClientRestriction; } + void SetClientRestriction( ByteString sRestriction ) { sClientRestriction = sRestriction; } + + void AddDepth(){nDepth++;} + ULONG GetDepth(){return nDepth;} + + void AddCommand(ByteString* pCommand); + SByteStringList* GetCommandList() {return pCommandList;} + + CommandData& operator<< ( SvStream& rStream ); + CommandData& operator>> ( SvStream& rStream ); +}; + +/********************************************************************* +* +* Die Klasse SimpleConfig kann benutzt werden, um aus einer Textdatei +* alle Tokens zu lesen +* +*********************************************************************/ + +class SimpleConfig +{ + long nLine; + String aFileName; + SvFileStream aFileStream; + ByteString aTmpStr; + ByteString aStringBuffer; + + ByteString GetNextLine(); +public: + SimpleConfig(String aSimpleConfigFileName); + SimpleConfig(DirEntry& rDirEntry); + ~SimpleConfig(); + ByteString GetNext(); + ByteString GetCleanedNextLine( BOOL bReadComments = FALSE ); +}; + +#define ENV_GUI 0x00000000 +#define ENV_OS 0x00000001 +#define ENV_UPD 0x00000002 +#define ENV_UPDMIN 0x00000004 +#define ENV_INPATH 0x00000008 +#define ENV_OUTPATH 0x00000010 +#define ENV_GUIBASE 0x00000020 +#define ENV_CVER 0x00000040 +#define ENV_GVER 0x00000080 +#define ENV_GUIENV 0x00000100 +#define ENV_CPU 0x00000200 +#define ENV_CPUNAME 0x00000400 +#define ENV_DLLSUFF 0x00000800 +#define ENV_COMEX 0x00001000 +#define ENV_COMPATH 0x00002000 +#define ENV_INCLUDE 0x00004000 +#define ENV_LIB 0x00008000 +#define ENV_PATH 0x00010000 +#define ENV_SOLVER 0x00020000 +#define ENV_SOLENV 0x00040000 +#define ENV_SOLROOT 0x00080000 +#define ENV_DEVROOT 0x00100000 +#define ENV_EMERG 0x00200000 +#define ENV_STAND 0x00400000 + +DECL_DEST_LIST ( PrjList_tmp, PrjList, CommandData * ) + +/********************************************************************* +* +* class DepInfo +* Struct mit Modeinfos +* +*********************************************************************/ + +class DepInfo +{ + private: + ByteString* pProject; + SByteStringList* pModeList; + BOOL bAllModes; + + void RemoveProject (); + void RemoveModeList (); + public: + DepInfo() : pProject(0), pModeList(0), bAllModes(FALSE) {} + DepInfo(ByteString* pString) : pProject(0), pModeList(0), bAllModes(FALSE) {pProject = pString;} + DepInfo(ByteString* pString, SByteStringList* pList) : pProject(0), pModeList(0), bAllModes(FALSE) {pProject = pString; pModeList = pList;} + ~DepInfo(); + + void SetProject (ByteString* pStr); + ByteString* GetProject() {return pProject;} + void PutModeString (ByteString* pStr); + SByteStringList* GetModeList() {return pModeList;} + void SetModeList (SByteStringList* pList) {pModeList = pList;} + BOOL IsAllModes() {return bAllModes;} + void SetAllModes(BOOL bModes=TRUE) {bAllModes = bModes;} + + DepInfo& operator<< ( SvStream& rStream ); + DepInfo& operator>> ( SvStream& rStream ); +}; + +DECLARE_LIST( DepInfoList, DepInfo* ) + +/********************************************************************* +* +* class SDepInfoList +* Struct mit Modeinfos + Listen Methoden +* +*********************************************************************/ + +class SDepInfoList : public DepInfoList +{ + SByteStringList* pAllModeList; // only pointer to strings + + public: + SDepInfoList(); + ~SDepInfoList(); + + // neuen ByteString in Liste einfuegen + ULONG PutString( ByteString*, ByteString*); + ULONG PutString( ByteString*); + void PutModeString( DepInfo* pInfoList, ByteString* pStr ); + + ByteString* RemoveString( const ByteString& rName ); + + // Position des ByteString in Liste, wenn nicht enthalten, dann + // return = NOT_THERE + ULONG IsString( ByteString* ); + + // Vorgaenger ermitteln ( auch wenn selbst noch nicht in + // Liste enthalten + ULONG GetPrevString( ByteString* ); + SByteStringList* GetAllDepModes(); + + SDepInfoList& operator<< ( SvStream& rStream ); + SDepInfoList& operator>> ( SvStream& rStream ); +}; + + +/********************************************************************* +* +* class Prj +* alle Daten eines Projektes werden hier gehalten +* +*********************************************************************/ + +class Star; +class Prj : public PrjList +{ +friend class Star; +private: + + ByteString aPrjPath; + ByteString aProjectName; + ByteString aProjectPrefix; // max. 2-buchstabige Abk. + SByteStringList* pPrjInitialDepList; + SByteStringList* pPrjDepList; + SDepInfoList* pPrjDepInfoList; + BOOL bSorted; + BOOL bHardDependencies; + BOOL bFixedDependencies; + BOOL bVisited; + BOOL bIsAvailable; + SByteStringList* RemoveStringList(SByteStringList* pStringList ); + SDepInfoList* RemoveDepInfoList(SDepInfoList* pInfoList ); + PrjList* pTempCommandDataList; + BOOL bTempCommandDataListPermanent; +public: + Prj(); + Prj( ByteString aName ); + ~Prj(); + void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;} + ByteString GetPreFix(){return aProjectPrefix;} + ByteString GetProjectName() + {return aProjectName;} + void SetProjectName(ByteString aName) + {aProjectName = aName;} + BOOL InsertDirectory( ByteString aDirName , USHORT aWhat, + USHORT aWhatOS, ByteString aLogFileName, + const ByteString &rClientRestriction ); + CommandData* RemoveDirectory( ByteString aLogFileName ); + CommandData* GetDirectoryList ( USHORT nWhatOs, USHORT nCommand ); + CommandData* GetDirectoryData( ByteString aLogFileName ); + inline CommandData* GetData( ByteString aLogFileName ) + { return GetDirectoryData( aLogFileName ); }; + + SByteStringList* GetDependencies( BOOL bExpanded = TRUE ); + SDepInfoList* GetModeAndDependencies() {return pPrjDepInfoList;} + void AddDependencies( ByteString aStr ); + void AddDependencies( ByteString aStr, ByteString aModeStr ); + void SetMode(SByteStringList* pModeList); + void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; } + BOOL HasHardDependencies() { return bHardDependencies; } + void HasFixedDependencies( BOOL bFixed ) { bFixedDependencies = bFixed; } + BOOL HasFixedDependencies() { return bFixedDependencies; } + + BOOL IsAvailable() { return bIsAvailable; } + void IsAvailable( BOOL bAvailable ) { bIsAvailable=bAvailable; } + + void ExtractDependencies(); + + PrjList* GetCommandDataList (); + void RemoveTempCommandDataList(); + void GenerateTempCommandDataList(); + void GenerateEmptyTempCommandDataList(); + BOOL HasTempCommandDataList() {return pTempCommandDataList != NULL;} + void SetTempCommandDataListPermanent (BOOL bVar = TRUE) {bTempCommandDataListPermanent = bVar;} + BOOL IsTempCommandDataListPermanent() {return bTempCommandDataListPermanent;} + + Prj& operator<< ( SvStream& rStream ); + Prj& operator>> ( SvStream& rStream ); +}; + +/********************************************************************* +* +* class Star +* Diese Klasse liest die Projectstruktur aller StarDivision Projekte +* aus \\dev\data1\upenv\data\config\solar.lst aus +* +*********************************************************************/ + +DECL_DEST_LIST ( StarList_tmp, StarList, Prj* ) +DECLARE_LIST ( SolarFileList, String* ) + +class StarFile +{ +private: + String aFileName; + Date aDate; + Time aTime; + Date aDateCreated; + Time aTimeCreated; + + BOOL bExists; + +public: + StarFile( const String &rFile ); + const String &GetName() { return aFileName; } + Date GetDate() { return aDate; } + Time GetTime() { return aTime; } + + BOOL NeedsUpdate(); + BOOL Exists() { return bExists; } +}; + +DECLARE_LIST( StarFileList, StarFile * ) + +#define STAR_MODE_SINGLE_PARSE 0x0000 +//#define STAR_MODE_RECURSIVE_PARSE 0x0001 it dosen't work anymore +#define STAR_MODE_MULTIPLE_PARSE 0x0002 + +class Star : public StarList +{ +private: + Link aDBNotFoundHdl; + ByteString aStarName; // no idee what this should be + +protected: + NAMESPACE_VOS( OMutex ) aMutex; + + USHORT nStarMode; + SolarFileList aFileList; + StarFileList aLoadedFilesList; + String sSourceRoot; + String sFileName; + SByteStringList* pDepMode; + SByteStringList* pAllDepMode; + + Link aFileIOErrorHdl; // called with &String as parameter!!! + + void InsertSolarList( String sProject ); + String CreateFileName( String& rProject, String& rSourceRoot ); + + void Expand_Impl(); + void ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj ); + ULONG SearchFileEntry( StarFileList *pStarFiles, StarFile* pFile ); + +public: + Star(); + Star( String aFileName, USHORT nMode = STAR_MODE_SINGLE_PARSE ); + Star( SolarFileList *pSolarFiles ); + Star( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE, + const char *pSourceRoot = NULL ); + + ~Star(); + + void SetDBNotFoundHdl( const Link &rLink ) { aDBNotFoundHdl = rLink; } + void SetFileIOErrorHdl( const Link &rLink ) { aFileIOErrorHdl = rLink; } + + ByteString GetName(){ return aStarName; }; // dummy function of VG + void Read( String &rFileName ); + void Read( SolarFileList *pSOlarFiles ); +// void ReadXmlBuildList(const ByteString& sBuildLstPath); + + + BOOL HasProject( ByteString aProjectName ); + Prj* GetPrj( ByteString aProjectName ); + ByteString GetPrjName( DirEntry &rPath ); + BOOL RemovePrj ( Prj* pPrj ); + void RemoveAllPrj (); + + void InsertToken( char *pChar ); + BOOL NeedsUpdate(); + SolarFileList* NeedsFilesForUpdate(); + void ReplaceFileEntry( StarFileList *pStarFiles, StarFile* pFile ); + void UpdateFileList( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bRead = FALSE, + BOOL bLocal = FALSE, const char *pSourceRoot = NULL ); + void FullReload( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bRead = FALSE, + BOOL bLocal = FALSE, const char *pSourceRoot = NULL ); + void GenerateFileLoadList( SolarFileList *pSolarFiles ); + BOOL CheckFileLoadList(SolarFileList *pSolarFiles); + + USHORT GetMode() { return nStarMode; } + String GetFileName(){ return sFileName; }; + String GetSourceRoot(){ return sSourceRoot; }; + SByteStringList* GetAvailableDeps (); + void ClearAvailableDeps (); + SByteStringList* GetCurrentDeps () {return pDepMode;} + void SetCurrentDeps (SByteStringList* pDepList); + void ClearCurrentDeps (); + + int GetOSType ( ByteString& aWhatOS ); + int GetJobType ( ByteString& JobType ); + + void ClearLoadedFilesList (); + + void PutPrjIntoStream (SByteStringList* pPrjNameList, SvStream* pStream); + Star& operator<< ( SvStream& rStream ); + Star& operator>> ( SvStream& rStream ); +}; + +class StarWriter : public Star +{ +private: + USHORT WritePrj( Prj *pPrj, SvFileStream& rStream ); + +public: + StarWriter( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); + StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); + StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, ByteString &rMinor, + BOOL bReadComments = FALSE, BOOL bLocal = FALSE, const char *pSourceRoot = NULL ); + + void CleanUp(); + + BOOL InsertProject ( Prj* pNewPrj ); + Prj* RemoveProject ( ByteString aProjectName ); + + USHORT Read( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); + USHORT Read( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); + USHORT Write( String aFileName ); + USHORT WriteMultiple( String rSourceRoot ); + + void InsertTokenLine( ByteString& rString ); +}; + +#endif + + diff --git a/soldep/inc/soldep/sdtresid.hxx b/soldep/inc/soldep/sdtresid.hxx new file mode 100644 index 000000000000..02a3a57e37ea --- /dev/null +++ b/soldep/inc/soldep/sdtresid.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SOLDEV_RESID_HXX_ +#define _SOLDEV_RESID_HXX_ +#include <tools/resmgr.hxx> +#include <tools/shl.hxx> +#include <vcl/svapp.hxx> + + +class SolDevDll +{ + ResMgr* pResMgr; +public: + SolDevDll(); + ~SolDevDll(); + + ResMgr* GetResMgr() { return pResMgr; } +}; + +class DtSodResId : public ResId +{ +public: + DtSodResId(USHORT nId); +}; + +#endif + diff --git a/soldep/inc/soldep/soldep.hxx b/soldep/inc/soldep/soldep.hxx new file mode 100644 index 000000000000..55fb4fc0e11c --- /dev/null +++ b/soldep/inc/soldep/soldep.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_SOLDEP_HXX +#define _FMRWRK_SOLDEP_HXX + +#define SOURCEROOT "SOLARSRC" + +#include <tools/string.hxx> + +#include <soldep/depper.hxx> + +#define SOURCEROOT "SOLARSRC" + +class ObjectWin; + +class SolDep : public Depper +{ + BOOL mbBServer; //call from build server + ULONG mnMinDynXOffs; + ULONG mnLevelOffset; + ULONG mnXOffset; + ObjWinList* mpTravellerList; + + String msSourceName; + ByteString msVersionMajor; + ByteString msVersionMinor; + ByteString msProject; + ObjectWin* mpFocusWin; + BOOL mbIsHide; + + GenericInformationList *mpStandLst; + + DECL_LINK( ChildWindowEventListener, VclSimpleEvent* ); + DECL_LINK( ToolSelect, SoldepToolBox* ); + + SolarFileList* GetPrjListFromDir(); + + Point CalcPos( USHORT nSet, USHORT nIndex ); + ULONG CalcXOffset( ULONG nObjectsToFit ); + double CalcDistSum( ObjWinList* pObjList, DistType eDistType = TOPDOWN ); + USHORT Impl_Traveller( ObjectWin* pWin, USHORT nDepth ); + double Impl_PermuteMin( ObjWinList& rObjList, Point* pPosArray, ObjWinList& rResultList, + double dMinDist, ULONG nStart, ULONG nSize, DistType eDisType = TOPDOWN ); + USHORT Load( const ByteString& rFileName ); + void WriteToErrorFile(); + BOOL MarkObjects( ObjectWin* pObjectWin ); + void InitContextMenueMainWnd(); + void InitContextMenuePrjViewWnd(DepWin* pWin); +protected: + /// will be called for any VclWindowEvent events broadcasted by our VCL window + virtual void ProcessChildWindowEvent( const VclWindowEvent& _rVclWindowEvent ); + inline bool isAlive() const { return NULL != mpProcessWin; } + + +public: + SolDep( Window* pBaseWindow ); + ~SolDep(); + BOOL IsHideMode() { return mbIsHide;}; + void ToggleHideDependency(); + + virtual ULONG GetStart(SolIdMapper* pIdMapper, ObjectList* pObjList); + ULONG GetStartPrj(SolIdMapper* pIdMapper, ObjectList* pObjList); + virtual USHORT ReadSource( BOOL bUpdater = FALSE ); + virtual USHORT WriteSource(); + virtual USHORT OpenSource(); + BOOL GetVersion(); + void Init(); + void Init( ByteString &rVersion, GenericInformationList *pVersionList = NULL ); + BOOL InitPrj( ByteString& rListName ); +// using Depper::AddObject; + virtual ULONG AddObject( ByteString& rBodyText, BOOL Interact=TRUE ); + ULONG AddPrjObject( ByteString& rBodyText, BOOL Interact=TRUE ); + virtual ObjectWin* RemoveObject( USHORT nId, BOOL bDelete = TRUE ); + virtual void RemoveAllObjects( ObjectList* pObjLst ); + virtual USHORT AddConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ); + USHORT AddConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ); + virtual USHORT RemoveConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ); + USHORT RemoveConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ); + USHORT AutoArrange( SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID ); + USHORT OptimizePos( SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID ); + virtual BOOL ViewContent( ByteString& rObjectName ); + virtual USHORT CloseWindow(); + virtual void ShowHelp(); + FloatingWindow* GetTaskBarFrame() { return &maTaskBarFrame; } + SoldepToolBox* GetSoldepToolBox() { return &maToolBox; } + + BOOL FindProject(); + void Resize(); +}; + +#endif diff --git a/soldep/inc/soldep/soldlg.hrc b/soldep/inc/soldep/soldlg.hrc new file mode 100644 index 000000000000..94a26514e5b2 --- /dev/null +++ b/soldep/inc/soldep/soldlg.hrc @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define SOLDEPL_START 1000 + +#define BTN_OK (SOLDEPL_START+1) +#define BTN_CANCEL (SOLDEPL_START+2) + +#define FT_PRJNAME (SOLDEPL_START+3) +#define EDIT_PRJNAME (SOLDEPL_START+4) +#define FT_PRJSHORT (SOLDEPL_START+5) +#define EDIT_PRJSHORT (SOLDEPL_START+6) +#define FT_PRJDEPS (SOLDEPL_START+7) +#define EDIT_PRJDEPS (SOLDEPL_START+8) + + +#define FT_DIRNAME (SOLDEPL_START+9) +#define EDIT_DIRNAME (SOLDEPL_START+10) +#define FT_DIRFLAG (SOLDEPL_START+11) +#define EDIT_DIRFLAG (SOLDEPL_START+12) +#define FT_DIRDEPS (SOLDEPL_START+13) +#define EDIT_DIRDEPS (SOLDEPL_START+14) +#define FT_DIRACTION (SOLDEPL_START+15) +#define EDIT_DIRACTION (SOLDEPL_START+16) +#define FT_DIRENV (SOLDEPL_START+17) +#define EDIT_DIRENV (SOLDEPL_START+18) + +#define EDIT_HELP (SOLDEPL_START+19) + +#define DLG_VERSIONSELECT (SOLDEPL_START+20) +#define DLG_VERSIONSELECT_LISTBOX (SOLDEPL_START+21) +#define DLG_VERSIONSELECT_GROUP (SOLDEPL_START+22) +#define DLG_VERSIONSELECT_OK (SOLDEPL_START+23) +#define DLG_VERSIONSELECT_CANCEL (SOLDEPL_START+24) +#define DLG_MINORSELECT_EDIT (SOLDEPL_START+33) +#define DLG_MINORSELECT_GROUP (SOLDEPL_START+34) +#define DLG_AUTOARRANGE (SOLDEPL_START+25) +#define DLG_AUTOARRANGE_GROUP (SOLDEPL_START+26) +#define DLG_AUTOARRANGE_TEXT_MODULE (SOLDEPL_START+27) +#define DLG_AUTOARRANGE_TEXT_OVERALL (SOLDEPL_START+28) + +#define DLG_FIND_PROJECT (SOLDEPL_START+29) +#define DLG_FIND_PROJECT_OK (SOLDEPL_START+30) +#define DLG_FIND_PROJECT_CANCEL (SOLDEPL_START+31) +#define DLG_FIND_PROJECT_COMBOBOX (SOLDEPL_START+32) + +#define TID_SOLDEP_MAIN (SOLDEPL_START+20000) +#define TID_SOLDEP_OPEN (TID_SOLDEP_MAIN+1) +#define TID_SOLDEP_SAVE (TID_SOLDEP_MAIN+2) +#define TID_SOLDEP_FIND (TID_SOLDEP_MAIN+3) +#define TID_SOLDEP_HIDE_INDEPENDEND (TID_SOLDEP_MAIN+4) +#define TID_SOLDEP_SELECT_WORKSPACE (TID_SOLDEP_MAIN+5) +#define TID_SOLDEP_BACK (TID_SOLDEP_MAIN+6) +#define TID_SOLDEP_CREATEMETA (TID_SOLDEP_MAIN+7) +#define TID_SMALL_PIN_PINED (TID_SOLDEP_MAIN+100) +#define TID_SMALL_PIN_UNPINED (TID_SOLDEP_MAIN+101) diff --git a/soldep/inc/soldep/soldlg.hxx b/soldep/inc/soldep/soldlg.hxx new file mode 100644 index 000000000000..ef57908b6913 --- /dev/null +++ b/soldep/inc/soldep/soldlg.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FMRWRK_SOLDLG_HXX +#define _FMRWRK_SOLDLG_HXX + +#include <vcl/wintypes.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/edit.hxx> +#include <svtools/svmedit.hxx> +#include <svtools/prgsbar.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/group.hxx> +#include <vcl/combobox.hxx> + +// forwards +class GenericInformationList; + +// +// class SolNewProjectDlg +// + +class SolNewProjectDlg : public ModalDialog +{ +public: + OKButton maOkButton; + CancelButton maCancelButton; + FixedText maFTName; + Edit maEName; + FixedText maFTShort; + Edit maEShort; + FixedText maFTDeps; + Edit maEDeps; + + SolNewProjectDlg( Window* pParent, const ResId& rResId ); + DECL_LINK( OkHdl, Button* pOkBtn ); + DECL_LINK( CancelHdl, Button* pCancelBtn ); +}; + +// +// SolNewDirectoryDlg +// + +class SolNewDirectoryDlg : public ModalDialog +{ +public: + OKButton maOkButton; + CancelButton maCancelButton; + FixedText maFTName; + Edit maEName; + FixedText maFTFlag; + Edit maEFlag; + FixedText maFTDeps; + Edit maEDeps; + FixedText maFTAction; + Edit maEAction; + FixedText maFTEnv; + Edit maEEnv; + + SolNewDirectoryDlg( Window* pParent, const ResId& rResId ); + DECL_LINK( OkHdl, Button* pOkBtn ); + DECL_LINK( CancelHdl, Button* pCancelBtn ); +}; + +// +// SolHelpDlg +// + +class SolHelpDlg : public ModalDialog +{ +public: + OKButton maOkButton; + MultiLineEdit maMLEHelp; + + SolHelpDlg( Window* pParent, const ResId& rResId ); + DECL_LINK( OkHdl, Button* pOkBtn ); +}; + +// +// class SolSelectVersionDlg +// + +class SolSelectVersionDlg : public ModalDialog +{ +private: + ListBox maVersionListBox; + GroupBox maVersionGroupBox; + Edit maMinorEditBox; + GroupBox maMinorGroupBox; + OKButton maOKButton; + CancelButton maCancelButton; + ByteString msVersionMajor; + ByteString msVersionMinor; + +public: + SolSelectVersionDlg( Window *pParent, GenericInformationList *pStandLst ); + ByteString GetVersionMajor(); + ByteString GetVersionMinor(); + DECL_LINK( DoubleClickHdl, ListBox * ); +}; + +class SolAutoarrangeDlg : public ModelessDialog +{ +private: + GroupBox maGroupBox; + FixedText maModuleText; + FixedText maOverallText; + ProgressBar maModuleBar; + ProgressBar maOverallBar; + +public: + SolAutoarrangeDlg( Window *pParent ); + + ProgressBar *GetSubBar() { return &maModuleBar; } + ProgressBar *GetMainBar() { return &maOverallBar; } + + FixedText *GetSubText() { return &maModuleText; } + FixedText *GetMainText() { return &maOverallText; } +}; + +class SolFindProjectDlg : public ModalDialog +{ +private: + ComboBox maCombobox; + OKButton maOKButton; + CancelButton maCancelButton; + +public: + SolFindProjectDlg( Window *pParent, ObjWinList* pObjList ); + ByteString GetProject(); +}; + +#endif // _FMRWRK_SOLDLG_HXX diff --git a/soldep/inc/soldep/tbox.hxx b/soldep/inc/soldep/tbox.hxx new file mode 100644 index 000000000000..69276895aad5 --- /dev/null +++ b/soldep/inc/soldep/tbox.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SOLDEPTBOX_HXX +#define _SOLDEPTBOX_HXX + +#include <vcl/toolbox.hxx> +#include <vcl/menu.hxx> + +class SoldepToolBox : public ToolBox +{ +protected: +// USHORT nBuildServerToolBoxId; + BOOL bDockable; + BOOL bCloseMode; + BOOL bOldFloatMode; + BOOL bBoxIsVisible; + BOOL bPin; + BOOL bPinable; + + PopupMenu aMenu; + + Rectangle aOutRect; + Rectangle aInRect; + + Link aResizeHdl; + Link aMouseDownHdl; + + Bitmap aPinedBitmap; + Bitmap aUnpinedBitmap; + + void InitContextMenu(); + +public: + SoldepToolBox( Window* pParent, const ResId& aId, BOOL bDAble = TRUE ); + ~SoldepToolBox(); + + virtual void Command( const CommandEvent& rCEvt); + virtual void CallContextMenu( Window *pWin, Point aPos ); + virtual void Paint( const Rectangle& rRect ); + virtual void MouseButtonDown(const MouseEvent& rEvent); + virtual void MouseButtonUp(const MouseEvent& rEvent); + virtual void MouseMove(const MouseEvent& rEvent); + + virtual void ToggleFloatingMode(); +// void SetFloatingWindow( FloatingWindow* pFW) { ToolBox::mpFloatWin = pFW; } + virtual void StartDocking(); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + virtual BOOL Close(); + virtual void CloseDockingMode(); + + //Called when toolbar droped + virtual void Tracking( const TrackingEvent &rTEvt ) { Invalidate(); ToolBox::Tracking( rTEvt );} + + virtual void Move(); + + using DockingWindow::SetPosSizePixel; + void SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ); + + void SetDockingRects( const Rectangle& rOutRect, + const Rectangle& rInRect ); + + void SetMouseDownHdl(const Link& rLink) { aMouseDownHdl = rLink; } + Link GetMouseDownHdl() { return aMouseDownHdl; } + void SetResizeHdl(const Link& rLink) { aResizeHdl = rLink; } + + BOOL IsBoxVisible() { return bBoxIsVisible; } + + void EnablePin( BOOL bEnable = TRUE ) { bPinable = bEnable; Invalidate(); } + BOOL GetPin(); + void TogglePin(); + void SetPin(BOOL bP); + PopupMenu *GetContextMenu(); + DECL_LINK( MenuSelectHdl, Menu * ); +}; + +#endif diff --git a/soldep/prj/build.lst b/soldep/prj/build.lst new file mode 100644 index 000000000000..636c244ab358 --- /dev/null +++ b/soldep/prj/build.lst @@ -0,0 +1,5 @@ +dp soldep : svtools NULL +dp soldep usr1 - all dp_mkout NULL +dp soldep\bootstrp nmake - all dp_btstrp NULL +dp soldep\source nmake - all dp_soldep dp_btstrp NULL + diff --git a/soldep/prj/d.lst b/soldep/prj/d.lst new file mode 100644 index 000000000000..73301a558e61 --- /dev/null +++ b/soldep/prj/d.lst @@ -0,0 +1,38 @@ +mkdir: %_DEST%\inc%_EXT%\soldep +mkdir: %_DEST%\inc%_EXT%\bootstrp2 +mkdir: %COMMON_DEST%\bin%_EXT%\additional +mkdir: %COMMON_DEST%\res%_EXT%\img\additional + +..\inc\soldep\sdtresid.hxx %_DEST%\inc%_EXT%\soldep\sdtresid.hxx +..\%__SRC%\bin\soldepl.exe %_DEST%\bin%_EXT%\soldepl.exe +..\%__SRC%\bin\bootstrpdt?????.dll %_DEST%\bin%_EXT%\bootstrpdt?????.dll +..\%__SRC%\bin\soldep?????.dll %_DEST%\bin%_EXT%\soldep?????.dll +..\%__SRC%\lib\libbootstrpdt*.* %_DEST%\lib%_EXT% +..\%__SRC%\lib\libsoldep*.* %_DEST%\lib%_EXT% +..\%__SRC%\slb\*.a %_DEST%\lib%_EXT%\*.a + +..\util\perl.mk %_DEST%\inc%_EXT%\soldep\perl.mk + +..\inc\soldep\soldep.hxx %_DEST%\inc%_EXT%\soldep\soldep.hxx +..\inc\soldep\soldlg.hxx %_DEST%\inc%_EXT%\soldep\soldlg.hxx +..\inc\soldep\hashtbl.hxx %_DEST%\inc%_EXT%\soldep\hashtbl.hxx +..\inc\soldep\depper.hxx %_DEST%\inc%_EXT%\soldep\depper.hxx +..\inc\soldep\objwin.hxx %_DEST%\inc%_EXT%\soldep\objwin.hxx +..\inc\soldep\connctr.hxx %_DEST%\inc%_EXT%\soldep\connctr.hxx +..\inc\soldep\depwin.hxx %_DEST%\inc%_EXT%\soldep\depwin.hxx +..\inc\soldep\graphwin.hxx %_DEST%\inc%_EXT%\soldep\graphwin.hxx +..\inc\soldep\tbox.hxx %_DEST%\inc%_EXT%\soldep\tbox.hxx +..\inc\soldep\hashobj.hxx %_DEST%\inc%_EXT%\soldep\hashobj.hxx +..\inc\minormk.hxx %_DEST%\inc%_EXT%\soldep\minormk.hxx +..\inc\soldep\prj.hxx %_DEST%\inc%_EXT%\soldep\prj.hxx +..\inc\dep.hxx %_DEST%\inc%_EXT%\soldep\dep.hxx +..\inc\prodmap.hxx %_DEST%\inc%_EXT%\soldep\prodmap.hxx +..\inc\appdef.hxx %_DEST%\inc%_EXT%\soldep\appdef.hxx +..\inc\soldep\soldlg.hrc %_DEST%\inc%_EXT%\soldep\soldlg.hrc + +..\%__SRC%\lib\soldep.lib %_DEST%\lib%_EXT%\soldep.lib +..\%__SRC%\lib\bootstrpdt.lib %_DEST%\lib%_EXT%\bootstrpdt.lib + +..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib%_EXT%\lib*static*.dylib +..\%__SRC%\bin\dep*.res %COMMON_DEST%\bin%_EXT%\additional\dep*.res + diff --git a/soldep/source/connctr.cxx b/soldep/source/connctr.cxx new file mode 100644 index 000000000000..10650cb41fca --- /dev/null +++ b/soldep/source/connctr.cxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif +#include <soldep/connctr.hxx> +#include <soldep/objwin.hxx> +#include <soldep/depwin.hxx> +#include "math.h" + +BOOL Connector::msbHideMode = FALSE; + +Connector::Connector( DepWin* pParent, WinBits nWinStyle ) : +mpStartWin( 0L ), +mpEndWin( 0L ), +mnStartId( 0 ), +mnEndId( 0 ), +bVisible( FALSE ), +len( 70 ) +{ + mpParent = pParent; + if ( mpParent ) + mpParent->AddConnector( this ); +} + +Connector::~Connector() +{ + if ( mpStartWin ) + mpStartWin->RemoveConnector( this ); + if ( mpEndWin ) + mpEndWin->RemoveConnector( this ); + if ( mpParent ) + mpParent->RemoveConnector( this ); + mpParent->Invalidate( Rectangle( mStart, mEnd )); + mpParent->Invalidate( Rectangle( mEnd - Point( 3, 3), mEnd + Point( 3, 3))); +} + +void Connector::Initialize( ObjectWin* pStartWin, ObjectWin* pEndWin, BOOL bVis ) +{ + mpStartWin = pStartWin; + mpEndWin = pEndWin; + mpStartWin->AddConnector( this ); + mpEndWin->AddConnector( this ); + mCenter = GetMiddle(); + mStart = pStartWin->GetFixPoint( mCenter ); + mEnd = pEndWin->GetFixPoint( mCenter ); + mnStartId = pStartWin->GetId(); + mnEndId = pEndWin->GetId(); + bVisible = bVis; + +// if ( mpParent->IsPaintEnabled()) + if ( IsVisible() ) + { + mpParent->DrawLine( mEnd, mStart ); + mpParent->DrawEllipse( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2))); + } + UpdateVisibility(); //null_Project +} + +void Connector::UpdateVisibility() +{ + bVisible = mpStartWin->IsVisible() && mpEndWin->IsVisible(); +} + + +Point Connector::GetMiddle() +{ + Point aStartPoint = mpStartWin->GetPosPixel(); + Size aStartSize = mpStartWin->GetSizePixel(); + int nMoveHorz, nMoveVert; + aStartPoint.Move( aStartSize.Width() / 2, aStartSize.Height() / 2 ); + + Point aEndPoint = mpEndWin->GetPosPixel(); + Size aEndSize = mpEndWin->GetSizePixel(); + + aEndPoint.Move( aEndSize.Width() / 2, aEndSize.Height() / 2 ); + + Point aRetPoint = aEndPoint; + + nMoveHorz = aStartPoint.X() - aEndPoint.X(); + if ( nMoveHorz ) + nMoveHorz /= 2; + nMoveVert = aStartPoint.Y() - aEndPoint.Y(); + if ( nMoveVert ) + nMoveVert /= 2; + aRetPoint.Move( nMoveHorz, nMoveVert ); + return aRetPoint; + +} + +void Connector::Paint( const Rectangle& rRect ) +{ + //MyApp *pApp = (MyApp*)GetpApp(); + //SolDep *pSoldep = pApp->GetSolDep(); + if (msbHideMode) + { + if (!(mpStartWin->IsNullObject())) //null_project + { + if ( mpStartWin->GetMarkMode() == 0 || mpStartWin->GetMarkMode() == MARKMODE_DEPENDING ) + { + mpStartWin->SetViewMask(0); //objwin invisible + } else + { + mpStartWin->SetViewMask(1); //objwin visible + } + } + if (!(mpEndWin->IsNullObject())) + { + if ( mpEndWin->GetMarkMode() == 0 || mpEndWin->GetMarkMode() == MARKMODE_DEPENDING ) + { + mpEndWin->SetViewMask(0); //objwin invisible + } else + { + mpEndWin->SetViewMask(1); //objwin visible + } + } + UpdateVisibility(); + } else //IsHideMode + { + //bVisible = TRUE; + if (!(mpStartWin->IsNullObject())) //null_project + { + mpStartWin->SetViewMask(1); + } + if (!(mpEndWin->IsNullObject())) //null_project + { + mpEndWin->SetViewMask(1); + } + UpdateVisibility(); + } + if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project + (mpEndWin->GetBodyText() != ByteString("null")) && IsVisible()) //null_project + { + mpParent->DrawLine( mEnd, mStart ); + mpParent->DrawEllipse( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2))); + } +} + +void Connector::DrawOutput( OutputDevice* pDevice, const Point& rOffset ) +{ + if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project + (mpEndWin->GetBodyText() != ByteString("null")) && IsVisible()) //null_project + { + pDevice->DrawLine( pDevice->PixelToLogic( mEnd ) - rOffset, pDevice->PixelToLogic( mStart ) - rOffset ); + Rectangle aRect( pDevice->PixelToLogic( Rectangle( mEnd - Point( 2, 2), mEnd + Point( 2, 2) ) ) ); + aRect.Move( -rOffset.X(), -rOffset.Y() ); + pDevice->DrawEllipse( aRect ); + } +} + +void Connector::UpdatePosition( ObjectWin* pWin, BOOL bPaint ) +{ +// more than one call ? +// + Point OldStart, OldEnd; + static ULONG nCallCount = 0; + + //MyApp *pApp = (MyApp*)GetpApp(); + //SolDep *pSoldep = pApp->GetSolDep(); + if (msbHideMode) + bVisible = 1; + + if ( nCallCount ) // only one call + nCallCount++; + else + { + nCallCount++; + while ( nCallCount ) + { + if ( bPaint ) + { + OldStart = mStart; + OldEnd = mEnd; + } + mCenter = GetMiddle(); + mStart=mpStartWin->GetFixPoint( mCenter, bPaint ); + mEnd=mpEndWin->GetFixPoint( mCenter, bPaint ); + if ( bPaint ) + { + mpParent->Invalidate( Rectangle( OldStart, OldEnd )); + mpParent->Invalidate( Rectangle( OldEnd - Point( 2, 2), OldEnd + Point( 2, 2))); +//Don't paint "null_project" connectors + if ( (mpStartWin->GetBodyText() != ByteString("null")) && //null_project + (mpEndWin->GetBodyText() != ByteString("null"))) //null_project + { + Paint ( Rectangle( mEnd - Point( 3, 3), mEnd + Point( 3, 3))); + Paint ( Rectangle( mEnd, mStart )); + } + } + nCallCount--; + } + } +} + +USHORT Connector::Save( SvFileStream& rOutFile ) +{ + rOutFile << mpStartWin->GetId(); + rOutFile << mpEndWin->GetId(); + + return 0; +} + +USHORT Connector::Load( SvFileStream& rInFile ) +{ + rInFile >> mnStartId; + rInFile >> mnEndId; + + return 0; +} + +ObjectWin* Connector::GetOtherWin( ObjectWin* pWin ) +{ +// get correspondent object ptr + if ( mpStartWin == pWin ) + return mpEndWin; + else + if ( mpEndWin == pWin ) + return mpStartWin; + + return NULL; +} + +ULONG Connector::GetOtherId( ULONG nId ) +{ +// get correspondent object id + if ( mnStartId == nId ) + return mnEndId; + else + if ( mnEndId == nId ) + return mnStartId; + + return NULL; +} + +ULONG Connector::GetLen() +{ + double dx, dy; + + dx = mStart.X() - mEnd.X(); + dy = mStart.Y() - mEnd.Y(); + + return (ULONG) sqrt( dx * dx + dy * dy ); +} + +BOOL Connector::IsStart( ObjectWin* pWin ) +{ + return pWin == mpStartWin; +} diff --git a/soldep/source/depapp.cxx b/soldep/source/depapp.cxx new file mode 100644 index 000000000000..0c2b11f030be --- /dev/null +++ b/soldep/source/depapp.cxx @@ -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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// ----------------------------------------------------------------------- +#include "depapp.hxx" +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/configurationkeys.hxx> + +void MyApp::Main() +{ +#if defined(WNT) + pDebugFile = fopen( "fprintf.out", "w" ); +#endif + + pMyApp = GetpApp(); + MyWin aMainWin( NULL, WB_APP | WB_STDWORK ); + pAppWindow = &aMainWin; + // pToolBarFrame = new FloatingWindow( aMainWin, WB_STDWORK ); + //pToolBox = new ToolBox(pToolBarFrame,DtSodResId(TID_SOLDEP_MAIN)); + + pSolDep = new SolDep( &aMainWin ); + pSolDep->Init(); + aMainWin.SetText( String::CreateFromAscii( SOLDEPL_NAME )); + pSolDep->Hide(); + aMainWin.Show(); + Help aHelp; + SetHelp(&aHelp); + aHelp.EnableContextHelp(); + aHelp.EnableQuickHelp(); + Execute(); + delete pResMgr; + delete pSolDep; +} + +// ----------------------------------------------------------------------- + +MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : + WorkWindow( pParent, nWinStyle )//,aToolBox( this, DtSodResId(TID_SOLDEP_MAIN)), + // depper aTaskBarFrame(this, 0) +{ +//depper aTaskBarFrame.EnableAlwaysOnTop(); + +//depper aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Source" ) ) ); +//depper aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exit" ) ) ); +//depper SetMenuBar( &aMenuBar ); +//depper aToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 )); +// aToolBox.Show(); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseMove( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseMove( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonDown( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonUp( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonUp( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyInput( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyInput( rKEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyUp( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyUp( rKEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::Paint( const Rectangle& rRect ) +{ + WorkWindow::Paint( rRect ); +} + +// ----------------------------------------------------------------------- + +void MyWin::Resize() +{ + ((MyApp*)GetpApp())->GetSolDep()->Resize(); + WorkWindow::Resize(); +} + +SAL_IMPLEMENT_MAIN() +{ + //Reference< XMultiServiceFactory > xMS; + + // for this to work make sure an <appname>.ini file is available, you can just copy soffice.ini + Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); + + //xMS = cppu::createRegistryServiceFactory( + // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + + Reference< XMultiServiceFactory > xMS( xComponentContext->getServiceManager(), UNO_QUERY); + + InitVCL( xMS ); + ::comphelper::setProcessServiceFactory(xMS); + com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs(2); + aArgs[0] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); + aArgs[1] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); + + ::ucbhelper::ContentBroker::initialize( xMS, aArgs ); + + aMyApp.Main(); + DeInitVCL(); + return 0; +} diff --git a/soldep/source/depapp.hxx b/soldep/source/depapp.hxx new file mode 100644 index 000000000000..cf8c1935c220 --- /dev/null +++ b/soldep/source/depapp.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DEPAPP_HXX +#define _DEPAPP_HXX + + +#define EVENT_RESIZE 0x00000001 + + +#include <svl/solar.hrc> +#include <tools/resmgr.hxx> +#include <bootstrp/sstring.hxx> +#include <vcl/event.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/help.hxx> +#include <vcl/button.hxx> +#include <vcl/menu.hxx> +#include <soldep/soldep.hxx> +//#include <soldep/soldlg.hrc> +//#include <soldep/tbox.hxx> +// ----------------------------------------------------------------------- +#include <sal/main.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <cppuhelper/weak.hxx> +#include <soldep/soldep.hxx> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +class MyWin; + +class MyApp : public Application +{ + ResMgr* pResMgr; + SolDep* pSolDep; + Application* pMyApp; + MyWin* pAppWindow; + +public: +// MyApp(); +// ~MyApp() {}; +#if defined(WNT) + FILE* pDebugFile; +#endif + + void Main(); + ResMgr* GetResMgr() const { return pResMgr; } + Application* GetMyApp() { return pMyApp; } + MyWin* GetAppWin() { return pAppWindow; } + SolDep* GetSolDep() { return pSolDep; } +}; + +// ----------------------------------------------------------------------- + +class MyWin : public WorkWindow +{ +protected: + MenuBar aMenuBar; +// SoldepToolBox aToolBox; //->depper.hxx + Wallpaper aWallpaper; +// FloatingWindow aTaskBarFrame; // For ToolBox + +public: + MyWin( Window* pParent, WinBits nWinStyle ); + + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + void KeyInput( const KeyEvent& rKEvt ); + void KeyUp( const KeyEvent& rKEvt ); + void Paint( const Rectangle& rRect ); + void Resize(); +// FloatingWindow* GetTaskBarFrame() { return &aTaskBarFrame; } +// SoldepToolBox* GetSoldepToolBox() { return &aToolBox; } + +}; +static MyApp aMyApp; + +#endif + diff --git a/soldep/source/depper.cxx b/soldep/source/depper.cxx new file mode 100644 index 000000000000..11610ea1fcef --- /dev/null +++ b/soldep/source/depper.cxx @@ -0,0 +1,687 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <stdio.h> +#include <tools/stream.hxx> +#include <tools/debug.hxx> +#include <vcl/msgbox.hxx> +#include <svtools/prgsbar.hxx> + +#include <soldep/depper.hxx> +#include <soldep/objwin.hxx> + +#include "math.h" +#include "time.h" +#include "stdlib.h" +#include "dtsodcmp.hrc" + +#include <vcl/svapp.hxx> + +#define MIN(a,b) (a)<(b)?(a):(b) +#define MAX(a,b) (a)>(b)?(a):(b) + +ByteString sDelimiterLine("#=========================================================================="); + + + + +Depper::Depper( Window* pBaseWindow ): + Window( pBaseWindow ), + mbIsPrjView(FALSE), + maDefPos( 50, 50 ), + maDefSize( 60, 25 ), + mnViewMask( 1 ), + pSubBar( NULL ), + pMainBar( NULL ), + pSubText( NULL ), + pMainText( NULL ), + maArrangeDlg( pBaseWindow ), + mpPrjIdMapper( NULL ), + maToolBox( pBaseWindow, DtSodResId(TID_SOLDEP_MAIN) ), + maTaskBarFrame( pBaseWindow, 0) +{ + maArrangeDlg.Hide(); + + mpProcessWin = pBaseWindow; + mpGraphWin = new GraphWin( mpProcessWin, this ); + mpGraphPrjWin = new GraphWin( mpProcessWin, this ); + //mpBaseWin paints into virtual OutputDevice + mpBaseWin = new DepWin( mpGraphWin->GetBufferWindow(), WB_NOBORDER | WB_SIZEABLE | WB_AUTOSIZE ); + mpBasePrjWin = new DepWin( mpGraphPrjWin->GetBufferWindow(), WB_NOBORDER | WB_SIZEABLE | WB_AUTOSIZE ); + + mpGraphWin->SetBackground( Wallpaper( Color( COL_RED ))); + mpGraphPrjWin->SetBackground( Wallpaper( Color( COL_BLUE ))); + mpGraphPrjWin->Hide(); + mpBaseWin->SetBackground( Wallpaper( Color( COL_WHITE ))); + mpBasePrjWin->SetBackground( Wallpaper( Color( COL_LIGHTGRAY ))); +/* + mpGraphWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + mpGraphPrjWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + mpBaseWin->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); +*/ + mpGraphWin->EnableClipSiblings(); + mpGraphPrjWin->EnableClipSiblings(); + + mpParentProcessWin = mpProcessWin->GetParent(); + mpBaseWin->Show(); + nZoomed = 0; + + mpBaseWin->SetPopupHdl( this ); + mpBasePrjWin->SetPopupHdl( this ); + + mpObjectList = new ObjectList(); //ObjectList unbekannt + mpObjectPrjList = new ObjectList(); +} + +Depper::~Depper() +{ +// delete mpObjectList; + delete mpBaseWin; + delete mpGraphWin; +} + +BOOL Depper::TogglePrjViewStatus() +{ + GetDepWin()->Hide(); //Hide old content window + GetGraphWin()->Hide(); + mbIsPrjView = !mbIsPrjView; //switch now + GetDepWin()->Invalidate(); + GetGraphWin()->Show(); + GetDepWin()->Show(); //Show new content window + return mbIsPrjView; +} + +void Depper::HideObjectsAndConnections( ObjectList* pObjLst ) +{ + for ( ULONG i = 0; i < pObjLst->Count(); i ++ ) { + ObjectWin *pWin = pObjLst->GetObject( i ); + pWin->Hide(); + } + mpGraphWin->Hide(); + mpBaseWin->Hide(); + mpGraphPrjWin->Show(); + mpBasePrjWin->Show(); +} + +void Depper::ShowObjectsAndConnections( ObjectList* pObjLst ) +{ + for ( ULONG i = 0; i < pObjLst->Count(); i ++ ) { + ObjectWin *pWin = pObjLst->GetObject( i ); + pWin->Show(); + } + mpBasePrjWin->Hide(); + mpGraphPrjWin->Hide(); + mpGraphWin->Show(); + mpBaseWin->Show(); +} + + +void Depper::RemoveAllObjects( ObjectList* pObjLst ) +{ + ULONG i; + + for ( i = pObjLst->Count(); i > 0; i-- ) + delete pObjLst->GetObject( i - 1 ); + pObjLst->Clear(); +} + +USHORT Depper::Save( const ByteString& rFileName ) +{ + DBG_ASSERT( FALSE , "you are dead!" ); + SvFileStream aOutFile( String( rFileName, RTL_TEXTENCODING_UTF8 ), STREAM_WRITE ); + depper_head dh; + USHORT i; + ULONG nObjCount = mpObjectList->Count(); + + ConnectorList* pConList = GetDepWin()->GetConnectorList(); + ULONG nCnctrCount = pConList->Count(); + + dh.nID = DEPPER_ID; + dh.nObjectCount = nObjCount; + dh.nCnctrCount = nCnctrCount; + + aOutFile.Write( &dh, sizeof( dh )); + + for ( i=0; i < nObjCount ; i++ ) + { + mpObjectList->GetObject( i )->Save( aOutFile ); + } + + for ( i=0; i < nCnctrCount ; i++ ) + { + pConList->GetObject( i )->Save( aOutFile ); + } + + return 0; +} + + +USHORT Depper::WriteSource() +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +USHORT Depper::ReadSource( BOOL bUpdater ) +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +USHORT Depper::OpenSource() +{ + DBG_ASSERT( FALSE , "overload it!" ); + return 0; +}; + +ObjectWin* Depper::ObjIdToPtr( ObjectList* pObjLst, ULONG nId ) +{ + ULONG nObjCount = pObjLst->Count(); + ULONG i = 0; + ObjectWin* pWin; + ULONG nWinId = 0; + + do + { + pWin = pObjLst->GetObject( i ); + nWinId = pWin->GetId(); + i++; + } + while( i < nObjCount && pWin->GetId() != nId ); + if ( pWin->GetId() == nId ) + return pWin; + else + return NULL; +} + +void Depper::SetMainProgressBar( USHORT i) +{ + if ( pMainBar ) { + pMainBar->SetValue( 100 ); + pMainBar->Update(); + } +} + +void Depper::UpdateMainProgressBar(USHORT i, USHORT nScaleVal, USHORT &nStep, BOOL bCountingDown ) +{ + ULONG val = 0; + if ( pMainBar ) { + // val = i * 50 / nScaleVal + 1; + val = bCountingDown ? 50 + ( nScaleVal - i ) * 50 / nScaleVal : i * 50 / nScaleVal; + + pMainBar->SetValue( val ); + pMainBar->Update(); + String sText( String::CreateFromAscii( "Optimize step " )); + sText += String::CreateFromInt32( ++nStep ); + pSubText->SetText( sText ); + } +} + +void Depper::UpdateSubProgrssBar(ULONG i) +{ + if ( pSubBar ) + { + pSubBar->SetValue( i ); + pSubBar->Update(); + GetpApp()->Reschedule(); + } +} + + +USHORT Depper::AutoArrangeDlgStart() +{ + pSubBar = maArrangeDlg.GetSubBar(); + pMainBar = maArrangeDlg.GetMainBar(); + pSubText = maArrangeDlg.GetSubText(); + pMainText = maArrangeDlg.GetMainText(); + pMainText->SetText( String::CreateFromAscii( "Overall status" )); + maArrangeDlg.Show(); + GetDepWin()->Enable( FALSE ); + GetDepWin()->Hide(); + return 0; +} + +USHORT Depper::AutoArrangeDlgStop() +{ + maArrangeDlg.Hide(); + GetDepWin()->Enable( TRUE ); + GetDepWin()->Show(); + pSubBar = NULL; + pMainBar = NULL; + pSubText = NULL; + pMainText = NULL; + return 0; +} + + + +USHORT Depper::Zoom( MapMode& rMapMode ) +{ + ULONG i; + ObjectWin* pWin; + Point aPos; + Size aSize; + ObjectList* pObjList; + pObjList = GetObjectList(); +// aSize = mpBaseWin->GetSizePixel(); +// mpGraphWin->SetTotalSize( aSize ); +// mpGraphWin->EndScroll( 0, 0 ); + + for ( i = pObjList->Count(); i > 0; i-- ) + { + pWin = pObjList->GetObject( i - 1 ); + aPos = pWin->PixelToLogic( pWin->GetPosPixel()); + aSize = pWin->PixelToLogic( pWin->GetSizePixel()); + pWin->SetMapMode( rMapMode ); + aPos = pWin->LogicToPixel( aPos ); + aSize = pWin->LogicToPixel( aSize ); + pWin->SetPosSizePixel( aPos, aSize ); + } + GetDepWin()->Invalidate(); + return 0; +} + +ULONG Depper::AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, BOOL bInteract ) +{ + Point aPos; + Size aSize = GetDefSize(); + + aPos = GetDepWin()->LogicToPixel( aPos ); + aSize = GetDepWin()->LogicToPixel( aSize ); + return AddObjectToList( pParentWin, pObjLst, LastID, WinCount, rBodyText, aPos, aSize ); +} + +ULONG Depper::AddObjectToList( DepWin* pParentWin, ObjectList* pObjLst, ULONG &LastID, ULONG &WinCount, ByteString& rBodyText, Point& rPos, Size& rSize ) +{ + ObjectWin* pWin = new ObjectWin( pParentWin, WB_BORDER ); + //pWin->mpDepperDontuseme = this; + pWin->SetGlobalViewMask(mnViewMask); // Set ViewMask for all ObjectWin and Connector objects + + Size aNewSize; + aNewSize.Width() = pWin->GetTextWidth( String( rBodyText, RTL_TEXTENCODING_UTF8 )); + aNewSize.Height() = pWin->GetTextHeight(); + if ( aNewSize.Width() > rSize.Width() - 8 ) + { + aNewSize.Width() = aNewSize.Width() + 8; + aNewSize.Height() = rSize.Height(); + } + else + aNewSize = rSize; + pWin->SetPosSizePixel( rPos,aNewSize); + + MapMode aMapMode = mpBaseWin->GetMapMode(); + pWin->SetMapMode( aMapMode ); + + pObjLst->Insert( pWin, LIST_APPEND ); + pWin->SetId( LastID ); + LastID++; + WinCount++; + pWin->SetBodyText( rBodyText ); +// pWin->Show(); + return pWin->GetId(); +} + +/*void Depper::DrawOutput( OutputDevice* pDevice ) +{ + GetDepWin()->DrawOutput( pDevice ); + ObjectList* pObjList = GetObjectList(); + for ( USHORT i = pObjList->Count(); i > 0; i-- ) + { + ObjectWin* pWin = pObjList->GetObject( i - 1 ); + pWin->DrawOutput( pDevice ); + } +}*/ + +ObjectWin* Depper::RemoveObjectFromList( ObjectList* pObjLst, ULONG &WinCount, USHORT nId, BOOL bDelete ) +{ + ObjectWin* pWin = ObjIdToPtr( pObjLst, nId ); + + if ( pWin ) + { + pObjLst->Remove( pWin ); + WinCount--; + if( bDelete ) + delete pWin; + return pWin; + } + else + return NULL; +} +USHORT Depper::AddConnectorToObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ) +{ + ObjectWin* pStartWin = ObjIdToPtr( pObjLst, nStartId ); + + if ( !pStartWin ) + return DEP_STARTID_NOT_FOUND; + + ObjectWin* pEndWin = ObjIdToPtr( pObjLst, nEndId ); + + if ( !pEndWin ) + return DEP_STARTID_NOT_FOUND; + + return AddConnectorToObjects( pStartWin, pEndWin ); +} + +USHORT Depper::RemoveConnectorFromObjects( ObjectList* pObjLst, ULONG nStartId, ULONG nEndId ) +{ +// DBG_ASSERT( FALSE , "noch nicht" ); + ObjectWin* pStartWin = ObjIdToPtr( pObjLst, nStartId ); + + if ( !pStartWin ) + return DEP_STARTID_NOT_FOUND; + + ObjectWin* pEndWin = ObjIdToPtr( pObjLst, nEndId ); + + if ( !pEndWin ) + return DEP_STARTID_NOT_FOUND; + + return RemoveConnectorFromObjects( pStartWin, pEndWin ); +} + +USHORT Depper::AddConnectorToObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ + if ( pStartWin->ConnectionExistsInAnyDirection( pEndWin )) + return 0; + + Connector* pCon = new Connector( GetDepWin(), WB_NOBORDER ); +// pCon->Initialize( pStartWin, pEndWin ); + if (pStartWin->IsNullObject()) //null_project + pCon->Initialize( pStartWin, pEndWin, FALSE ); + else + pCon->Initialize( pStartWin, pEndWin, TRUE ); + return 0; +} + +USHORT Depper::RemoveConnectorFromObjects( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ + Connector* pCon = pStartWin->GetConnector( pStartWin->GetId(), pEndWin->GetId() ); + + if ( !pCon ) + return DEP_CONNECTOR_NOT_FOUND; + else + { + delete pCon; + return DEP_OK; + } +} + +ULONG Depper::HandleNewPrjDialog( ByteString &rBodyText ) +{ + SolNewProjectDlg aNewProjectDlg( GetDepWin(), DtSodResId( RID_SD_DIALOG_NEWPROJECT )); + if ( aNewProjectDlg.Execute() ) + { + rBodyText = ByteString( aNewProjectDlg.maEName.GetText(), RTL_TEXTENCODING_UTF8); +//hashtable auf stand halten + MyHashObject* pHObject; + ULONG nObjectId = AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, rBodyText, FALSE ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectList, nObjectId )); + mpSolIdMapper->Insert( rBodyText, pHObject ); + + ByteString sTokenLine( aNewProjectDlg.maEShort.GetText(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += '\t'; + sTokenLine += ByteString( aNewProjectDlg.maEName.GetText(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += "\t:\t"; + + ByteString sDeps = ByteString( aNewProjectDlg.maEDeps.GetText(), RTL_TEXTENCODING_UTF8 ); + + if ( sDeps != "" ) + { + USHORT i; + ByteString sDepName; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + sTokenLine += sDepName; + sTokenLine +='\t'; + } + } + sTokenLine +="NULL"; + + mpStarWriter->InsertTokenLine( sTokenLine ); + mpStarWriter->InsertTokenLine( sDelimiterLine ); + + if ( sDeps != "" ) + { + USHORT i; + ByteString sDepName; + ULONG nObjectId_l, nHashedId; + MyHashObject* pHObject_l; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + + pHObject_l = mpSolIdMapper->Find( sDepName ); + if ( !pHObject_l ) + { + String sMessage; + sMessage += String::CreateFromAscii("can't find "); + sMessage += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sMessage += String::CreateFromAscii(".\ndependency ignored"); + WarningBox aBox( GetDepWin(), WB_OK, sMessage); + aBox.Execute(); + } + else + { + nHashedId = pHObject_l->GetId(); + pHObject_l = mpSolIdMapper->Find( rBodyText ); + nObjectId_l = pHObject_l->GetId(); + AddConnectorToObjects( mpObjectList, nHashedId, nObjectId_l ); + } + } + } + return nObjectId; + } + return 0; +} + +ULONG Depper::HandleNewDirectoryDialog(ByteString &rBodyText) +{ + SolNewDirectoryDlg aNewDirectoryDlg( GetDepWin(), DtSodResId( RID_SD_DIALOG_NEWDIRECTORY )); +//todo: set defaults + if ( aNewDirectoryDlg.Execute() ) + { + rBodyText = ByteString( aNewDirectoryDlg.maEFlag.GetText(), RTL_TEXTENCODING_UTF8 ); +//hashtable auf stand halten + MyHashObject* pHObject; + ULONG nObjectId = AddObjectToList( GetDepWin(), mpObjectPrjList, mnSolLastId, mnSolWinCount, rBodyText ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectPrjList, nObjectId )); + mpPrjIdMapper->Insert( rBodyText, pHObject ); // mpPrjIdMapper + + String sTokenLine; + sTokenLine = String( mpPrj->GetPreFix(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += '\t'; + String sNameConvert = aNewDirectoryDlg.maEName.GetText(); + sNameConvert.SearchAndReplaceAll( '/', '\\' ); + if ( sNameConvert.GetToken( 0, 0x5c ) != String( mpPrj->GetProjectName(), RTL_TEXTENCODING_UTF8 )) + { + sTokenLine += String( mpPrj->GetProjectName(), RTL_TEXTENCODING_UTF8 ); + sTokenLine += String("\\", RTL_TEXTENCODING_UTF8 ); + sTokenLine += sNameConvert; + } + else + sTokenLine += sNameConvert; + sTokenLine += '\t'; + sTokenLine += aNewDirectoryDlg.maEAction.GetText(); + sTokenLine += String( "\t-\t", RTL_TEXTENCODING_UTF8 ); + sTokenLine += aNewDirectoryDlg.maEEnv.GetText(); + sTokenLine += '\t'; + sTokenLine += aNewDirectoryDlg.maEFlag.GetText(); + sTokenLine += '\t'; + + sTokenLine += String( "NULL", RTL_TEXTENCODING_UTF8 ); + + ByteString bsTokenLine = ByteString( sTokenLine, RTL_TEXTENCODING_UTF8 ); + mpStarWriter->InsertTokenLine( bsTokenLine ); + + if ( aNewDirectoryDlg.maEDeps.GetText() != String( "", RTL_TEXTENCODING_UTF8 )) + { + USHORT i; + ByteString sDeps = ByteString( aNewDirectoryDlg.maEDeps.GetText(), RTL_TEXTENCODING_UTF8 ); + ByteString sDepName; + ULONG nObjectId_l, nHashedId; + MyHashObject* pHObject_l; + USHORT nToken = sDeps.GetTokenCount(' '); + for ( i = 0 ; i < nToken ; i++) + { + sDepName = sDeps.GetToken( i, ' ' ); + + pHObject_l = mpPrjIdMapper->Find( sDepName ); // mpPrjIdMapper + if ( !pHObject_l ) + { + String sMessage; + sMessage += String::CreateFromAscii("can't find "); + sMessage += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sMessage += String::CreateFromAscii(".\ndependency ignored"); + WarningBox aBox( mpBaseWin, WB_OK, sMessage); + aBox.Execute(); + } + else + { + sTokenLine += String( sDepName, RTL_TEXTENCODING_UTF8 ); + sTokenLine +='\t'; + nHashedId = pHObject_l->GetId(); + pHObject_l = mpPrjIdMapper->Find( rBodyText ); // mpPrjIdMapper + nObjectId_l = pHObject_l->GetId(); + AddConnectorToObjects( mpObjectPrjList, nHashedId, nObjectId_l ); + } + } + } + + if ( mpPrj->Count() > 1 ) + { + CommandData* pData = mpPrj->GetObject( mpPrj->Count() - 1 ); + pData = mpPrj->Replace( pData, mpPrj->Count() - 2 ); + mpPrj->Replace( pData, mpPrj->Count() - 1 ); + } + + return nObjectId; + } + return 0; +} + +// Context-Menue +IMPL_LINK( Depper, PopupSelected, PopupMenu*, mpPopup ) +{ + USHORT nItemId = mpPopup->GetCurItemId(); + + switch( nItemId ) + { + case DEPPOPUP_NEW : + { + ByteString sNewItem = ByteString("new"); + //AddObject( mpObjectList, sNewItem , TRUE ); + } + break; + case DEPPOPUP_AUTOARRANGE : + //AutoArrange( mpObjectList, mpObjectList, GetStart(), 0 ); + break; + case DEPPOPUP_LOAD : + //Load( ByteString("test.dep")); + break; + case DEPPOPUP_SAVE : + Save( ByteString("test.dep")); + break; + case DEPPOPUP_WRITE_SOURCE : + WriteSource(); + break; + case DEPPOPUP_READ_SOURCE : + ReadSource(TRUE); + break; + case DEPPOPUP_OPEN_SOURCE : + OpenSource(); + break; + case DEPPOPUP_ZOOMIN : + { +// DBG_ASSERT( FALSE,"zoomin"); + MapMode aMapMode = GetDepWin()->GetMapMode(); + aMapMode.SetScaleX( aMapMode.GetScaleX() * Fraction( 1.25 )); + aMapMode.SetScaleY( aMapMode.GetScaleY() * Fraction( 1.25 )); + GetDepWin()->SetMapMode( aMapMode ); + + if ( nZoomed < 1 ) + { + Size aZoomInSize( GetDepWin()->GetSizePixel()); + aZoomInSize.Width() *= 1.25; + aZoomInSize.Height() *= 1.25; + GetDepWin()->SetSizePixel( aZoomInSize ); + } + nZoomed--; + + Zoom( aMapMode ); + }; + break; + case DEPPOPUP_ZOOMOUT : + { +// DBG_ASSERT( FALSE,"zoomout"); + MapMode aMapMode = GetDepWin()->GetMapMode(); + if ( aMapMode.GetScaleX() > Fraction( 0.25 )) + { + aMapMode.SetScaleX( aMapMode.GetScaleX() * Fraction( 0.8 )); + aMapMode.SetScaleY( aMapMode.GetScaleY() * Fraction( 0.8 )); + GetDepWin()->SetMapMode( aMapMode ); + + if ( nZoomed < 0 ) + { + Size aZoomOutSize( mpBaseWin->GetSizePixel()); + aZoomOutSize.Width() *= 0.8; + aZoomOutSize.Height() *= 0.8; + GetDepWin()->SetSizePixel( aZoomOutSize ); + } + nZoomed++; + + Zoom( aMapMode ); + } + }; + break; + case DEPPOPUP_CLEAR : +// DBG_ASSERT( FALSE,"clear"); +// RemoveAllObjects( mpObjectList ); + break; + case DEPPOPUP_CLOSE : +// DBG_ASSERT( FALSE,"close"); + CloseWindow(); + break; + case DEPPOPUP_HELP : +// DBG_ASSERT( FALSE,"help"); + ShowHelp(); + break; + case DEPPOPUP_TEST : +// DBG_ASSERT( FALSE,"TEST!"); +// test(); + break; + case DEPPOPUP_SHOW_TOOLBOX: + maToolBox.Show(); + break; + default : + DBG_ASSERT( FALSE, "default" ); + break; + } + return 0; +}
\ No newline at end of file diff --git a/soldep/source/depwin.cxx b/soldep/source/depwin.cxx new file mode 100644 index 000000000000..5d7a1e36e4e7 --- /dev/null +++ b/soldep/source/depwin.cxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/debug.hxx> + +#include <soldep/depwin.hxx> +#include <soldep/depper.hxx> +#include <soldep/connctr.hxx> +#include <soldep/objwin.hxx> + +Bitmap* pWinCopy; + +DepWin::DepWin( Window* pParent, WinBits nWinStyle ) : + Window( pParent, nWinStyle ), + mbStartNewCon( FALSE ), + maNewConStart( 0, 0 ), + maNewConEnd( 0, 0 ) +// mpSelectedProject( NULL ) unbekannt +// mpCapturer( NULL ) +{ + if ( !pParent->IsChildNotify() ) + pParent->EnableChildNotify( TRUE ); +// if ( !pParent->IsAllResizeEnabled()) +// pParent->EnableAllResize( TRUE ); + SetUpdateMode( TRUE ); + SetPosSizePixel( Point(0,0), Size( 2000, 2000 )); //Size of the scrollable Window + mpPopup = new PopupMenu(); +} + +DepWin::~DepWin() +{ + Hide(); + while( ConList.Count() > 0 ) + { + delete ConList.GetObject( 0 ); + } +// if ( mpPopup ) +/// delete mpPopup; +} + +void DepWin::AddConnector( Connector* pNewCon ) +{ + ConList.Insert( pNewCon ); +} + +void DepWin::RemoveConnector( Connector* pOldCon ) +{ + ConList.Remove( pOldCon ); +} + +void DepWin::NewConnector( ObjectWin* pWin ) +{ + if ( !mbStartNewCon ) + { + mpNewConWin = pWin; + mbStartNewCon = TRUE; + maNewConStart = pWin->GetFixPoint(Point(0,0)); + } + else + { + Invalidate( Rectangle( maNewConStart, maNewConEnd )); + if ( pWin != mpNewConWin ) + { +// Connector* pConctr; +// pConctr = new Connector( this, WB_NOBORDER ); +// pConctr->Initialize( mpNewConWin, pWin ); + +// AddConnector has been moved to soldep +// mpDepperDontuseme->AddConnector( mpNewConWin, pWin ); + } + mpNewConWin = 0L; + mbStartNewCon = FALSE; + } + +} + +void DepWin::Paint( const Rectangle& rRect ) +{ + ULONG i = 0; + ULONG nListCount = ConList.Count(); + + for ( i=0 ; i < nListCount ; i++ ) + { + ConList.GetObject( i )->Paint( aEmptyRect ); + } + if ( mbStartNewCon ) + { + DrawLine( maNewConStart, maNewConEnd ); + } +} + +void DepWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset ) +{ + ULONG i = 0; + ULONG nListCount = ConList.Count(); + + for ( i=0 ; i < nListCount ; i++ ) + { + ConList.GetObject( i )->DrawOutput( pDevice, rOffset ); + } + if ( mbStartNewCon ) + { + pDevice->DrawLine( maNewConStart, maNewConEnd ); + } +} + +void DepWin::MouseButtonUp( const MouseEvent& rMEvt ) +{ + if ( rMEvt.IsRight() ) + { + mpPopup->Execute( this, rMEvt.GetPosPixel()); + } +} + +void DepWin::MouseMove( const MouseEvent& rMEvt ) +{ + if ( mbStartNewCon ) + { + Invalidate( Rectangle( maNewConStart, maNewConEnd )); + maNewConEnd = PixelToLogic(rMEvt.GetPosPixel()); + maNewConStart = mpNewConWin->GetFixPoint( maNewConEnd ); + } +} + + +ConnectorList* DepWin::GetConnectorList() +{ + return &ConList; +} + +void DepWin::SetPopupHdl( void* pHdl ) +{ + mpPopup->SetSelectHdl( LINK( pHdl, Depper, PopupSelected )); +} + +void DepWin::Command( const CommandEvent& rEvent) +{ + //mpDepperDontuseme->GetGraphWin()->Command( rEvent ); + GetParent()->Command( rEvent ); +} diff --git a/soldep/source/graphwin.cxx b/soldep/source/graphwin.cxx new file mode 100644 index 000000000000..7450d654ab38 --- /dev/null +++ b/soldep/source/graphwin.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/graphwin.hxx> +//#include "depapp.hxx" +#include <soldep/soldep.hxx> + + +GraphWin::GraphWin( Window * pParent, void * pClass ) +: ScrollableWindow( pParent, 0L, SCRWIN_DEFAULT | SCRWIN_VCENTER | SCRWIN_HCENTER ) +, aBufferWindow( this ) +{ + mpClass = pClass; + SetSizePixel( pParent->GetSizePixel()); + SetPosPixel( pParent->GetPosPixel()); + SetTotalSize( Size( 2000,2000 )); + + aBufferWindow.SetBackground( Wallpaper( Color( COL_WHITE ))); + aBufferWindow.SetPosSizePixel( PIXELS( 0, 0, 2000, 2000 ) ); + aBufferWindow.Show(); // Content + Show(); // Window with Scrollbars +} + +void GraphWin::EndScroll( long nDeltaX, long nDeltaY ) +{ + // get the visible area + Rectangle aArea( GetVisibleArea()); + long nX = aArea.Right(); + long nY = aArea.Bottom(); + + // set the new pos and size by using LogicToPixel (this is mandatory) + aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )), + LogicToPixel( Size( nX, nY ))); + aBufferWindow.Invalidate(); +} + +void GraphWin::Resize() +{ + // get the visible area + ScrollableWindow::Resize(); + Rectangle aArea( GetVisibleArea()); + long nX = aArea.Right(); + long nY = aArea.Bottom(); + + // set the new pos and size by using LogicToPixel (this is mandatory) + aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )), + LogicToPixel( Size( nX, nY ))); +} + +void GraphWin::Command( const CommandEvent& rEvent) +{ + ScrollableWindow::Command( rEvent ); +} diff --git a/soldep/source/hashobj.cxx b/soldep/source/hashobj.cxx new file mode 100644 index 000000000000..7f05dc33870a --- /dev/null +++ b/soldep/source/hashobj.cxx @@ -0,0 +1,37 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/hashobj.hxx> + +class ObjectWin; + + +MyHashObject::MyHashObject( ULONG nId, ObjectWin* pWin ) +{ + mnId = nId; + mpWin = pWin; +}; diff --git a/soldep/source/makefile.mk b/soldep/source/makefile.mk new file mode 100644 index 000000000000..5261ee5175f6 --- /dev/null +++ b/soldep/source/makefile.mk @@ -0,0 +1,146 @@ +#************************************************************************* +# +# 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 +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=soldep +TARGET=soldep + + +# --- Settings ----------------------------------------------------- +#.INCLUDE : $(PRJ)$/util$/perl.mk +.INCLUDE : settings.mk + +# fixme, code is not yet 64 bit clean +.IF "$(OS)$(CPU)"=="LINUXX" || ("$(COM)"=="C52" && "$(CPU)"=="U") +all: + @echo nothing to do +.ENDIF + + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/soldep.obj \ + $(SLO)$/soldlg.obj \ + $(SLO)$/depper.obj \ + $(SLO)$/hashobj.obj \ + $(SLO)$/connctr.obj \ + $(SLO)$/depwin.obj \ + $(SLO)$/graphwin.obj \ + $(SLO)$/tbox.obj \ + $(SLO)$/sdtresid.obj \ + $(SLO)$/objwin.obj + +SHL1TARGET =$(TARGET)$(DLLPOSTFIX) +SHL1IMPLIB =$(TARGET) +SHL1LIBS =$(SLB)$/$(TARGET).lib \ + $(SLB)$/bootstrpdt.lib +SHL1DEF =$(MISC)$/$(SHL1TARGET).def +SHL1DEPN =$(SHL1LIBS) +SHL1STDLIBS = $(SVTOOLLIB) \ + $(CPPUHELPERLIB) \ + $(COMPHELPERLIB) \ + $(VCLLIB) \ + $(UCBHELPERLIB) \ + $(SOTLIB) \ + $(BTSTRPLIB) \ + $(TOOLSLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(CPPULIB) \ + $(PERL_LIB) + +#.IF "$(GUI)" == "UNX" +#SHL1STDLIBS+=\ +# $(SALLIB) +#.ENDIF + + +DEF1NAME =$(SHL1TARGET) +DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt +DEFLIB1NAME =$(TARGET) + +SRC1FILES = \ + soldlg.src +RES1TARGET = dep +SRS1NAME=$(TARGET) +SRS1FILES = \ + $(SRS)$/$(TARGET).srs + +RESLIB1NAME = dep +RESLIB1SRSFILES = \ + $(SRS)$/$(TARGET).srs + + +#------------- Application --------------- +APP1TARGET=soldepl + +APP1ICON=soldep.ico + +APP1STDLIBS= \ + $(SVTOOLLIB) \ + $(CPPUHELPERLIB) \ + $(COMPHELPERLIB) \ + $(UCBHELPERLIB) \ + $(VCLLIB) \ + $(SOTLIB) \ + $(BTSTRPLIB) \ + $(TOOLSLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(CPPULIB) \ + $(PERL_LIB) + +APP1LIBS=\ + $(SLB)$/bootstrpdt.lib \ + $(SLB)$/soldep.lib + +APP1OBJS= \ + $(SLO)$/depapp.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +ALLTAR : $(BIN)$/applicat.rdb + +$(BIN)$/applicat.rdb : makefile.mk $(UNOUCRRDB) + rm -f $@ + $(GNUCOPY) $(UNOUCRRDB) $@ + cd $(BIN) && \ + $(REGCOMP) -register -r applicat.rdb \ + -c i18nsearch.uno$(DLLPOST) \ + -c i18npool.uno$(DLLPOST) + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo WEP > $@ + @echo LIBMAIN >> $@ + @echo LibMain >> $@ + @echo __CT >> $@ diff --git a/soldep/source/objwin.cxx b/soldep/source/objwin.cxx new file mode 100644 index 000000000000..07eab4dd4cb7 --- /dev/null +++ b/soldep/source/objwin.cxx @@ -0,0 +1,821 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/list.hxx> +#include <tools/debug.hxx> +#include <vcl/svapp.hxx> +#include <vcl/help.hxx> +#include <vcl/wall.hxx> + +#include <soldep/objwin.hxx> +#include <soldep/depwin.hxx> +//#include "depapp.hxx" +#include <soldep/depper.hxx> +//#include "prjdep.hxx" +#include <soldep/connctr.hxx> +#include <stdio.h> + +static Color aDefaultColor = 0L; +static Wallpaper* pDefaultWallpaper = 0L; + +// Initialize static class member +BOOL ObjectWin::msbHideMode = FALSE; +ULONG ObjectWin::msnGlobalViewMask = 0; + + +UINT32 aColorMap[] = { + RGB_COLORDATA( 0xFF, 0xFF, 0x80 ), //MARKMODE_DEFAULT 0 + COL_GREEN, //MARKMODE_DEPENDING 1 + COL_RED, //MARKMODE_NEEDED 2 + COL_MAGENTA, //1+2 + COL_GRAY, //MARKMODE_ACTIVATED 4 + COL_LIGHTGREEN, //1+4 + COL_LIGHTRED, //2+4 + COL_LIGHTMAGENTA, //1+2+4 + COL_BLUE, //MARKMODE_SELECTED 8 + COL_LIGHTGRAY, //1+8 + COL_CYAN, //2+8 + COL_LIGHTCYAN, //1+2+8 + COL_LIGHTBLUE, //4+8 + COL_BROWN, //1+4+8 + COL_BLACK, //2+4+8 + COL_BLUE //1+2+4+8 +}; + + +// +// class ObjectWin +// + +/*****************************************************************************/ +ObjectWin::ObjectWin( Window* pParent, WinBits nWinStyle ) +/*****************************************************************************/ + : Window( pParent, nWinStyle ), + msBodyText( "" ), + msTipText( "" ), + mnObjectId( 0 ), + mnMarkMode( 0 ), + mnViewMask( 0 ), + mbVisible( FALSE ), + mbMenuExecute( FALSE ), + mbVisited( FALSE ), + mnRootDist( 0 ), + mnHeadDist( 0 ), + mbFixed( FALSE ) +{ + SetBackground( Wallpaper( aColorMap[0] )); + + aTipTimer.SetTimeout( 500 ); + aTipTimer.SetTimeoutHdl( + LINK( this, ObjectWin, TipHdl )); + + SetFont( Font( GetFont() ) ); + Font aFont( GetFont() ); + Size aSize = aFont.GetSize(); + aFont.SetSize( aSize ); + SetFont( aFont ); + + EnableClipSiblings(); + SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + mpPopup = new PopupMenu(); + mpPopup->InsertItem( OBJWIN_EDIT_TEXT, String::CreateFromAscii( "Details" )); + mpPopup->InsertItem( OBJWIN_ADD_CONNECTOR, String::CreateFromAscii( "New connection" )); + mpPopup->InsertItem( OBJWIN_REMOVE_WIN, String::CreateFromAscii( "Remove object" )); + mpPopup->InsertItem( OBJWIN_VIEW_CONTENT, String::CreateFromAscii( "View content" )); +// mpPopup->InsertSeparator(); + mpPopup->SetSelectHdl( LINK( this, ObjectWin, PopupSelected )); + mpPopup->SetDeactivateHdl( LINK( this, ObjectWin, PopupDeactivated )); + mnPopupStaticItems = mpPopup->GetItemCount(); + + if ( ! pDefaultWallpaper ) + { + pDefaultWallpaper = new Wallpaper( GetBackground() ); + aDefaultColor = GetTextColor(); + } + Hide(); +} + +/*****************************************************************************/ +ObjectWin::~ObjectWin() +/*****************************************************************************/ +{ + while ( mConnections.Count() > 0 ) + { + delete mConnections.GetObject( 0 ); + } +} + +void ObjectWin::SetHideMode(BOOL bHide) +{ + msbHideMode = bHide; + mConnections.GetObject(0)->SetHideMode(msbHideMode); +} + +BOOL ObjectWin::ToggleHideMode() +{ + msbHideMode = !msbHideMode; + mConnections.GetObject(0)->SetHideMode(msbHideMode); + return msbHideMode; +} + +/*****************************************************************************/ +void ObjectWin::SetViewMask( ULONG nMask ) +/*****************************************************************************/ +{ + mnViewMask = nMask; + // Compares + if ( mnViewMask & msnGlobalViewMask) { + mbVisible = TRUE; + Show(); + } + else { + Hide(); + mbVisible = FALSE; + } + for ( ULONG i = 0; i < mConnections.Count(); i++ ) + mConnections.GetObject( i )->UpdateVisibility(); +} + +/*****************************************************************************/ +void ObjectWin::SetBodyText( const ByteString& rNewString ) +/*****************************************************************************/ +{ + msBodyText = rNewString; +} + +/*****************************************************************************/ +ByteString& ObjectWin::GetBodyText() +/*****************************************************************************/ +{ + return msBodyText; +} + +/*****************************************************************************/ +void ObjectWin::SetTipText( const ByteString& rNewString ) +/*****************************************************************************/ +{ + msTipText = rNewString; +} + +/*****************************************************************************/ +ByteString& ObjectWin::GetTipText() +/*****************************************************************************/ +{ + return msTipText; +} + +/*****************************************************************************/ +Point ObjectWin::GetFixPoint( const Point& rRefPoint, BOOL bUseRealPos ) +/*****************************************************************************/ +{ + Point aLocalPoint; + if ( bUseRealPos ) + aLocalPoint = GetPosPixel(); + else + aLocalPoint = GetCalcPosPixel(); + + Size aLocalSize = GetSizePixel(); + Point aRetPoint; + + USHORT nRefX = aLocalPoint.X() + aLocalSize.Width() / 2 ; + USHORT nRefY = aLocalPoint.Y() + aLocalSize.Height() / 2 ; + + // always false... + //if ( nRefX < 0 ) nRefX = 0; + //if ( nRefY < 0 ) nRefY = 0; + + if ( rRefPoint.X() > nRefX ) + { + if ( rRefPoint.Y() > nRefY ) + { + if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) + { + aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width(); + aRetPoint.Y() = nRefY; + } + else + { + aRetPoint.X() = nRefX; + aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height(); + } + } + else + { + if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) + { + aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width(); + aRetPoint.Y() = nRefY; + } + else + { + aRetPoint.X() = nRefX; + aRetPoint.Y() = aLocalPoint.Y(); + } + } + } + else + { + if ( rRefPoint.Y() > nRefY ) + { + if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) + { + aRetPoint.X() = aLocalPoint.X(); + aRetPoint.Y() = nRefY; + } + else + { + aRetPoint.X() = nRefX; + aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height(); + } + } + else + { + if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) + { + aRetPoint.X() = aLocalPoint.X(); + aRetPoint.Y() = nRefY; + } + else + { + aRetPoint.X() = nRefX; + aRetPoint.Y() = aLocalPoint.Y(); + } + } + } + + return PixelToLogic(aRetPoint); + +} + +/*****************************************************************************/ +void ObjectWin::AddConnector( Connector* pNewCon ) +/*****************************************************************************/ +{ + mConnections.Insert( pNewCon ); +} + +/*****************************************************************************/ +BOOL ObjectWin::ConnectionExistsInAnyDirection( ObjectWin *pWin ) +/*****************************************************************************/ +{ + for ( ULONG i = 0; i < mConnections.Count(); i++ ) + if ( mConnections.GetObject( i )->GetOtherWin( this ) == pWin ) + return TRUE; + + return FALSE; +} + +/*****************************************************************************/ +void ObjectWin::RemoveConnector( Connector* pOldCon ) +/*****************************************************************************/ +{ + mConnections.Remove( pOldCon ); +} + +/*****************************************************************************/ +Connector* ObjectWin::GetConnector( ULONG nIndex ) +/*****************************************************************************/ +{ + ULONG nConCount = mConnections.Count(); + + if ( nIndex < nConCount ) + return mConnections.GetObject( nIndex ); + return NULL; +} + +/*****************************************************************************/ +Connector* ObjectWin::GetConnector( ULONG nStartId, ULONG nEndId ) +/*****************************************************************************/ +{ + if ( mnObjectId != nStartId ) + return NULL; + + USHORT i; + Connector* pCon; + ULONG nConCount = mConnections.Count(); + + for ( i = 0; i < nConCount; i++ ) + { + pCon = mConnections.GetObject( i ); + if ( pCon->GetOtherWin( this )->GetId() == nEndId ) + return pCon; + } + return NULL; +} + +void ObjectWin::SetAllConnectorsUnvisible() +{ + Connector* pCon; + ULONG nConCount = mConnections.Count(); + for ( ULONG i = 0; i < nConCount; i++ ) + { + pCon = mConnections.GetObject( i ); + if (pCon) pCon->SetVisibility( FALSE ); + } +} + +/*****************************************************************************/ +void ObjectWin::SetMarkMode( ULONG nMarkMode ) +/*****************************************************************************/ +{ + //Wallpaper aWallpaper; + + if ( nMarkMode == MARKMODE_DEFAULT ) + { + if ( pDefaultWallpaper ) + { + maObjWallpaper = GetBackground(); + maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() ); + SetBackground( maObjWallpaper ); + SetTextColor( aDefaultColor ); + } + } + else + { + mnMarkMode |= nMarkMode; + maObjWallpaper = GetBackground(); + maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); + SetBackground( maObjWallpaper ); + SetTextColor( COL_WHITE ); + } + + Invalidate(); +} + +/*****************************************************************************/ +void ObjectWin::UnsetMarkMode( ULONG nMarkMode ) +/*****************************************************************************/ +{ + //Wallpaper aWallpaper; + + ULONG nOldMode = mnMarkMode; + mnMarkMode &= ( !nMarkMode ); + + if ( nOldMode != mnMarkMode ) { + if ( mnMarkMode == MARKMODE_DEFAULT ) + { + if ( pDefaultWallpaper ) + { + maObjWallpaper = GetBackground(); + maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() ); + SetBackground( maObjWallpaper ); + SetTextColor( aDefaultColor ); + } + } + else + { + maObjWallpaper = GetBackground(); + maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); //mnMarkMode + SetBackground( maObjWallpaper ); + SetTextColor( COL_WHITE ); + } + Invalidate(); + } +} + +/*****************************************************************************/ +void ObjectWin::MarkNeeded( BOOL bReset ) +/*****************************************************************************/ +{ + Connector* pCon; + ObjectWin* pWin; + + ULONG nConCount = mConnections.Count(); + ULONG i; + + for ( i = 0; i < nConCount; i++ ) + { + pCon = mConnections.GetObject( i ); + if ( pCon && !pCon->IsStart( this)) + { + pWin = pCon->GetOtherWin( this ); + if ( pWin ) + { + if ( bReset ) + pWin->UnsetMarkMode( MARKMODE_NEEDED ); + else + pWin->SetMarkMode( MARKMODE_NEEDED ); + pWin->MarkNeeded( bReset ); // recursive call + } + } + } +} + +/*****************************************************************************/ +void ObjectWin::MarkDepending( BOOL bReset ) +/*****************************************************************************/ +{ + //if ( !bReset ) + // return; + + Connector* pCon; + ObjectWin* pWin; + + ULONG nConCount = mConnections.Count(); + ULONG i; + + for ( i = 0; i < nConCount; i++ ) + { + pCon = mConnections.GetObject( i ); + if ( pCon && pCon->IsStart( this) ) + { + pWin = pCon->GetOtherWin( this ); + if ( pWin ) + { + if ( bReset ) + pWin->UnsetMarkMode( MARKMODE_DEPENDING ); + else + pWin->SetMarkMode( MARKMODE_DEPENDING ); + pWin->MarkDepending( bReset ); // recursive call + } + } + } +} + +/*****************************************************************************/ +void ObjectWin::Paint( const Rectangle& rRect ) +/*****************************************************************************/ +{ + Size aWinSize = PixelToLogic( GetOutputSizePixel() ); + Size aTextSize; + ByteString sbt = msBodyText; //debug + //sbt += " "; //debug + //sbt += ByteString::CreateFromInt32(mnMarkMode); //debug + aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 )); + aTextSize.Height() = GetTextHeight(); + Point aPos( aWinSize.Width() / 2 - aTextSize.Width() / 2, + aWinSize.Height() / 2 - aTextSize.Height() / 2 ); + + //DrawText( aPos , String( sBodyText, RTL_TEXTENCODING_UTF8 )); + if (msBodyText =="null") //don't paint this "window" + { + Hide(); + Invalidate(); + } else + DrawText( aPos , String( sbt, RTL_TEXTENCODING_UTF8 )); //debug +} + +void ObjectWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset ) +/*****************************************************************************/ +{ + Size aWinSize = PixelToLogic( GetSizePixel() ); + Size aTextSize; + ByteString sbt = msBodyText; + aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 )); + aTextSize.Height() = GetTextHeight(); + Point aPos = GetPosPixel(); + Point aTextPos( aWinSize.Width() / 2 - aTextSize.Width() / 2, + aWinSize.Height() / 2 - aTextSize.Height() / 2 ); + aTextPos += aPos; + aPos = pDevice->PixelToLogic( aPos ) - rOffset; + aTextPos = pDevice->PixelToLogic( aTextPos ) - rOffset; + if ( msBodyText !="null" ) + { + pDevice->SetFillColor( GetBackground().GetColor() ); + pDevice->DrawRect( Rectangle( aPos, pDevice->PixelToLogic( GetSizePixel() ) ) ); + Font aFont( GetFont() ); + Size aSize = aFont.GetSize(); + aSize = pDevice->PixelToLogic( aSize ); + aFont.SetSize( aSize ); + pDevice->SetFont( aFont ); + pDevice->SetTextColor( GetTextColor() ); + pDevice->DrawText( aTextPos, String( sbt, RTL_TEXTENCODING_UTF8 ) ); + } +} + +/*****************************************************************************/ +void ObjectWin::MouseButtonDown( const MouseEvent& rMEvt ) +/*****************************************************************************/ +{ + //Notify Soldep to clear ObjectList + SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + GrabFocus(); + + // workaround fuer vcl-bug +// GetWindow( WINDOW_REALPARENT)->Invalidate(); +// MyApp *pApp = (MyApp*)GetpApp(); +// SolDep *pSoldep = pApp->GetSolDep(); + + maMouseOffset = rMEvt.GetPosPixel(); + if ( rMEvt.IsLeft() ) + { + + if ( rMEvt.IsMod2() ) // alt + mouse click left + { + CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT, this ); + } + else { + CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN, this ); + } + if( rMEvt.GetClicks() == 2 ) + CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK, this ); + else if ( !rMEvt.IsShift() && !((DepWin*)GetParent())->IsStartNewCon()) + { + //((DepWin*)GetParent())->SaveSelectedObjWin(&this); + CaptureMouse(); + } + } +} + +/*****************************************************************************/ +void ObjectWin::MouseButtonUp( const MouseEvent& rMEvt ) +/*****************************************************************************/ +{ + fprintf(stdout,"ObjectWin::MouseButtonUp\n"); + if ( rMEvt.IsLeft() ) + { + if ( rMEvt.IsShift() || ((DepWin*)GetParent())->IsStartNewCon()) + CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP_SHFT, this ); +// ((DepWin*)GetParent())->NewConnector( this ); + else + { + CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP, this ); + if ( IsMouseCaptured() ) ReleaseMouse(); + } + } + else if ( rMEvt.IsRight() ) + { + USHORT i; + + while ( mnPopupStaticItems < mpPopup->GetItemCount() ) + { + mpPopup->RemoveItem( mnPopupStaticItems ); + } + + if ( mConnections.Count()) { + mpPopup->InsertSeparator(); + + for( i = 0; i < mConnections.Count() ; i++ ) + { + mpPopup->InsertItem( mnPopupStaticItems + i + 1, String( ((mConnections.GetObject( i ))->GetOtherWin( this ))->GetBodyText(), RTL_TEXTENCODING_UTF8 )); + } + } + mbMenuExecute = TRUE; + mpPopup->Execute( GetParent(), rMEvt.GetPosPixel() + GetPosPixel()); + } +} + +/*****************************************************************************/ +void ObjectWin::MouseMove( const MouseEvent& rMEvt ) +/*****************************************************************************/ +{ + if ( IsMouseCaptured() ) + { + USHORT i; + + Point aNewWinPos( GetPosPixel() + rMEvt.GetPosPixel() - maMouseOffset ); + + aNewWinPos.X() = Max( 0L, aNewWinPos.X()); + aNewWinPos.Y() = Max( 0L, aNewWinPos.Y()); + SetPosPixel( aNewWinPos ); + //int t = mConnections.Count(); + + for ( i=0; i < mConnections.Count();i++) + { + mConnections.GetObject( i )->UpdatePosition( this ); + } + } + else // !IsMouseCaptured() + { + if ( rMEvt.IsLeaveWindow() ) + aTipTimer.Stop(); + else + aTipTimer.Start(); + + MouseEvent aNewMEvt( rMEvt.GetPosPixel() + GetPosPixel()); + + GetParent()->MouseMove( aNewMEvt ); //call to DepWin::MouseMove + } +} + +/*****************************************************************************/ +USHORT ObjectWin::Save( SvFileStream& rOutFile ) +/*****************************************************************************/ +{ + return 0; +} + +/*****************************************************************************/ +USHORT ObjectWin::Load( SvFileStream& rInFile ) +/*****************************************************************************/ +{ + return 0; +} + +/*****************************************************************************/ +void ObjectWin::SetId( ULONG nId ) +/*****************************************************************************/ +{ + mnObjectId = nId; +} + +/*****************************************************************************/ +ULONG ObjectWin::GetId() +/*****************************************************************************/ +{ + return mnObjectId; +} + +/*****************************************************************************/ +void ObjectWin::UpdateConnectors() +/*****************************************************************************/ +{ + USHORT i; + + for ( i = 0; i < mConnections.Count(); i++ ) + { + mConnections.GetObject( i )->UpdatePosition( this ); + } +} + +IMPL_LINK( ObjectWin, PopupSelected, PopupMenu*, mpPopup_l ) +{ + USHORT nItemId = mpPopup_l->GetCurItemId(); + + switch( nItemId ) + { + case OBJWIN_EDIT_TEXT : + DBG_ASSERT( FALSE,"edit"); + break; + case OBJWIN_REMOVE_WIN : +// DBG_ASSERT( FALSE,"remove"); +// DBG_ASSERT( mpDepperDontuseme,"remove"); + //mpDepperDontuseme->RemoveObject(mpDepperDontuseme->mpObjectList, ( USHORT ) GetId()); + break; + case OBJWIN_ADD_CONNECTOR : +// DBG_ASSERT( FALSE,"add con"); + ((DepWin*)GetParent())->NewConnector( this ); + break; + case OBJWIN_VIEW_CONTENT : +// DBG_ASSERT( FALSE,"view cnt"); +// mpDepperDontuseme->ViewContent( msBodyText ); +// TBD: CallEventListener + break; + default : +// DBG_ASSERT( FALSE, String (nItemId) ); + Connector* pCon = mConnections.GetObject( nItemId - mnPopupStaticItems - 1); + pCon = 0; +// delete pCon; +// mpDepperDontuseme->RemoveConnector( pCon->GetStartId(), pCon->GetEndId()); +// TBD: CallEventListener + + break; + } + return 0; +} + +/*****************************************************************************/ +IMPL_LINK( ObjectWin, TipHdl, void *, EMTY_ARG ) +/*****************************************************************************/ +{ + aTipTimer.Stop(); + + if ( msTipText.Len()) { + Point aPos( GetpApp()->GetAppWindow()->GetPointerPosPixel()); + Help::ShowBalloon( GetpApp()->GetAppWindow(), + Point( aPos.X(), aPos.Y()), + String( msTipText, RTL_TEXTENCODING_UTF8 )); + } + return 0; +} + +/*****************************************************************************/ +//void ObjectWin::GetFocus() +/*****************************************************************************/ +//{ + //SetMarkMode( MARKMODE_SELECTED ); +//} + +/*****************************************************************************/ +void ObjectWin::LoseFocus() +/*****************************************************************************/ +{ + if ( !mbMenuExecute && !msbHideMode ) { + UnsetMarkMode( MARKMODE_SELECTED ); + UnsetMarkMode( MARKMODE_ACTIVATED ); + MarkNeeded( TRUE ); + MarkDepending( TRUE ); + } + else + mbMenuExecute = FALSE; +} + +/*****************************************************************************/ +IMPL_LINK( ObjectWin, PopupDeactivated, PopupMenu*, mpPopup_l ) +/*****************************************************************************/ +{ + mbMenuExecute = FALSE; + + if ( !HasFocus()) { + UnsetMarkMode( MARKMODE_SELECTED ); + UnsetMarkMode( MARKMODE_ACTIVATED ); + MarkNeeded( TRUE ); + MarkDepending( TRUE ); + } + + return 0; +} + +/*****************************************************************************/ +void ObjectWin::Command( const CommandEvent& rEvent) +/*****************************************************************************/ +{ + fprintf(stdout, "ObjectWin::Command"); +// mpDepperDontuseme->GetGraphWin()->Command( rEvent ); +// TBD: CallEventListener + +} + +/*****************************************************************************/ +/*****************************************************************************/ + +ObjectList::ObjectList() : ObjWinList() +{ +} + +/*****************************************************************************/ +void ObjectList::ResetSelectedObject() +/*****************************************************************************/ +{ +// return; + + ULONG nCount_l = Count(); + ObjectWin* pObjectWin = NULL; + for (ULONG i=0; i < nCount_l; i++ ) + { + pObjectWin = GetObject( i ); + pObjectWin->UnsetMarkMode( MARKMODE_SELECTED ); + pObjectWin->UnsetMarkMode( MARKMODE_NEEDED ); + pObjectWin->UnsetMarkMode( MARKMODE_DEPENDING ); + pObjectWin->SetActualWallpaper(*pDefaultWallpaper); + pObjectWin->SetAllConnectorsUnvisible(); + } + return; +} + +/*****************************************************************************/ +ObjectWin* ObjectList::GetPtrByName( const ByteString& rText ) +/*****************************************************************************/ +{ + ULONG i = 0; + ULONG nCount_l = Count(); + ObjectWin* pObjectWin = NULL; + while ( i < nCount_l ) + { + pObjectWin = GetObject( i ); + ByteString sPrj = pObjectWin->GetBodyText(); + if (sPrj == rText) return pObjectWin; + i++; + } + return 0; +} + +ObjectList* ObjectList::FindTopLevelModules() +{ + ObjectList* pList = new ObjectList; + for ( USHORT i=0; i<Count(); i++ ) + { + ObjectWin* pObjectWin = GetObject( i ); + if ( pObjectWin->IsTop() ) + pList->Insert( pObjectWin ); + } + + return pList; +} + +BOOL ObjectWin::IsTop() +{ + ULONG nConCount = mConnections.Count(); + for ( ULONG i = 0; i < nConCount; i++ ) + { + Connector* pCon = mConnections.GetObject( i ); + if ( pCon && pCon->IsStart( this) ) + return FALSE; + } + + return TRUE; +}
\ No newline at end of file diff --git a/soldep/source/sdtresid.cxx b/soldep/source/sdtresid.cxx new file mode 100644 index 000000000000..02977059f5c6 --- /dev/null +++ b/soldep/source/sdtresid.cxx @@ -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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <soldep/sdtresid.hxx> + +SolDevDll::SolDevDll() +{ + *(SolDevDll**)GetAppData( SHL_SCH ) = this; + + ByteString aResMgrName( "dep" ); + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), + Application::GetSettings().GetUILocale() ); +} + +SolDevDll::~SolDevDll() +{ + delete pResMgr; +} + +DtSodResId::DtSodResId( USHORT nId ) : +ResId(nId, *(*(SolDevDll**)GetAppData( SHL_SCH ))->GetResMgr()) +{ +} + diff --git a/soldep/source/soldep.cxx b/soldep/source/soldep.cxx new file mode 100644 index 000000000000..ce94afbbab92 --- /dev/null +++ b/soldep/source/soldep.cxx @@ -0,0 +1,1807 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +//TBD: ToolBox handling prjview/back + +#include <osl/file.hxx> +#include <rtl/ustring.hxx> +#include <tools/debug.hxx> +#include <bootstrp/sstring.hxx> +#include <svtools/filedlg.hxx> +#include <tools/iparser.hxx> +#include <tools/geninfo.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/bitmap.hxx> +#include <appdef.hxx> +#include "time.h" +#include <soldep/depper.hxx> +#include <soldep/soldep.hxx> +#include <soldep/soldlg.hxx> +#include "dtsodcmp.hrc" + +IMPLEMENT_HASHTABLE_OWNER( SolIdMapper, ByteString, ULONG* ); +//IMPLEMENT_HASHTABLE_OWNER( PrjIdMapper, ByteString, ULONG* ); +#define EVENT_RESIZE 0x00000001 +#define MIN(a,b) (a)<(b)?(a):(b) +#define MAX(a,b) (a)>(b)?(a):(b) + + +//ByteString sDelimiterLine("#=========================================================================="); + + +// +// class SolDep +// + +/*****************************************************************************/ +SolDep::SolDep( Window* pBaseWindow ) +/*****************************************************************************/ + : Depper( pBaseWindow ), + mbBServer(FALSE), + mpTravellerList( NULL ), + mbIsHide( FALSE ) +{ + mnSolWinCount = 0; + mnSolLastId = 0; +// mpPrjIdMapper = new SolIdMapper( 63997 ); + maTaskBarFrame.EnableAlwaysOnTop(); + maTaskBarFrame.Show(); + maToolBox.SetPosSizePixel( Point( 0,0 ), Size( 1100,35 )); + maToolBox.SetSelectHdl( LINK ( this, SolDep, ToolSelect )); + maToolBox.Show(); + + mpBaseWin->AddChildEventListener( LINK( this, SolDep, ChildWindowEventListener )); + + // Kontext-Menue (gehört zu soldep.cxx) + InitContextMenueMainWnd(); + InitContextMenuePrjViewWnd( mpBasePrjWin ); +} + +/*****************************************************************************/ +SolDep::~SolDep() +/*****************************************************************************/ +{ + mpBaseWin->RemoveChildEventListener( LINK( this, SolDep, ChildWindowEventListener ) ); + delete mpSolIdMapper; + delete mpStarWriter; + delete mpStandLst; +} + +/*****************************************************************************/ +void SolDep::Init() +/*****************************************************************************/ +{ + InformationParser aParser; + String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US ); + mpStandLst = aParser.Execute( sStandLst ); + ByteString aUpdater( getenv("UPDATER") ); + if ( mpStandLst && (aUpdater == "YES") ) { + if ( GetVersion() ) + ReadSource( TRUE ); + } else + { + ReadSource(); // if stand.lst isn't available + } +} + +/*****************************************************************************/ +void SolDep::Init( ByteString &rVersion, GenericInformationList *pVersionList ) +/*****************************************************************************/ +{ + // Interface for bs + mbBServer=TRUE; + if ( pVersionList ) + mpStandLst = new GenericInformationList( *pVersionList ); + else { + InformationParser aParser; + String sStandLst( GetDefStandList(), RTL_TEXTENCODING_ASCII_US ); + mpStandLst = aParser.Execute( sStandLst ); + } + if ( mpStandLst ) { + msVersionMajor = ByteString( rVersion ); + ReadSource(TRUE); //call from build server set UPDATER to TRUE + } +} + +/*****************************************************************************/ +IMPL_LINK( SolDep, ChildWindowEventListener, VclSimpleEvent*, pEvent ) +/*****************************************************************************/ +{ + if ( pEvent && pEvent->ISA( VclWindowEvent ) ) + { + ProcessChildWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) ); + } + return 0; +} + + +/*****************************************************************************/ +void SolDep::ProcessChildWindowEvent( const VclWindowEvent& _rVclWindowEvent ) +/*****************************************************************************/ +{ + Window* pChildWin = _rVclWindowEvent.GetWindow(); +// Window* pParentWin = pChildWin->GetParent(); +//Resize(); + if ( isAlive() ) + { + ULONG id = _rVclWindowEvent.GetId(); + switch ( id ) + { + case VCLEVENT_USER_MOUSEBUTTON_DOWN: + { + ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); + if( pObjWin ) + { + // handle mouse click on ObjectWin object + ObjectWin* pWin = (ObjectWin*) pChildWin; + //GetObjectList()->ResetSelectedObject(); + if (IsHideMode()) // simple mouse click left + { + pWin->CaptureMouse(); + pWin->SetMarkMode( MARKMODE_SELECTED ); + pWin->MarkNeeded(); + pWin->MarkDepending(); + pWin->Invalidate(); + } else + { + pWin->LoseFocus(); + pWin->SetMarkMode( MARKMODE_SELECTED ); + pWin->UnsetMarkMode( MARKMODE_ACTIVATED ); + pWin->MarkNeeded( TRUE ); + pWin->MarkDepending( TRUE ); + } + + } + } + break; + case VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT: + { + ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); + if( pObjWin ) + { + ObjectWin* pWin = (ObjectWin*) pChildWin; + MarkObjects( pWin ); + } + } + break; + case VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK: + { + ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); + if( pObjWin ) + { + if (IsHideMode()) ToggleHideDependency(); + ByteString text = ((ObjectWin*) pChildWin)->GetBodyText(); + ViewContent(text); + } + } + break; + case VCLEVENT_USER_MOUSEBUTTON_UP_SHFT: + { + ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); + if( pObjWin ) + { + ObjectWin* pWin = (ObjectWin*) pChildWin; + GetDepWin()->NewConnector( pWin ); + } + } + break; + case VCLEVENT_USER_MOUSEBUTTON_UP: + { + ObjectWin* pObjWin = dynamic_cast<ObjectWin*>(pChildWin); + if( pObjWin ) + { + ObjectWin* pWin = (ObjectWin*) pChildWin; + pWin->ReleaseMouse(); + pWin->SetMarkMode(MARKMODE_SELECTED); + GetDepWin()->Invalidate(); + } + } + break; + } // switch + } // if isAlive + //fprintf(stdout,"BLA::Resize: %d\n",pChildWin); +} + +/*****************************************************************************/ +IMPL_LINK( SolDep, ToolSelect, SoldepToolBox* , pBox) +/*****************************************************************************/ +{ + USHORT nItemId = pBox->GetCurItemId(); + switch ( nItemId ) + { + case TID_SOLDEP_FIND: + FindProject(); + break; + case TID_SOLDEP_CREATEMETA : + { + VirtualDevice aVDev; + aVDev.SetMapMode( MAP_100TH_MM ); + GDIMetaFile aMtf; + aVDev.EnableOutput( FALSE ); + aMtf.Record( &aVDev ); + + aVDev.SetLineColor( Color( COL_BLACK ) ); + aVDev.SetTextAlign( ALIGN_TOP ); + + Size aSize( GetDepWin()->GetOutputSizePixel() ); + long nXMin = aSize.Width(); + long nXMax = 0; + long nYMax = 0; + long nYMin = aSize.Height(); + + for ( USHORT i=0; i<mpObjectList->Count(); i++ ) + { + Point aPoint = mpObjectList->GetObject(i)->GetPosPixel(); + Size aSize = mpObjectList->GetObject(i)->GetSizePixel(); + nXMin = MIN( aPoint.X(), nXMin ); + nXMax = MAX( aPoint.X() + aSize.Width(), nXMax ); + nYMin = MIN( aPoint.Y(), nYMin ); + nYMax = MAX( aPoint.Y() + aSize.Height(), nYMax ); + } + + Point aOffset( nXMin, nYMin ); + aOffset = aVDev.PixelToLogic( aOffset ); + + GetDepWin()->DrawOutput( &aVDev, aOffset ); + for ( USHORT i=0; i<mpObjectList->Count(); i++ ) + if ( mpObjectList->GetObject(i)->IsVisible() ) + mpObjectList->GetObject(i)->DrawOutput( &aVDev, aOffset ); + + aMtf.Stop(); + aMtf.WindStart(); + aMtf.SetPrefMapMode( aVDev.GetMapMode() ); + Size aDevSize( nXMax-nXMin + 10, nYMax-nYMin + 10); + aDevSize = aVDev.PixelToLogic( aDevSize ); + aMtf.SetPrefSize( aDevSize ); + SvFileStream aStream( String::CreateFromAscii("d:\\out.svm"), STREAM_STD_READWRITE ); + aMtf.Write( aStream ); + break; + } + case TID_SOLDEP_HIDE_INDEPENDEND: + { + ToggleHideDependency(); + for ( USHORT i=0; i<mpObjectList->Count(); i++ ) + mpObjectList->GetObject(i)->SetViewMask(!mbIsHide); + + maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode()); + GetDepWin()->Invalidate(); //repaint Main-View + } + break; + case TID_SOLDEP_SELECT_WORKSPACE: + if (mpStandLst) + { + if (GetVersion()) // Version dialog box + { + delete mpSolIdMapper; + delete mpStarWriter; + mpObjectList->ClearAndDelete(); + ReadSource(TRUE); + } + } + break; + case TID_SOLDEP_BACK: + maToolBox.HideItem(TID_SOLDEP_BACK); + maToolBox.ShowItem(TID_SOLDEP_SELECT_WORKSPACE); //disabled for prj view (doubleclick ObjWin) + maToolBox.ShowItem(TID_SOLDEP_HIDE_INDEPENDEND); //disabled for prj view (doubleclick ObjWin) + maToolBox.ShowItem(TID_SOLDEP_FIND); //disabled for prj view (doubleclick ObjWin) + maToolBox.Resize(); + TogglePrjViewStatus(); + break; + } + return 0; +} + +/*****************************************************************************/ +void SolDep::ToggleHideDependency() +/*****************************************************************************/ +{ + mbIsHide = !mbIsHide; + maToolBox.CheckItem(TID_SOLDEP_HIDE_INDEPENDEND, IsHideMode()); + ObjectWin* pWin = GetObjectList()->GetObject( 0 ); + pWin->ToggleHideMode(); +}; + +/*****************************************************************************/ +BOOL SolDep::GetVersion() +/*****************************************************************************/ +{ + SolSelectVersionDlg aVersionDlg( GetDepWin(), mpStandLst ); + if ( aVersionDlg.Execute() == RET_OK ) { + msVersionMajor = aVersionDlg.GetVersionMajor(); + msVersionMinor = aVersionDlg.GetVersionMinor(); + return TRUE; + } + return FALSE; +} + +void SolDep::InitContextMenueMainWnd() +{ + InitContextMenuePrjViewWnd( mpBaseWin ); + return; // Disable not actually supported items + + mpBaseWin->mpPopup->InsertItem( DEPPOPUP_AUTOARRANGE, String::CreateFromAscii("Autoarrange")) ; + mpBaseWin->mpPopup->InsertSeparator(); + mpBaseWin->mpPopup->InsertItem( DEPPOPUP_READ_SOURCE, String::CreateFromAscii("Revert all changes") ); + mpBaseWin->mpPopup->InsertSeparator(); + mpBaseWin->mpPopup->InsertItem( DEPPOPUP_OPEN_SOURCE, String::CreateFromAscii("Open") ); + mpBaseWin->mpPopup->InsertItem( DEPPOPUP_WRITE_SOURCE, String::CreateFromAscii("Save") ); +} + +void SolDep::InitContextMenuePrjViewWnd(DepWin* pBaseWin ) +{ + // temp. disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_NEW, String::CreateFromAscii("New object") ); + pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMIN, String::CreateFromAscii("Zoom in") ); + pBaseWin->mpPopup->InsertItem( DEPPOPUP_ZOOMOUT, String::CreateFromAscii("Zoom out") ); + pBaseWin->mpPopup->InsertSeparator(); + // temp disabled pBaseWin->mpPopup->InsertItem( DEPPOPUP_CLEAR, String::CreateFromAscii("Clear") ); + pBaseWin->mpPopup->InsertItem( DEPPOPUP_SHOW_TOOLBOX, String::CreateFromAscii("Show Toolbox") ); +} + +/*****************************************************************************/ +ObjectWin *SolDep::RemoveObject( USHORT nId, BOOL bDelete ) +/*****************************************************************************/ +{ + Prj* pPrj; + +//hshtable auf stand halten + ObjectWin* pWin = RemoveObjectFromList( mpObjectList, mnSolWinCount, nId, FALSE ); + if ( pWin ) + { + ByteString aBodyText( pWin->GetBodyText() ); + if( (pPrj = mpStarWriter->GetPrj( aBodyText )) ) + { + mpStarWriter->Remove( pPrj ); +//cleanup ist teuer... + mpStarWriter->CleanUp(); + delete pPrj; + } + else + DBG_ASSERT( FALSE, "project not found - write" ); + + mpSolIdMapper->Delete( aBodyText ); + if ( bDelete ) + delete pWin; + return pWin; + } + else + return NULL; +} + +/*****************************************************************************/ +ULONG SolDep::AddObject( ByteString& rBodyText, BOOL bInteract ) +/*****************************************************************************/ +{ + ULONG nObjectId; + if ( bInteract ) + { + nObjectId = HandleNewPrjDialog( rBodyText ); + } + else + { +//hashtable auf stand halten + MyHashObject* pHObject; + nObjectId = AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, rBodyText, FALSE ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr(mpObjectList, nObjectId )); + mpSolIdMapper->Insert( rBodyText, pHObject ); + } + return nObjectId; +} + +/*****************************************************************************/ +ULONG SolDep::AddPrjObject( ByteString& rBodyText, BOOL bInteract ) +/*****************************************************************************/ +{ + ULONG nObjectId; + if ( bInteract ) + { + nObjectId = HandleNewDirectoryDialog( rBodyText ); + } + else + { +//hshtable auf stand halten + MyHashObject* pHObject; + nObjectId = AddObjectToList( mpBasePrjWin, mpObjectPrjList, mnPrjLastId, mnPrjWinCount, rBodyText ); + pHObject = new MyHashObject( nObjectId, ObjIdToPtr( mpObjectPrjList, nObjectId )); + mpPrjIdMapper->Insert( rBodyText, pHObject ); // mpPrjIdMapper + } + return nObjectId; +} + +/*****************************************************************************/ +USHORT SolDep::AddConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ) +/*****************************************************************************/ +{ +// DBG_ASSERT( FALSE , "not yet" ); + ByteString sEndName = pEndWin->GetBodyText(); + ByteString sStartName = pStartWin->GetBodyText(); + + Prj* pPrj = mpStarWriter->GetPrj( sEndName ); + if ( pPrj ) + { + pPrj->AddDependencies( sStartName ); + return AddConnectorToObjects( pStartWin, pEndWin ); + } + else + { + DBG_ASSERT( FALSE , "non existing Project" ); + return 1; + } +} + +/*****************************************************************************/ +USHORT SolDep::RemoveConnector( ObjectWin* pStartWin, ObjectWin* pEndWin ) +/*****************************************************************************/ +{ + SByteStringList* pPrjDeps = NULL; + ByteString sEndName = pEndWin->GetBodyText(); + ByteString sStartName = pStartWin->GetBodyText(); + + Prj* pPrj = mpStarWriter->GetPrj( sEndName ); + pPrjDeps = pPrj->GetDependencies( FALSE ); + if ( pPrjDeps ) + { + ByteString* pString; + ULONG nPrjDepsCount = pPrjDeps->Count(); + for ( ULONG j = nPrjDepsCount; j > 0; j-- ) + { + pString = pPrjDeps->GetObject( j - 1 ); + if ( pString->GetToken( 0, '.') == sStartName ) + pPrjDeps->Remove( pString ); + } + } + + return RemoveConnectorFromObjects( pStartWin, pEndWin ); +} + +/*****************************************************************************/ +void SolDep::RemoveAllObjects( ObjectList* pObjLst ) +/*****************************************************************************/ +{ + + Depper::RemoveAllObjects( pObjLst ); + + if ( mpSolIdMapper ) + { + delete mpSolIdMapper; + mpSolIdMapper = NULL; + } + if ( mpStarWriter ) + { + delete mpStarWriter; + mpStarWriter = NULL; + } +} + +/*****************************************************************************/ +ULONG SolDep::GetStart(SolIdMapper* pIdMapper, ObjectList* pObjList) +/*****************************************************************************/ +{ +// DBG_ASSERT( FALSE , "soldep" ); + MyHashObject* pHObject = pIdMapper->Find( "null" );//null_project + + if ( !pHObject ) { + ByteString sNullPrj = "null";//null_project + ULONG nObjectId = AddObject( sNullPrj, FALSE ); + ObjIdToPtr( pObjList, nObjectId )->SetViewMask( 1 ); + return nObjectId; + } + + return pHObject->GetId(); +} + +/*****************************************************************************/ +ULONG SolDep::GetStartPrj(SolIdMapper* , ObjectList* ) +/*****************************************************************************/ +{ +// DBG_ASSERT( FALSE , "prjdep" ); + MyHashObject* pHObject = mpPrjIdMapper->Find( ByteString( "null" ) ); //null_dir + if ( !pHObject ) + { + ByteString bsNull("null"); + ULONG nObjectId = AddPrjObject( bsNull, FALSE); //null_dir + return nObjectId; + } + else + return pHObject->GetId(); +} + +/*****************************************************************************/ +USHORT SolDep::OpenSource() +/*****************************************************************************/ +{ + if ( mpStandLst ) { + if ( GetVersion()) + return ReadSource(); + } + return 0; +} + +/*****************************************************************************/ +USHORT SolDep::ReadSource(BOOL bUpdater) +/*****************************************************************************/ +{ + mpBaseWin->EnablePaint( FALSE ); + mpBaseWin->Hide(); + ULONG nObjectId, nHashedId; + ULONG i; + MyHashObject* pHObject; + ByteString* pStr; + ObjectWin *pStartWin, *pEndWin; + + mpSolIdMapper = new SolIdMapper( 63997 ); + if (mpStandLst && bUpdater) + { + mpStarWriter = new StarWriter( mpStandLst, msVersionMajor, msVersionMinor, TRUE ); + } else + { + SolarFileList* pSolarFileList; + pSolarFileList = GetPrjListFromDir(); + mpStarWriter = new StarWriter( pSolarFileList, TRUE ); + } + ByteString sTitle( SOLDEPL_NAME ); + if ( mpStarWriter->GetMode() == STAR_MODE_SINGLE_PARSE ) { + sTitle += ByteString( " - mode: single file [" ); + sTitle += (ByteString) mpStarWriter->GetName(); + sTitle += ByteString( "]" ); + } + else if ( mpStarWriter->GetMode() == STAR_MODE_MULTIPLE_PARSE ) { + sTitle += ByteString( " - mode: multiple files [" ); + sTitle += ByteString( "]" ); + } + SetTitle( String( sTitle, RTL_TEXTENCODING_UTF8) ); + + ULONG nCount = mpStarWriter->Count(); + for ( i=0; i<nCount; i++ ) + { + Prj *pPrj = mpStarWriter->GetObject(i); + ByteString sPrjName = pPrj->GetProjectName(); + nObjectId = AddObject( sPrjName, FALSE ); + ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 1 ); + } + for ( i=0; i<nCount; i++ ) + { + Prj *pPrj = mpStarWriter->GetObject(i); + SByteStringList *pLst = pPrj->GetDependencies( FALSE ); + if ( pLst ) + { + ULONG nDepCount = pLst->Count(); + for ( ULONG m=0; m<nDepCount; m++) + { + pStr = pLst->GetObject(m); + pHObject = mpSolIdMapper->Find( *pStr ); + /*if ( !pHObject ) + { + // create new prj + Prj *pNewPrj = new Prj( *pStr ); + ByteString sPrjName = pNewPrj->GetProjectName(); + nObjectId = AddObject( sPrjName, FALSE ); + pHObject = mpSolIdMapper->Find( *pStr ); + ObjIdToPtr( mpObjectList, nObjectId )->SetViewMask( 2 ); + }*/ + + if ( pHObject ) + { + nHashedId = pHObject->GetId(); + ByteString sF_Os2 = pPrj->GetProjectName(); + pStr = &sF_Os2; + pHObject = mpSolIdMapper->Find( *pStr ); + nObjectId = pHObject->GetId(); + pStartWin = ObjIdToPtr( mpObjectList, nHashedId ); + pEndWin = ObjIdToPtr( mpObjectList, nObjectId ); + AddConnectorToObjects( pStartWin, pEndWin ); + } + } + } + } + if (!IsPrjView()) + { + AutoArrange( mpSolIdMapper, mpObjectList, GetStart(mpSolIdMapper,mpObjectList), 0, GetStart(mpSolIdMapper,mpObjectList) ); + GetDepWin()->EnablePaint( TRUE ); + } + return 0; +} + +SolarFileList* SolDep::GetPrjListFromDir() +{ + SolarFileList* pSolarFileList = new SolarFileList(); + String sPrjDir( String::CreateFromAscii( "prj" )); + String sBuildLst( String::CreateFromAscii( "build.lst" )); + DirEntry aCurrent( getenv( SOURCEROOT ) ); + + aCurrent.ToAbs(); + Dir aDir( aCurrent, FSYS_KIND_DIR ); + + USHORT nEntries = aDir.Count(); + if( nEntries ) + { + UniStringList aSortDirList; + for ( USHORT n = 0; n < nEntries; n++ ) + { + DirEntry& rEntry = aDir[n]; + UniString aName( rEntry.GetName() ); + if( aName.Len() && ( aName.GetChar(0) != '.' ) && rEntry.Exists() ) + { + rEntry += DirEntry( sPrjDir ); + rEntry += DirEntry( sBuildLst ); + if (rEntry.Exists()) + { + pSolarFileList->Insert( new String( rEntry.GetFull() ), LIST_APPEND ); + ByteString aName_dbg(rEntry.GetFull(),RTL_TEXTENCODING_UTF8); + fprintf(stdout, "bla:%s\n", aName_dbg.GetBuffer()); + } + } + } + } + if ( !pSolarFileList->Count() ) + { + //is empty!! TBD + delete pSolarFileList; + return NULL; + } + return pSolarFileList; +} + +/*****************************************************************************/ +USHORT SolDep::WriteSource() +/*****************************************************************************/ +{ +/* zur Sicherheit deaktiviert + USHORT nMode = mpStarWriter->GetMode(); + if ( nMode == STAR_MODE_SINGLE_PARSE ) { + ByteString sFileName = mpStarWriter->GetName(); + if ( sFileName.Len()) { + mpStarWriter->Write( String( sFileName, RTL_TEXTENCODING_UTF8) ); + mpStarWriter->RemoveProject( ByteString( "null")); //null_project + } + } + else if ( nMode == STAR_MODE_MULTIPLE_PARSE ) { + // *OBO* + //String sRoot = mpStarWriter->GetSourceRoot(); + //nicht mehr unterstützt mpStarWriter->GetSourceRoot() + ByteString sFileName = mpStarWriter->GetName(); + DirEntry aEntry( sFileName ); + aEntry.ToAbs(); + aEntry = aEntry.GetPath().GetPath().GetPath(); + String sRoot = aEntry.GetFull(); + + if ( sRoot.Len()) { + mpStarWriter->RemoveProject( ByteString( "null")); //null_project + mpStarWriter->WriteMultiple( sRoot ); + } + } +*/ + return 1; +} + +USHORT SolDep::Load( const ByteString& rFileName ) +{ +// moved from depper class + DBG_ASSERT( FALSE , "you are dead!" ); + SvFileStream aInFile( String( rFileName, RTL_TEXTENCODING_UTF8 ), STREAM_READ ); + depper_head dh; + ULONG i; + ULONG nLoadOffs = mnSolLastId; //or Prj?? + ObjectWin* pNewWin; + aInFile.Read( &dh, sizeof( dh )); + + ULONG nObjCount = dh.nObjectCount; + ULONG nCnctrCount = dh.nCnctrCount; + + for ( i=0; i < nObjCount ; i++ ) + { + ObjectWin* pWin = new ObjectWin( mpBaseWin, WB_BORDER ); + pWin->Load( aInFile ); + pNewWin = ObjIdToPtr( mpObjectList, AddObjectToList( mpBaseWin, mpObjectList, mnSolLastId, mnSolWinCount, pWin->GetBodyText(), FALSE )); + pNewWin->SetId( nLoadOffs + pWin->GetId()); + pNewWin->SetPosPixel( pWin->GetPosPixel()); + pNewWin->SetSizePixel( pWin->GetSizePixel()); + } + + ULONG nStartId; + ULONG nEndId; +// ueber addconnector fuehren! + for ( i=0; i < nCnctrCount ; i++ ) + { + Connector* pCon = new Connector( mpBaseWin, WB_NOBORDER ); + pCon->Load( aInFile ); + + nStartId = nLoadOffs + pCon->GetStartId(); + nEndId = nLoadOffs + pCon->GetEndId(); + + ObjectWin* pStartWin = ObjIdToPtr( mpObjectList, nStartId ); + ObjectWin* pEndWin = ObjIdToPtr( mpObjectList, nEndId ); + + pCon->Initialize( pStartWin, pEndWin ); + } + + + return 0; +} + +/*****************************************************************************/ +BOOL SolDep::ViewContent( ByteString& rObjectName ) +/*****************************************************************************/ +{ + mpFocusWin = NULL; + SetPrjViewStatus(TRUE); + + for ( ULONG i = 0; i < mpObjectList->Count() && !mpFocusWin; i++ ) + if ( mpObjectList->GetObject( i )->HasFocus()) + mpFocusWin = mpObjectList->GetObject( i ); + //HideObjectsAndConnections( mpObjectList ); + mpProcessWin->Resize(); + GetDepWin()->Show(); + return InitPrj( rObjectName ); +} + +/*****************************************************************************/ +BOOL SolDep::InitPrj( ByteString& rListName ) +/*****************************************************************************/ +{ + ULONG nObjectId, nHashedId; + ULONG i, j; + MyHashObject* pHObject; + ByteString *pDepName; + ByteString *pFlagName; + Prj* pPrj; + ObjectWin *pStartWin, *pEndWin; + maToolBox.HideItem(TID_SOLDEP_SELECT_WORKSPACE); + maToolBox.HideItem(TID_SOLDEP_HIDE_INDEPENDEND); + maToolBox.HideItem(TID_SOLDEP_FIND); + maToolBox.ShowItem(TID_SOLDEP_BACK); + maToolBox.Invalidate(); + + //clean up + mpObjectPrjList->ClearAndDelete(); + GetDepWin()->ClearConnectorList(); + if (mpPrjIdMapper) delete mpPrjIdMapper; + mpPrjIdMapper = new SolIdMapper( 63997 ); //generate clean mapper + mnPrjWinCount = 0; + mnPrjLastId = 0; + + ULONG nCount = mpStarWriter->Count(); + GetDepWin()->EnablePaint( FALSE ); + Point aPnt = GetGraphWin()->GetPosPixel(); + Size aSize = GetGraphWin()->GetSizePixel(); + + GetGraphWin()->SetPosSizePixel( aPnt, aSize ); // Hier wird das Window gesetzt + + BOOL bReturn = FALSE; + + for ( i=0; i<nCount; i++ ) + { +// pPrj->GetProjectName() returns the name of +// the project e.g. svtools + pPrj = mpStarWriter->GetObject(i); + ByteString sPrjName = pPrj->GetProjectName(); + if ( sPrjName == rListName ) + { + bReturn = TRUE; + + mpPrj = mpStarWriter->GetObject(i); + ULONG nDirCount = mpPrj->Count(); + for ( j=0; j<nDirCount; j++ ) + { + CommandData *pData = mpPrj->GetObject(j); + fprintf( stdout, "\tProjectDir : %s\n", + pData->GetLogFile().GetBuffer()); +// pData->GetLogFile() contains internal project IDs +// e.g. st_mkout etc. + if ( pData->GetLogFile() != "" ) + { + ByteString sItem = pData->GetLogFile(); + nObjectId = AddPrjObject( sItem, FALSE); +// there may be faster ways...... + ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); + pWin->SetViewMask( 0x0001 ); +// pData->GetPath() contains internal project directories +// e.g. svtools/inc etc. + ByteString sPath = pData->GetPath(); + pWin->SetTipText( sPath ); + } + } + +// set connectors for dependencies here + for ( j=0; j<nDirCount; j++ ) + { + CommandData *pData = mpPrj->GetObject(j); + SByteStringList *pDeps = pData->GetDependencies(); + if ( pDeps ) + { + ByteString sFlagName = pData->GetLogFile(); + pFlagName = &sFlagName; + //pHObject = mpPrjIdMapper->Find( (*pFlagName).GetToken( 0, '.'));//mpSolIdMapper see ReadSource() + pHObject = mpPrjIdMapper->Find( sFlagName.GetToken( 0, '.')); + if (pHObject) + { + + nObjectId = pHObject->GetId(); + + ULONG nDepCount = pDeps->Count(); + for ( ULONG k=0; k<nDepCount; k++ ) + { + pDepName = pDeps->GetObject(k); + pHObject = mpPrjIdMapper->Find( (*pDepName).GetToken( 0, '.')); + if (pHObject ) + { + nHashedId = pHObject->GetId(); + pStartWin = ObjIdToPtr( mpObjectPrjList, nHashedId ); + pEndWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); + + AddConnectorToObjects( pStartWin, pEndWin ); + } + else + { + String sMessage; + sMessage += String::CreateFromAscii("can't find "); + sMessage += String( *pDepName, RTL_TEXTENCODING_UTF8 ); + sMessage += String::CreateFromAscii(".\ndependency ignored"); + WarningBox aBox( GetDepWin(), WB_OK, sMessage); + aBox.Execute(); + } + } + } + } + + } + + break; + } + } + ByteString sNullDir = "null"; + nObjectId = AddPrjObject( sNullDir, FALSE); + ObjectWin *pWin = ObjIdToPtr( mpObjectPrjList, nObjectId ); + pWin->SetViewMask( 0x0001 ); + mpGraphPrjWin->EnablePaint( TRUE ); + //debug +// int test_l = GetStartPrj(mpPrjIdMapper, mpObjectPrjList); +// ObjectWin *pTestWin = ObjIdToPtr( mpObjectPrjList, test_l ); + AutoArrange( mpPrjIdMapper, mpObjectPrjList, GetStartPrj(mpPrjIdMapper, mpObjectPrjList), 0, GetStartPrj(mpPrjIdMapper, mpObjectPrjList) ); + mpGraphWin->Hide(); + mpGraphPrjWin->Show(); + mpGraphPrjWin->Invalidate(); + + return bReturn; +} + +/*****************************************************************************/ +USHORT SolDep::CloseWindow() +/*****************************************************************************/ +{ + + ((SystemWindow*)mpProcessWin)->Close(); + return 0; +} + +/*****************************************************************************/ +void SolDep::ShowHelp() +/*****************************************************************************/ +{ + SvFileStream aHelpFile( String::CreateFromAscii( "g:\\soldep.hlp" ), STREAM_READ ); + String aHelpText; + ByteString aGetStr; + + if ( aHelpFile.IsOpen() ) + { + while ( aHelpFile.ReadLine( aGetStr ) ) + { + aHelpText += String (aGetStr, RTL_TEXTENCODING_UTF8); + aHelpText += String::CreateFromAscii("\n"); + } + } + else + aHelpText = String::CreateFromAscii("No Helpfile found."); + + SolHelpDlg aHelpDlg( mpBaseWin, DtSodResId( RID_SD_DIALOG_HELP )); + aHelpDlg.maMLEHelp.SetText( aHelpText ); + aHelpDlg.maMLEHelp.SetReadOnly(); + aHelpDlg.maMLEHelp.EnableFocusSelectionHide( TRUE ); + aHelpDlg.Execute(); +} + +/*****************************************************************************/ +BOOL SolDep::FindProject() +/*****************************************************************************/ +{ + SolFindProjectDlg aFindProjectDlg( GetDepWin(), GetObjectList() ); + ObjectWin* pObjectWin = NULL; + mpObjectList->ResetSelectedObject(); + if (IsHideMode()) + { + GetDepWin()->Invalidate(); + } + + mpFocusWin=NULL; + + if ( aFindProjectDlg.Execute() == RET_OK ) { + msProject = aFindProjectDlg.GetProject(); + //now we have a project string + + pObjectWin = mpObjectList->GetPtrByName( msProject ); + if (pObjectWin) + { + mpObjectList->ResetSelectedObject(); + MarkObjects( pObjectWin ); + } + else + { + mpObjectList->ResetSelectedObject(); + for ( USHORT i=0; i<mpObjectList->Count(); i++ ) + { + ObjectWin* pObjectWin = mpObjectList->GetObject( i ); + if ( !pObjectWin->IsTop() ) + pObjectWin->SetViewMask(FALSE); + } + } + } + return FALSE; +} + +BOOL SolDep::MarkObjects( ObjectWin* pObjectWin ) +{ + if (pObjectWin) + { + if (!(pObjectWin->IsNullObject())) + { + pObjectWin->SetMarkMode( MARKMODE_SELECTED ); + pObjectWin->MarkNeeded(); + pObjectWin->MarkDepending(); + if (IsHideMode()) + { + GetDepWin()->Invalidate(); + } + } else + { + fprintf(stdout,"null\n"); + } + } + return TRUE; +} + +void SolDep::Resize() +{ +//funzt! muß aber von der applikation aufgerufen werden. + Point aOutPos = Point( 0, 0 ); + Size aOutSize = mpProcessWin->GetOutputSizePixel(); + // calculate output size + ULONG nTaskHeight = maToolBox.CalcWindowSizePixel().Height(); + ULONG nTaskWidth = maToolBox.CalcWindowSizePixel().Width(); + Size aSize( aOutSize.Width(), nTaskHeight ); + +// ULONG nMenuHeight = 0; + Point aGraphWinPos = Point(0,0); + Size aGraphWinSize = Size(0,0); + +//weiß nicht wie: nMenuHeight = aMenuBar.GetWindow()->GetSizePixel().Height(); //Höhe des Menues + + //aInRect = pTBManager->Resize( Rectangle( aOutPos, aOutSize ); + // Set Docking-Rectangle for ToolBar + Rectangle aInRect; + + if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_TOP )) + { + // waagerechte Toolbar oben + maToolBox.SetPosSizePixel( aOutPos, Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height())); + if( maToolBox.IsVisible()) + { + Point aOutPosTmp; + Size aOutSizeTmp; + aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height()); + aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); + aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); + aGraphWinPos = Point( 0, nTaskHeight ); + aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight); + } + } + if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_BOTTOM )) + { + // waagerechte Toolbar unten + Point aTbPos = Point( aOutPos.X(), aOutPos.Y() + aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); + Size aTbSize = Size( aOutSize.Width(), maToolBox.CalcWindowSizePixel().Height()); + maToolBox.SetPosSizePixel( aTbPos, aTbSize ); + if( maToolBox.IsVisible()) + { + Point aOutPosTmp; + Size aOutSizeTmp; + aOutPosTmp = Point( aOutPos.X(), aOutPos.Y() + maToolBox.CalcWindowSizePixel().Height()); + aOutSizeTmp = Size( aOutSize.Width(), aOutSize.Height() - maToolBox.CalcWindowSizePixel().Height()); + aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); + aGraphWinPos = Point( 0, 0 ); + aGraphWinSize = Size( aOutSize.Width(), aOutSize.Height() - nTaskHeight); + } + } + if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_LEFT )) + { + // senkrechte ToolBar links + maToolBox.SetPosSizePixel( aOutPos, Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height())); + if( maToolBox.IsVisible()) + { + Point aOutPosTmp; + Size aOutSizeTmp; + aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); + aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); + aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); + aGraphWinPos = Point( nTaskWidth, 0 ); + aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height()); + } + } + if (( !maToolBox.IsFloatingMode() ) && ( maToolBox.GetAlign() == WINDOWALIGN_RIGHT )) + { + // senkrechte ToolBar rechts + Point aTbPos = Point( aOutPos.X() + aOutSize.Width() - maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); + Size aTbSize= Size( maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); + maToolBox.SetPosSizePixel( aTbPos, aTbSize); + if( maToolBox.IsVisible()) + { + Point aOutPosTmp; + Size aOutSizeTmp; + aOutPosTmp = Point( aOutPos.X() + maToolBox.CalcWindowSizePixel().Width(), aOutPos.Y()); + aOutSizeTmp = Size( aOutSize.Width()- maToolBox.CalcWindowSizePixel().Width(), aOutSize.Height()); + aInRect = Rectangle( aOutPosTmp, aOutSizeTmp ); + aGraphWinPos = Point( 0, 0 ); + aGraphWinSize = Size( aOutSize.Width() - nTaskWidth, aOutSize.Height()); + } + } + + Rectangle rout = Rectangle( Point( 0,0 ), aOutSize ); //OutputToScreenPixel( aOutPos ) + Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top()) + Size( aOutSize.Width(), aOutSize.Height())); +/* + Rectangle rout = mpProcessWin->OutputToScreenPixel( aOutPos ); + Rectangle rin = Rectangle( Point( 0,0 ),//OutputToScreenPixel( Point( aOutPos.X() - 20, aInRect.Top()) + Size( aOutSize.Width(), aOutSize.Height())); +*/ + maToolBox.SetDockingRects( rout, rin ); + + BOOL bFloating = maToolBox.IsFloatingMode(); + + if ( bFloating ) + { + GetGraphWin()->SetPosSizePixel(Point(0,0),aOutSize); + //if (IsPrjView() && (mpPrjDep)) mpPrjDep->Resize(); + if (maToolBox.IsVisible()) maToolBox.Show(); + } else + { + GetGraphWin()->SetPosSizePixel( aGraphWinPos, aGraphWinSize ); + } + if (maToolBox.IsVisible()) maToolBox.Show(); +} + +USHORT SolDep::AddConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ +// DBG_ASSERT( FALSE , "not yet" ); + ByteString sEndName = pEndWin->GetBodyText(); + ByteString sStartName = pStartWin->GetBodyText(); + if ( sStartName != ByteString("null")) + { + CommandData* pEndData = mpPrj->GetDirectoryData( sEndName ); + SByteStringList* pDeps = pEndData->GetDependencies(); + if ( pDeps ) + pDeps->PutString( &sStartName ); + else + { + pDeps = new SByteStringList(); + pEndData->SetDependencies( pDeps ); + pDeps->PutString( &sStartName ); + pEndData->GetDependencies(); + } + } + return AddConnectorToObjects( pStartWin, pEndWin ); +} + +USHORT SolDep::RemoveConnectorPrjView( ObjectWin* pStartWin, ObjectWin* pEndWin ) +{ + ByteString sEndName = pEndWin->GetBodyText(); + ByteString sStartName = pStartWin->GetBodyText(); + CommandData* pEndData = mpPrj->GetDirectoryData( sEndName ); + SByteStringList* pDeps = pEndData->GetDependencies(); + if ( pDeps ) + { + ByteString* pString; + ULONG nDepsCount = pDeps->Count(); + for ( ULONG j = nDepsCount; j > 0; j-- ) + { + pString = pDeps->GetObject( j - 1 ); + if ( pString->GetToken( 0, '.') == sStartName ) + pDeps->Remove( pString ); + } + } + return RemoveConnectorFromObjects( pStartWin, pEndWin ); +} + +USHORT SolDep::AutoArrange( SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID ) +{ + AutoArrangeDlgStart(); + OptimizePos(pIdMapper, pObjLst, nTopId, nBottmId, aObjID ); + AutoArrangeDlgStop(); + return 0; +} + +Point SolDep::CalcPos( USHORT nSet, USHORT nIndex ) +{ + int nRowIndex = nIndex / DEPPER_MAX_WIDTH; + ULONG nPosX = mnXOffset + nRowIndex % 3 * GetDefSize().Width() / 3 + ( nIndex - ( DEPPER_MAX_WIDTH * nRowIndex )) * (GetDefSize().Width() + OBJWIN_X_SPACING ); + + ULONG nPosY = ( nSet + mnLevelOffset + nRowIndex ) * ( GetDefSize().Height() + OBJWIN_Y_SPACING ) + OBJWIN_Y_SPACING; + Point aPos( nPosX, nPosY ); + return aPos; +} + +ULONG SolDep::CalcXOffset( ULONG nObjectsToFit ) +{ + long nDynXOffs; + long nXMiddle; + ULONG nTrigger; + + nXMiddle = GetDepWin()->PixelToLogic( GetDepWin()->GetSizePixel()).Width() / 2; + if ( nObjectsToFit > DEPPER_MAX_WIDTH ) + nObjectsToFit = DEPPER_MAX_WIDTH - 1 + DEPPER_MAX_WIDTH % 2; + nTrigger = ( nObjectsToFit - 1 ) / 2; + nDynXOffs = ( GetDefSize().Width() + OBJWIN_X_SPACING ) * nTrigger; + ULONG nXOffs = nXMiddle - nDynXOffs; + + if ( ULONG(nXMiddle - nDynXOffs) < mnMinDynXOffs ) + mnMinDynXOffs = nXMiddle - nDynXOffs; + + return nXOffs; + +} + +double SolDep::CalcDistSum( ObjWinList* pObjList, DistType eDistType ) +{ + ObjectWin* pWin; + Connector* pCon; + ULONG nObjCount = pObjList->Count(); + double dRetVal = 0; + double dWinVal; + USHORT i, j; + BOOL bIsStart; + + for ( i = 0; i < nObjCount; i++ ) + { + pWin = pObjList->GetObject( i ); + + if ( pWin && pWin->IsVisible()) + { + j = 0; + dWinVal = 0; + while ( (pCon = pWin->GetConnector( j )) ) + { + if ( pCon->IsVisible()) { + bIsStart = pCon->IsStart( pWin ); + if ( eDistType != BOTH ) + if ( eDistType == TOPDOWN ) + { + if ( bIsStart ) + { + pCon->UpdatePosition( pWin, FALSE ); + dWinVal += pCon->GetLen() * pWin->mnHeadDist; + } + } + else + { + if ( !bIsStart ) + { + pCon->UpdatePosition( pWin, FALSE ); + dWinVal += pCon->GetLen() * pWin->mnRootDist; + } + + } + else + { + pCon->UpdatePosition( pWin, FALSE ); + if ( !bIsStart ) + dWinVal += pCon->GetLen() * ( pWin->mnHeadDist + 1 ); + else + dWinVal += pCon->GetLen() * pWin->mnRootDist; + } + } + j++; + } +// if ( j != 0 ) +// dWinVal /= j; + dRetVal += dWinVal; + } + } + + return dRetVal; +} + +USHORT SolDep::Impl_Traveller( ObjectWin* pWin, USHORT nDepth ) +{ + USHORT i = 0; + ObjectWin* pNewWin; + Connector* pCon; + + nDepth++; + + USHORT nMaxDepth = nDepth; + + pWin->mbVisited = TRUE; + pWin->mnRootDist = Max ( nDepth, pWin-> mnRootDist ); + if ( nDepth > DEPPER_MAX_DEPTH ) + { + DBG_ASSERT( nDepth != DEPPER_MAX_DEPTH + 1, "Ringabhängigkeit!" ); + nDepth++; + return DEP_ENDLES_RECURSION_FOUND; + } + + while ( (pCon = pWin->GetConnector( i )) ) + { + if ( pCon->IsStart( pWin )&& pCon->IsVisible() ) //removed: don't show null_project + { + pNewWin = pCon->GetOtherWin( pWin ); + nMaxDepth = Max( Impl_Traveller( pNewWin, nDepth ), nMaxDepth ); + if( nMaxDepth == DEP_ENDLES_RECURSION_FOUND ) + { + mpTravellerList->Insert( pWin, LIST_APPEND ); + return DEP_ENDLES_RECURSION_FOUND; + } + } + i++; + } + pWin->mnHeadDist = MAX( pWin->mnHeadDist, nMaxDepth - nDepth ); + return nMaxDepth; +} + + +double SolDep::Impl_PermuteMin( ObjWinList& rObjList, Point* pPosArray, ObjWinList& rResultList, double dMinDist, ULONG nStart, ULONG nSize, DistType eDistType ) +{ + + ULONG i, j, l; + ULONG nEnd = nStart + nSize; + ObjectWin* pSwapWin; + ULONG nLevelObjCount = rObjList.Count(); + +//dont use full recusion for more than 6 objects + if ( nLevelObjCount > 6 ) + { + srand(( unsigned ) time( NULL )); + + ULONG nIdx1, nIdx2; + for ( i = 0; i < 101; i++ ) + { + UpdateSubProgrssBar(i); + for ( j = 0; j < 100; j++ ) + { + nIdx1 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount ); + while ( rObjList.GetObject( nIdx1 ) == NULL ) + nIdx1 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount ); + nIdx2 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount ); + while ( nIdx1 == nIdx2 || nIdx2 == nLevelObjCount ) + nIdx2 = (ULONG) ( double( rand() ) / RAND_MAX * nLevelObjCount ); + + pSwapWin = rObjList.GetObject( nIdx1 ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] ); + pSwapWin = rObjList.Replace( pSwapWin, nIdx2 ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] ); + rObjList.Replace( pSwapWin, nIdx1 ); + + double dCurDist = CalcDistSum( &rObjList, eDistType ); + + if ( dCurDist < dMinDist ) + { + dMinDist = dCurDist; + rResultList.Clear(); + for ( l = 0; l < nLevelObjCount; l++ ) + { + pSwapWin = rObjList.GetObject( l ); + rResultList.Insert( pSwapWin, LIST_APPEND); + } + } +// if ( dCurDist > dMinDist * 1.5 ) + if ( dCurDist > dMinDist * 15 ) + { + pSwapWin = rObjList.GetObject( nIdx1 ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( pPosArray[ nIdx2 ] ); + pSwapWin = rObjList.Replace( pSwapWin, nIdx2 ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( pPosArray[ nIdx1 ] ); + rObjList.Replace( pSwapWin, nIdx1 ); + } + } + } + } + else + { + for ( i = nStart ; i < nEnd; i++) + { + if ( nSize > 1 ) + { + pSwapWin = rObjList.GetObject( i ); + pSwapWin = rObjList.Replace( pSwapWin, nStart ); + rObjList.Replace( pSwapWin, i ); + double dPermuteDist = Impl_PermuteMin( rObjList, pPosArray, rResultList, dMinDist, nStart + 1, nSize - 1, eDistType ); + dMinDist = MIN( dMinDist, dPermuteDist); + pSwapWin = rObjList.GetObject( i ); + pSwapWin = rObjList.Replace( pSwapWin, nStart ); + rObjList.Replace( pSwapWin, i ); + + } + else + { + for ( l = 0; l < nLevelObjCount; l++ ) + { + pSwapWin = rObjList.GetObject( l ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( pPosArray[ l ] ); + } + + double dCurDist = CalcDistSum( &rObjList, eDistType ); + + if ( dCurDist < dMinDist ) + { + dMinDist = dCurDist; + rResultList.Clear(); + for ( l = 0; l < nLevelObjCount; l++ ) + { + pSwapWin = rObjList.GetObject( l ); + rResultList.Insert( pSwapWin, LIST_APPEND); + } + } + + } + } + } + + return dMinDist; +} + + +USHORT SolDep::OptimizePos(SolIdMapper* pIdMapper, ObjectList* pObjLst, ULONG nTopId, ULONG nBottmId, ULONG aObjID ) +{ + ObjWinList aWorkList; + ObjectWin* pWin; + Connector* pCon; + USHORT nRootDist = (USHORT) -1; + USHORT i, j, k, l, nRetVal; + USHORT LevelUse[ DEPPER_MAX_DEPTH ]; + USHORT LevelSecUse[ DEPPER_MAX_DEPTH ]; + ObjWinList* LevelList[ DEPPER_MAX_DEPTH ]; + ObjWinList* LevelSecList[ DEPPER_MAX_DEPTH ]; + Point aPosArray[ DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ]; + + mnMinDynXOffs = 0xffff; + + for ( i = 0; i < DEPPER_MAX_DEPTH; i++ ) + { + LevelUse[ i ] = 0; + LevelList[ i ] = NULL; + LevelSecUse[ i ] = 0; + LevelSecList[ i ] = NULL; + } + + GetDepWin()->EnablePaint( FALSE ); + + ULONG nObjCount = pObjLst->Count(); + for ( i = 0; i < nObjCount; i++ ) + { + pWin = pObjLst->GetObject( i ); + if ( pWin->IsVisible()) { + pWin->mbVisited = FALSE; + pWin->mnHeadDist = 0; + pWin->mnRootDist = 0; + + // find initial objects which need to be connected with + // root object + j = 0; + USHORT nStartCount = 0; + USHORT nEndCount = 0; + while ( (pCon = pWin->GetConnector( j )) ) + { + if ( pCon->IsVisible()) { //null_project + if( pCon->IsStart( pWin )) + nStartCount++; + else + { + nEndCount = 1; + break; + } + } + j++; + } + + if ( nStartCount > 0 && nEndCount == 0 ) + if ( nTopId != pWin->GetId()) + AddConnectorToObjects( pObjLst, nTopId, pWin->GetId()); + + } + } + + pWin = ObjIdToPtr( pObjLst, nTopId ); + + if ( mpTravellerList ) + { + mpTravellerList->Clear(); + delete mpTravellerList; + } + mpTravellerList = new ObjWinList(); + // set root and top distance + nRetVal = Impl_Traveller( pWin, nRootDist ); + + DBG_ASSERT( nRetVal < DEPPER_MAX_DEPTH , "zu tief" ); + if ( nRetVal == DEP_ENDLES_RECURSION_FOUND ) + { + WriteToErrorFile(); + return nRetVal; + } + + ULONG nUnvisited = 0; + ULONG nUnvisYOffs = 0; + + // seperate mainstream, secondary and unconnected + for ( i = 0; i < nObjCount; i++ ) + { + pWin = pObjLst->GetObject( i ); + if ( pWin->IsVisible()) { + if (( pWin->mnHeadDist + pWin->mnRootDist ) == nRetVal ) + { + if ( !LevelList[ pWin->mnHeadDist ] ) + LevelList[ pWin->mnHeadDist ] = new ObjWinList; + LevelList[ pWin->mnHeadDist ]->Insert( pWin ); + LevelUse[ pWin->mnHeadDist ]++; + } + else + if ( pWin->mbVisited ) + { + if ( !LevelSecList[ nRetVal - pWin->mnRootDist ] ) + LevelSecList[ nRetVal - pWin->mnRootDist ] = new ObjWinList; + LevelSecList[ nRetVal - pWin->mnRootDist ]->Insert( pWin ); + LevelSecUse[ nRetVal - pWin->mnRootDist ]++; + } + else + { + // need to be arranged more intelligent... + Point aPos( 5, nUnvisYOffs ); + pWin->SetCalcPosPixel( aPos ); + + Point aTmpPos = pWin->GetCalcPosPixel(); + pWin->SetPosPixel( mpBaseWin->LogicToPixel( aTmpPos )); + + nUnvisYOffs += pWin->PixelToLogic( pWin->GetSizePixel()).Height(); + nUnvisited++; + } + } + } + + mnLevelOffset = 0; + + USHORT nScaleVal; + + if ( nRetVal == 0 ) + nScaleVal = 1; + else + nScaleVal = nRetVal; + + i = 0; + + USHORT nStep = 0; + + while ( LevelList[ i ] ) + { + UpdateMainProgressBar(i, nScaleVal, nStep); + DBG_ASSERT( LevelUse[ i ] == LevelList[ i ]->Count() , "level index im a..." ); + ObjectWin* pSwapWin; + ULONG nLevelObjCount = LevelList[ i ]->Count(); + + if ( nLevelObjCount % 2 == 0 ) + { + LevelList[ i ]->Insert( NULL, LIST_APPEND ); + nLevelObjCount++; +// LevelUse bleibt orginal... +// LevelUse[ i ]++; + } + +// catch too big lists + DBG_ASSERT( nLevelObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" ); + if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ) + { + WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking")); + aWBox.Execute(); + break; + } + mnXOffset = CalcXOffset( nLevelObjCount ); + aWorkList.Clear(); + + // initial positioning for mainstream + for ( j = 0; j < nLevelObjCount; j++ ) + { + pSwapWin = LevelList[ i ]->GetObject( j ); + aWorkList.Insert( pSwapWin, LIST_APPEND); + Point aPos = CalcPos( i, j ); + aPosArray[ j ] = aPos; + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + + double dMinDist = CalcDistSum( LevelList[ i ] ); + + // optimize mainstream order and return best matching list in "aWorkList" + dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount )); + + // set optimized positions - may still be wrong from later tries + for ( j = 0; j < nLevelObjCount; j++ ) + { + pSwapWin = aWorkList.GetObject( j ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + + if ( LevelSecList[ i ] != NULL ) + { + ULONG nLevelSecObjCount = LevelSecList[ i ]->Count(); + // expand list for better positioning + while ( nLevelSecObjCount + LevelUse[ i ] < DEPPER_MAX_WIDTH - 1 ) + { + LevelSecList[ i ]->Insert( NULL, LIST_APPEND ); + nLevelSecObjCount++; + } + if ( ( nLevelSecObjCount + LevelUse[ i ])% 2 == 0 ) + { + LevelSecList[ i ]->Insert( NULL, LIST_APPEND ); + nLevelSecObjCount++; + } + + DBG_ASSERT( nLevelSecObjCount < DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH , "graph zu breit! dat geiht nich gut. breaking" ); + if ( nLevelObjCount >= DEPPER_MAX_LEVEL_WIDTH * DEPPER_MAX_WIDTH ) + { + WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph zu breit! dat geiht nich gut. breaking")); + aWBox.Execute(); + break; + } + mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount ); + aWorkList.Clear(); + + l = 0; + BOOL bUsedPos; + + // find free positions for secondary objects + for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ ) + { + Point aPos = CalcPos( i, j ); + bUsedPos = FALSE; + // is already occupied? + for ( k = 0; k < nLevelObjCount; k++ ) + { + if ( LevelList[ i ]->GetObject( k ) ) + if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() ) + bUsedPos = TRUE; + } + // if its free, add to pool + if ( !bUsedPos ) + { + aPosArray[ l ] = aPos; + l++; + } + } + + // initial positioning for secodaries + for ( j = 0 ; j < nLevelSecObjCount ; j++ ) + { + pSwapWin = LevelSecList[ i ]->GetObject( j ); + aWorkList.Insert( pSwapWin, LIST_APPEND); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + dMinDist = CalcDistSum( LevelSecList[ i ] ); + + dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount )); + + // set optimized positions - may still be wrong from later tries + for ( j = 0; j < nLevelSecObjCount; j++ ) + { + pSwapWin = aWorkList.GetObject( j ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) + mnLevelOffset++; + } + if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) + mnLevelOffset+= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ; + i++; + } + + mnMinDynXOffs = 0xffff; + +// and back again... + // get better results form already preoptimized upper and lower rows + + do + { + i--; + UpdateMainProgressBar(i, nScaleVal, nStep, TRUE); // TRUE ~ counting down + if ( LevelUse[ i ] + LevelSecUse[ i ] > DEPPER_MAX_WIDTH ) + mnLevelOffset-= ( LevelUse[ i ] + LevelSecUse[ i ] ) / DEPPER_MAX_WIDTH ; + ObjectWin* pSwapWin; + ULONG nLevelObjCount = LevelList[ i ]->Count(); + mnXOffset = CalcXOffset( nLevelObjCount ); + aWorkList.Clear(); + + for ( j = 0; j < nLevelObjCount; j++ ) + { + pSwapWin = LevelList[ i ]->GetObject( j ); + aWorkList.Insert( pSwapWin, LIST_APPEND); + Point aPos = CalcPos( i, j ); + aPosArray[ j ] = aPos; +//no need to do this stuff....... ????? + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + + double dMinDist = CalcDistSum( LevelList[ i ], BOTH ); + + dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelObjCount, BOTH )); +// wrong position for remaping - keep old positions for comparing + for ( j = 0; j < nLevelObjCount; j++ ) + { + pSwapWin = aWorkList.GetObject( j ); + if ( pSwapWin ) +// pSwapWin->SetCalcPosPixel( mpBaseWin->LogicToPixel( aPosArray[ j ] )); + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + + if ( LevelSecList[ i ] != NULL ) + { + ULONG nLevelSecObjCount = LevelSecList[ i ]->Count(); + mnXOffset = CalcXOffset( LevelUse[ i ] + nLevelSecObjCount ); + aWorkList.Clear(); + + l = 0; + BOOL bUsedPos; + + for ( j = 0; j < ( LevelUse[ i ] + nLevelSecObjCount ) ; j++ ) + { + Point aPos = CalcPos( i, j ); + bUsedPos = FALSE; +// could be faster + for ( k = 0; k < nLevelObjCount; k++ ) + { + if ( LevelList[ i ]->GetObject( k ) ) + if ( aPos == LevelList[ i ]->GetObject( k )->GetCalcPosPixel() ) + bUsedPos = TRUE; + } + if ( !bUsedPos ) + { + aPosArray[ l ] = aPos; + l++; + } + } + + for ( j = 0 ; j < nLevelSecObjCount ; j++ ) + { + pSwapWin = LevelSecList[ i ]->GetObject( j ); + aWorkList.Insert( pSwapWin, LIST_APPEND); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + dMinDist = CalcDistSum( LevelSecList[ i ], BOTH ); + + dMinDist = MIN( dMinDist, Impl_PermuteMin( *(LevelSecList[ i ]), aPosArray, aWorkList, dMinDist, 0, nLevelSecObjCount, BOTH )); +// wrong position for remaping - keep old positions for comparing + for ( j = 0; j < nLevelSecObjCount; j++ ) + { + pSwapWin = aWorkList.GetObject( j ); + if ( pSwapWin ) + pSwapWin->SetCalcPosPixel( aPosArray[ j ] ); + } + } +// i--; + } while ( i != 0 ); + SetMainProgressBar( 100 ); + + ULONG nNewXSize = ( DEPPER_MAX_WIDTH + 1 ) * ( OBJWIN_X_SPACING + GetDefSize().Width() ); + + // ULONG aObjID = GetStart(pIdMapper, pObjLst) //hier muß man switchen GetStart/GetPrjStart oder so + + ObjectWin* pObjWin = ObjIdToPtr( pObjLst, aObjID); + + ULONG nNewYSize = pObjWin->GetCalcPosPixel().Y() + GetDefSize().Height() + 2 * OBJWIN_Y_SPACING; + if (( nUnvisYOffs + GetDefSize().Height()) > nNewYSize ) + nNewYSize = nUnvisYOffs + GetDefSize().Height(); + + MapMode aMapMode = GetDepWin()->GetMapMode(); + Size aTmpSize( (ULONG) (double(nNewXSize) * double( aMapMode.GetScaleX())), (ULONG) (double( nNewYSize) * double( aMapMode.GetScaleY()))); + + Size aNowSize( GetGraphWin()->GetSizePixel()); + + if ( GetDepWin()->LogicToPixel( aNowSize ).Width() > aTmpSize.Width() ) + aTmpSize.Width() = GetDepWin()->LogicToPixel( aNowSize ).Width() ; + + if ( GetDepWin()->LogicToPixel( aNowSize ).Height() > aTmpSize.Height() ) + aTmpSize.Height() = GetDepWin()->LogicToPixel( aNowSize ).Height() ; + +// if ( nZoomed <= 0 ) +// { +// mpBaseWin->SetSizePixel( aTmpSize ); +// mpGraphWin->SetTotalSize( aTmpSize ); +// mpGraphWin->EndScroll( 0, 0 ); +// } + +// now remap all objects + ULONG nAllObjCount = pObjLst->Count(); + Point aTmpPos; + for ( j = 0; j < nAllObjCount; j++ ) + { + pWin = pObjLst->GetObject( j ); + if ( pWin->IsVisible()) { + aTmpPos = pWin->GetCalcPosPixel(); + if ( pWin->mbVisited ) + { +// reserve space for unconnected + aTmpPos.X() -= mnMinDynXOffs; + aTmpPos.X() += GetDefSize().Width() + OBJWIN_X_SPACING; +// center window + aTmpPos.X() += GetDefSize().Width() / 2; + aTmpPos.X() -= pWin->PixelToLogic( pWin->GetSizePixel()).Width() / 2 ; + } + pWin->SetPosPixel( GetDepWin()->LogicToPixel( aTmpPos )); + } + } + aWorkList.Clear(); + GetDepWin()->EnablePaint( TRUE ); + GetDepWin()->Invalidate(); +//LevelListen loeschen Hä? Welche Levellisten? + +//Update all Connectors +// --> To be done: Don't call twice Object1-Connector-Object2 + ObjectWin* pObject1; + for ( i = 0 ; i < nObjCount ; i++) + { + pObject1 = pObjLst->GetObject( i ); + if ( pObject1->IsVisible()) + pObject1->UpdateConnectors(); + }; + return 0; +} + +void SolDep::WriteToErrorFile() +{ +//Needs some improvement + ObjectWin* pWin; + WarningBox aWBox( mpBaseWin, WB_OK, String::CreateFromAscii("graph too deep! dat geiht nich gut.\nlook at depper.err in your Tmp-directory\nfor list of objects")); + aWBox.Execute(); + char *tmpdir = getenv("TMP"); + char *errfilebasename = "depper.err"; + char *ErrFileName = (char*) malloc( strlen( tmpdir ) + strlen( errfilebasename) + 3 ); + *ErrFileName = '\0'; + strcat( ErrFileName, tmpdir ); + strcat( ErrFileName, "\\" ); + strcat( ErrFileName, errfilebasename ); + FILE* pErrFile = fopen( "depper.err", "w+" ); + if ( pErrFile ) + { + for ( USHORT i = 0; i < mpTravellerList->Count(); i++ ) + { + pWin = mpTravellerList->GetObject( i ); + fprintf( pErrFile, " %s -> \n", (pWin->GetBodyText()).GetBuffer()); + } + fclose( pErrFile ); + } +} diff --git a/soldep/source/soldep.ico b/soldep/source/soldep.ico Binary files differnew file mode 100644 index 000000000000..dc0812889368 --- /dev/null +++ b/soldep/source/soldep.ico diff --git a/soldep/source/soldlg.cxx b/soldep/source/soldlg.cxx new file mode 100644 index 000000000000..96ad469f8284 --- /dev/null +++ b/soldep/source/soldlg.cxx @@ -0,0 +1,267 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/geninfo.hxx> +//#include "depapp.hxx" +#include <soldep/soldep.hxx> +#include <soldep/soldlg.hxx> +#include <soldep/soldlg.hrc> + +#ifndef SOLARIS +#define SIZE( nX, nY) \ + LogicToLogic(Size(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode()) +#define POS(nX, nY) \ + LogicToLogic(Point(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode()) +#else +#define SIZE( nX, nY) \ + LogicToLogic(Size(nX,nY),MapMode(MAP_APPFONT),GetMapMode()) +#define POS(nX, nY) \ + LogicToLogic(Point(nX,nY),MapMode(MAP_APPFONT),GetMapMode()) +#endif + + +// +// class SolNewProjectDlg +// + +/*****************************************************************************/ +SolNewProjectDlg::SolNewProjectDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maCancelButton( this, DtSodResId( BTN_CANCEL )), + maFTName( this, DtSodResId( FT_PRJNAME )), + maEName( this, DtSodResId( EDIT_PRJNAME )), + maFTShort( this, DtSodResId( FT_PRJSHORT )), + maEShort( this, DtSodResId( EDIT_PRJSHORT )), + maFTDeps( this, DtSodResId( FT_PRJDEPS )), + maEDeps( this, DtSodResId( EDIT_PRJDEPS )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolNewProjectDlg, OkHdl )); + maCancelButton.SetClickHdl( LINK( this, SolNewProjectDlg, CancelHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolNewProjectDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +/*****************************************************************************/ +IMPL_LINK( SolNewProjectDlg, CancelHdl, Button*, pCancelBtn ) +/*****************************************************************************/ +{ + EndDialog( 0 ); + return 0; +} + +// +// class SolNewDirectoryDlg +// + +/*****************************************************************************/ +SolNewDirectoryDlg::SolNewDirectoryDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maCancelButton( this, DtSodResId( BTN_CANCEL )), + maFTName( this, DtSodResId( FT_DIRNAME )), + maEName( this, DtSodResId( EDIT_DIRNAME )), + maFTFlag( this, DtSodResId( FT_DIRFLAG )), + maEFlag( this, DtSodResId( EDIT_DIRFLAG )), + maFTDeps( this, DtSodResId( FT_DIRDEPS )), + maEDeps( this, DtSodResId( EDIT_DIRDEPS )), + maFTAction( this, DtSodResId( FT_DIRACTION )), + maEAction( this, DtSodResId( EDIT_DIRACTION )), + maFTEnv( this, DtSodResId( FT_DIRENV )), + maEEnv( this, DtSodResId( EDIT_DIRENV )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, OkHdl )); + maCancelButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, CancelHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolNewDirectoryDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +/*****************************************************************************/ +IMPL_LINK( SolNewDirectoryDlg, CancelHdl, Button*, pCancelBtn ) +/*****************************************************************************/ +{ + EndDialog( 0 ); + return 0; +} + +// +// class SolHelpDlg +// + +/*****************************************************************************/ +SolHelpDlg::SolHelpDlg( Window* pParent, const ResId& rResId ) +/*****************************************************************************/ + : ModalDialog( pParent, rResId ), + maOkButton( this, DtSodResId( BTN_OK )), + maMLEHelp( this, DtSodResId( EDIT_HELP )) +{ + FreeResource(); + maOkButton.SetClickHdl( LINK( this, SolHelpDlg, OkHdl )); +} + +/*****************************************************************************/ +IMPL_LINK( SolHelpDlg, OkHdl, Button*, pOkBtn ) +/*****************************************************************************/ +{ + EndDialog( 1 ); + return 0; +} + +// +// class SolSelectVersionDlg +// + +/*****************************************************************************/ +SolSelectVersionDlg::SolSelectVersionDlg( + Window *pParent, GenericInformationList *pStandLst ) +/*****************************************************************************/ + : ModalDialog( pParent, DtSodResId( DLG_VERSIONSELECT )), + maVersionListBox( this, DtSodResId( DLG_VERSIONSELECT_LISTBOX )), + maVersionGroupBox( this, DtSodResId( DLG_VERSIONSELECT_GROUP )), + maMinorEditBox( this, DtSodResId( DLG_MINORSELECT_EDIT )), + maMinorGroupBox( this, DtSodResId( DLG_MINORSELECT_GROUP )), + maOKButton( this, DtSodResId( DLG_VERSIONSELECT_OK )), + maCancelButton( this, DtSodResId( DLG_VERSIONSELECT_CANCEL )) +{ + FreeResource(); + //Fill the ListBox with MWS versions (e.g. SRC680) from "stand.lst" + for ( ULONG i = 0; i < pStandLst->Count(); i++ ) { + String sVersion( *pStandLst->GetObject( i ), RTL_TEXTENCODING_ASCII_US ); + maVersionListBox.InsertEntry( sVersion ); + } + + if ( pStandLst->Count()) + maVersionListBox.SelectEntryPos( 0 ); + + maVersionListBox.SetDoubleClickHdl( + LINK( this, SolSelectVersionDlg, DoubleClickHdl )); + +} + +/*****************************************************************************/ +ByteString SolSelectVersionDlg::GetVersionMajor() +/*****************************************************************************/ +{ + //Returns the selected version + return ByteString(maVersionListBox.GetSelectEntry(), RTL_TEXTENCODING_ASCII_US ); +} + +/*****************************************************************************/ +ByteString SolSelectVersionDlg::GetVersionMinor() +/*****************************************************************************/ +{ + //Returns the minor + ByteString minor = ByteString(maMinorEditBox.GetText(), RTL_TEXTENCODING_ASCII_US ); + //check for correctness (format: "m1234") + //"m123s8" is unsupported because 'steps' aren't used anymore + minor.EraseLeadingAndTrailingChars(); + int check = minor.SearchChar("m"); + if (check == 0) + { + ByteString check2 = minor.Copy(1,(minor.Len()-1)); + if (check2.IsNumericAscii()) return minor; + } + return ByteString(""); +} + +/*****************************************************************************/ +IMPL_LINK( SolSelectVersionDlg, DoubleClickHdl, ListBox *, pBox ) +/*****************************************************************************/ +{ + EndDialog( RET_OK ); + return 0; +} + +// +// class SolAutoarrangeDlg +// + +/*****************************************************************************/ +SolAutoarrangeDlg::SolAutoarrangeDlg( Window *pParent ) +/*****************************************************************************/ + : ModelessDialog( pParent, DtSodResId( DLG_AUTOARRANGE )), + maGroupBox( this, DtSodResId( DLG_AUTOARRANGE_GROUP )), + maModuleText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_MODULE )), + maOverallText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_OVERALL )), + maModuleBar( this ), + maOverallBar( this ) +{ + FreeResource(); +/* Mac Porting..... taking address of temporary (warning) + maModuleBar.SetPosPixel( POS( 8, 28 )); + maOverallBar.SetPosPixel( POS( 8, 60 )); + maModuleBar.SetSizePixel( SIZE( 208,12 )); + maOverallBar.SetSizePixel( SIZE( 208,12 )); +*/ + maModuleBar.Show(); + maOverallBar.Show(); + + maModuleText.Show(); + maOverallText.Show(); +} + +/**********************************************************************************/ + +SolFindProjectDlg::SolFindProjectDlg( Window *pParent, ObjWinList* pObjList ) + : ModalDialog( pParent, DtSodResId( DLG_FIND_PROJECT )), + maCombobox( this, DtSodResId( DLG_FIND_PROJECT_COMBOBOX )), + maOKButton( this, DtSodResId( DLG_FIND_PROJECT_OK )), + maCancelButton( this, DtSodResId( DLG_FIND_PROJECT_CANCEL )) +{ + FreeResource(); + maCombobox.SetDropDownLineCount(15); +// SolDep* pSolDep = ((MyApp*)GetpApp())->GetSolDep(); +// ObjWinList* pObjList = pSolDep->GetObjectList(); + ULONG n = pObjList->Count(); + //Fill combobox + for (ULONG i=0; i<n; i++) { + ByteString prjname = pObjList->GetObject( i )->GetBodyText(); + if (prjname != ByteString("null")) //null_project + maCombobox.InsertEntry( String(prjname,RTL_TEXTENCODING_UTF8) ); + } +} + +ByteString SolFindProjectDlg::GetProject() +{ + return ByteString(maCombobox.GetText(),RTL_TEXTENCODING_UTF8); +}
\ No newline at end of file diff --git a/soldep/source/soldlg.src b/soldep/source/soldlg.src new file mode 100644 index 000000000000..0f5035fcee6e --- /dev/null +++ b/soldep/source/soldlg.src @@ -0,0 +1,374 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <dtsodcmp.hrc> +#include <soldep/soldlg.hrc> + +//======================================================================== +// Dialogs +ModalDialog RID_SD_DIALOG_NEWPROJECT +{ + OutputSize = TRUE; + Text = "New Project"; + PosSize = MAP_SYSFONT(18,18,142,142); + SVLook = TRUE; + MOVEABLE = TRUE; + CLOSEABLE = TRUE; + OKButton BTN_OK + { + PosSize = MAP_SYSFONT(5,123,40,14); + TabStop = TRUE; + Hide = FALSE; + DefButton = TRUE; + }; + CancelButton BTN_CANCEL { + PosSize = MAP_SYSFONT(50,123,40,14); + TabStop = TRUE; + }; + FixedText FT_PRJNAME { + PosSize = MAP_SYSFONT( 5, 10, 100, 10 ); + Text = "Project Name"; + }; + Edit EDIT_PRJNAME { + Border = TRUE; + PosSize = MAP_SYSFONT(5,20,132,10); + }; + FixedText FT_PRJSHORT { + PosSize = MAP_SYSFONT( 5, 30, 100, 10 ); + Text = "Project Short Name"; + }; + Edit EDIT_PRJSHORT { + Border = TRUE; + PosSize = MAP_SYSFONT(5,40,132,10); + }; + FixedText FT_PRJDEPS { + PosSize = MAP_SYSFONT( 5, 50, 100, 10 ); + Text = "Project Depends on"; + }; + Edit EDIT_PRJDEPS { + Border = TRUE; + PosSize = MAP_SYSFONT(5,60,132,10); + }; +}; + +ModalDialog RID_SD_DIALOG_NEWDIRECTORY +{ + OutputSize = TRUE; + Text = "New Directory"; + PosSize = MAP_SYSFONT(18,18,142,142); + SVLook = TRUE; + MOVEABLE = TRUE; + CLOSEABLE = TRUE; + OKButton BTN_OK + { + PosSize = MAP_SYSFONT(5,123,40,14); + TabStop = TRUE; + Hide = FALSE; + DefButton = TRUE; + }; + CancelButton BTN_CANCEL { + PosSize = MAP_SYSFONT(50,123,40,14); + TabStop = TRUE; + }; + FixedText FT_DIRNAME { + PosSize = MAP_SYSFONT( 5, 10, 132, 10 ); + Text = "Directory Name ( with projectname )"; + }; + Edit EDIT_DIRNAME { + Border = TRUE; + PosSize = MAP_SYSFONT(5,20,132,10); + }; + FixedText FT_DIRFLAG { + PosSize = MAP_SYSFONT( 5, 30, 100, 10 ); + Text = "Directory Flag"; + }; + Edit EDIT_DIRFLAG { + Border = TRUE; + PosSize = MAP_SYSFONT(5,40,132,10); + }; + FixedText FT_DIRDEPS { + PosSize = MAP_SYSFONT( 5, 50, 100, 10 ); + Text = "Directory Depends on"; + }; + Edit EDIT_DIRDEPS { + Border = TRUE; + PosSize = MAP_SYSFONT(5,60,132,10); + }; + FixedText FT_DIRACTION { + PosSize = MAP_SYSFONT( 5, 70, 100, 10 ); + Text = "What To Do"; + }; + Edit EDIT_DIRACTION { + Border = TRUE; + PosSize = MAP_SYSFONT(5,80,132,10); + }; + FixedText FT_DIRENV { + PosSize = MAP_SYSFONT( 5, 90, 100, 10 ); + Text = "Which Environments"; + }; + Edit EDIT_DIRENV { + Border = TRUE; + PosSize = MAP_SYSFONT(5,100,132,10); + }; +}; + + +ModalDialog RID_SD_DIALOG_HELP +{ + OutputSize = TRUE; + Text = "Help"; + PosSize = MAP_SYSFONT(18,18,242,242); + SVLook = TRUE; + MOVEABLE = TRUE; + CLOSEABLE = TRUE; + OKButton BTN_OK + { + PosSize = MAP_SYSFONT(101,223,40,14); + TabStop = TRUE; + Hide = FALSE; + DefButton = TRUE; + }; + MultiLineEdit EDIT_HELP { + Border = TRUE; + PosSize = MAP_SYSFONT(5,5,232,213); + }; +}; + +ModalDialog DLG_VERSIONSELECT { + OutputSize = TRUE; + Pos = MAP_APPFONT( 92, 40 ); + Size = MAP_APPFONT( 161, 98 ); + Text = "Open workspace"; + Moveable = TRUE; + Closeable = TRUE; + ListBox DLG_VERSIONSELECT_LISTBOX { + Border = TRUE; + Pos = MAP_APPFONT( 8, 16 ); + Size = MAP_APPFONT( 96, 72 ); + TabStop = TRUE; + }; + GroupBox DLG_VERSIONSELECT_GROUP { + Pos = MAP_APPFONT( 4, 4 ); + Size = MAP_APPFONT( 104, 88 ); + Text = "Workspaces"; + }; + OKButton DLG_VERSIONSELECT_OK { + Pos = MAP_APPFONT( 116, 64 ); + Size = MAP_APPFONT( 40, 12 ); + DefButton = TRUE; + TabStop = TRUE; + }; + CancelButton DLG_VERSIONSELECT_CANCEL { + Pos = MAP_APPFONT( 116, 80 ); + Size = MAP_APPFONT( 40, 12 ); + TabStop = TRUE; + }; + GroupBox DLG_MINORSELECT_GROUP { + Pos = MAP_APPFONT( 110, 4 ); + Size = MAP_APPFONT( 47, 30 ); + Text = "Minor"; + }; + Edit DLG_MINORSELECT_EDIT { + Border = TRUE; + Pos = MAP_APPFONT( 115, 16 ); + Size = MAP_APPFONT( 36, 12 ); + TabStop = TRUE; + }; +}; + +ModelessDialog DLG_AUTOARRANGE { + OutputSize = TRUE; + Pos = MAP_APPFONT( 40, 12 ); + Size = MAP_APPFONT( 225, 82 ); + Text = "Autoarrange"; + Moveable = TRUE; + GroupBox DLG_AUTOARRANGE_GROUP { + Pos = MAP_APPFONT( 4, 4 ); + Size = MAP_APPFONT( 216, 72 ); + Text = "Progress"; + }; + FixedText DLG_AUTOARRANGE_TEXT_MODULE { + Pos = MAP_APPFONT( 8, 16 ); + Size = MAP_APPFONT( 208, 10 ); + Text = ""; + }; + FixedText DLG_AUTOARRANGE_TEXT_OVERALL { + Pos = MAP_APPFONT( 8, 48 ); + Size = MAP_APPFONT( 208, 10 ); + Text = ""; + }; +}; + +ModalDialog DLG_FIND_PROJECT { + OutputSize = TRUE; + Pos = MAP_APPFONT( 40, 12 ); + Size = MAP_APPFONT( 155, 55 ); + Text = "Find Project"; + Moveable = TRUE; + SVLook = TRUE; + ComboBox DLG_FIND_PROJECT_COMBOBOX + { + Pos = MAP_APPFONT ( 5 , 18 ) ; + Size = MAP_APPFONT ( 100 , 90 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + VScroll = TRUE ; + Sort = TRUE ; + }; + OKButton DLG_FIND_PROJECT_OK { + Pos = MAP_APPFONT( 110, 10 ); + Size = MAP_APPFONT( 40, 12 ); + DefButton = TRUE; + TabStop = TRUE; + }; + CancelButton DLG_FIND_PROJECT_CANCEL { + Pos = MAP_APPFONT( 110, 26 ); + Size = MAP_APPFONT( 40, 12 ); + TabStop = TRUE; + }; +}; + +ToolBox TID_SOLDEP_MAIN +{ + ButtonType = BUTTON_SYMBOL; + Align = BOXALIGN_TOP; + LineCount = 1; + SVLook = TRUE; + Border = TRUE; + Sizeable = TRUE; + Dockable = TRUE; + Scroll = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Zoomable = TRUE; + ItemList = + { + ToolBoxItem + { + Identifier = TID_SOLDEP_OPEN; + Type = TOOLBOXITEM_BUTTON; + Text = "Load"; + HelpId = TID_SOLDEP_OPEN; + HelpText = "Load"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "sx03190.png"; + }; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_SAVE; + Type = TOOLBOXITEM_BUTTON; + Text = "Save"; + HelpId = TID_SOLDEP_SAVE; + HelpText = "Save"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "sc05505.png"; + }; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_SELECT_WORKSPACE; + Type = TOOLBOXITEM_BUTTON; + Text = "Select Workspace"; + HelpId = TID_SOLDEP_HIDE_INDEPENDEND; + HelpText = "Select Workspace"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "selectupd_16.png"; + }; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_FIND; + Type = TOOLBOXITEM_BUTTON; + Text = "Find Module"; + HelpId = TID_SOLDEP_FIND; + HelpText = "Find Module"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "sc05961.png"; + }; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_BACK; + Type = TOOLBOXITEM_BUTTON; + Text = "Back to Overview"; + HelpId = TID_SOLDEP_BACK; + HelpText = "Back to Overview"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "arrowup_16.png"; + }; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_HIDE_INDEPENDEND; + Type = TOOLBOXITEM_BUTTON; + Text = "Hide Independend Modules"; + HelpId = TID_SOLDEP_HIDE_INDEPENDEND; + HelpText = "Hide Independend Modules"; + Checkable = TRUE; + ItemBitmap = Bitmap + { + File = "hidedependency_16.png"; + }; + }; + ToolBoxItem + { + Identifier = TID_SOLDEP_CREATEMETA; + Type = TOOLBOXITEM_BUTTON; + Text = "Create MetaFile"; + Checkable = TRUE; + }; + }; +}; + +/*****************************************************************************/ +Bitmap TID_SMALL_PIN_PINED +/*****************************************************************************/ +{ + File = "ballgreen_7.png"; +}; + +/*****************************************************************************/ +Bitmap TID_SMALL_PIN_UNPINED +/*****************************************************************************/ +{ + File = "ballred_7.png"; +}; diff --git a/soldep/source/tbox.cxx b/soldep/source/tbox.cxx new file mode 100644 index 000000000000..327941167808 --- /dev/null +++ b/soldep/source/tbox.cxx @@ -0,0 +1,596 @@ +/************************************************************************* + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define private public + +#include <tools/ref.hxx> +#include <vcl/msgbox.hxx> +#include <soldep/soldep.hxx> +#include <soldep/tbox.hxx> +#include <soldep/soldlg.hrc> + + + +SoldepToolBox::SoldepToolBox( Window* pParent, const ResId& aId, BOOL bDAble ) : + ToolBox( pParent, aId ), + bDockable( bDAble ), + bCloseMode( FALSE ), + bBoxIsVisible( TRUE ), + bPinable( TRUE ), + aPinedBitmap( DtSodResId( TID_SMALL_PIN_PINED )), // BMP_SMALL_PIN_PINED + aUnpinedBitmap( DtSodResId( TID_SMALL_PIN_UNPINED )) // BMP_SMALL_PIN_UNPINED +{ + bPinable = TRUE; + + SetAlign( WINDOWALIGN_TOP ); + HideItem(TID_SOLDEP_BACK); //Inital hide this item, activated in project view. + HideItem(TID_SOLDEP_SAVE); // Hide this item now, not used yet + HideItem(TID_SOLDEP_OPEN); // Hide this item now, not used yet + + //SetMouseDownHdl(LINK(this,SoldepToolBox,MouseDownHdl)); + //SetFloatingLines( nFloatingLines ); + //SetFloatingMode( bFloatingMode ); + BOOL bFloatingMode = FALSE; + if ( bFloatingMode ) + { + //Point aPos( sToolBoxInfo.GetToken( 4, ',' ).ToInt64(), sToolBoxInfo.GetToken( 5, ',' ).ToInt64()); + //SetPosPixel( aPos ); + } + + if ( bDockable ) InsertSeparator( 0 ); // Freiraum für Abreißdödel schaffen + // (ein Separator an 1er Pos wird + // nicht gezeichnet, + // schafft aber Platz.) + bBoxIsVisible = FALSE; +// if ( sToolBoxInfo.GetToken( 3, ',' ) == "Visible" ) { + for ( USHORT i = 0; i < GetItemCount() && !bBoxIsVisible; i++ ) + { +// USHORT nItemId = GetItemId( i ); + + switch ( GetItemType( i )) + { + case TOOLBOXITEM_SPACE: + break; + case TOOLBOXITEM_SEPARATOR : + break; + default: + bBoxIsVisible = TRUE; + break; + } + } +// } + + if ( bBoxIsVisible ) { + if (!bDockable) + Show(); + else + Hide(); + } + else + Hide(); + + bOldFloatMode = IsFloatingMode(); +} + +/************************************************************************* +|* SoldepToolBox::~SoldepToolBox() +|************************************************************************/ + +SoldepToolBox::~SoldepToolBox() +{ +} + +/************************************************************************* +|* SoldepToolBox::Paint() +|************************************************************************/ + +void SoldepToolBox::Paint( const Rectangle& rRect ) +{ + SetOutStyle( TOOLBOX_STYLE_FLAT ); + + // Wenn wir eine Dockable ToolBox haben, ... + + if ( bDockable ) + { + USHORT nItemId = GetItemId( 0 ); + + // ... zeichnen wir den wunderbaren Abreiáddel ber das erste Item (Seperator) + + if ( !IsFloatingMode() && ( mnCurLine == 1 )) { + BOOL bIsCloseable = (( mnWinStyle & WB_CLOSEABLE ) != 0 ); + + ShowItem( nItemId ); + Rectangle aRect = GetItemRect( nItemId ); + + ToolBox::Paint( rRect ); + + if ( bIsCloseable ) + { + // Paint small cross button left/top of toolbar + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left()+6, aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+6)); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Left()+6, aRect.Top()+6)); + DrawLine( Point( aRect.Left()+6, aRect.Top()), Point( aRect.Left()+6, aRect.Top()+6)); + + SetLineColor( Color( COL_BLACK )); + + DrawLine( Point( aRect.Left()+2, aRect.Top()+2), Point( aRect.Left()+4, aRect.Top()+4)); + DrawLine( Point( aRect.Left()+2, aRect.Top()+4), Point( aRect.Left()+4, aRect.Top()+2)); + } + else if ( bPinable ) + { + if ( GetPin()) + DrawBitmap( Point( aRect.Left(), aRect.Top()), aPinedBitmap ); + else + DrawBitmap( Point( aRect.Left(), aRect.Top()), aUnpinedBitmap ); + } + + SetLineColor( Color( COL_WHITE )); + + if ( IsHorizontal()) + { + if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left(), aRect.Top()+8), Point( aRect.Right(), aRect.Bottom())); + + DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left(), aRect.Bottom())); + DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left()+2, aRect.Top())); + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+4, aRect.Bottom())); + DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+6, aRect.Top())); + + SetLineColor( Color( COL_GRAY ));//GRAY + + DrawLine( Point(aRect.Left()+2, aRect.Top()), Point(aRect.Left()+2, aRect.Bottom())); + DrawLine( Point(aRect.Left(), aRect.Bottom()), Point(aRect.Left()+2, aRect.Bottom())); + + SetLineColor( Color( COL_BLACK )); + + DrawLine( Point(aRect.Left()+6, aRect.Top()), Point(aRect.Left()+6, aRect.Bottom())); + DrawLine( Point(aRect.Left()+4, aRect.Bottom()), Point(aRect.Left()+6, aRect.Bottom())); + + } + else + { + if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left()+8, aRect.Top()), Point( aRect.Right(), aRect.Bottom())); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+2)); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + + DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Left(), aRect.Top()+6)); + DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+4)); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()+2), Point( aRect.Right(),aRect.Top()+2)); + DrawLine( Point( aRect.Right(), aRect.Top()), Point( aRect.Right(), aRect.Top()+2)); + + DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Right(),aRect.Top()+6)); + DrawLine( Point( aRect.Right(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+6)); + + } + } + else + { + // Sind wir im FloatingMode, dann wollen wir keinen Abreißdödel haben + // und hiden somit das erste Item. + + //Hiden löscht leider das erste Object der nächsten Zeile, daher nicht + //löschen + HideItem( nItemId ); + ToolBox::Paint( rRect ); + } + } + else + { + ToolBox::Paint( rRect ); + } +} + +/************************************************************************* +|* SoldepToolBox::MouseButtonDown() +|************************************************************************/ + +void SoldepToolBox::MouseButtonDown(const MouseEvent& rEvent) +{ + // Sind wir im DockingMode, ... + + if ( !IsFloatingMode() && ((( mnWinStyle & WB_CLOSEABLE ) != 0 ) || bPinable )) + { + // ... dann testen wir, ob am Abreiáddel der Close-Button gedrckt wurde ... + + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) + { + if ( bPinable ) { + TogglePin(); + Invalidate(); + } + else { + bCloseMode = TRUE; + + // ... und zeichnen ggf. den Button gedrckt. + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + } + } + else + { + ToolBox::MouseButtonDown( rEvent ); + } + } + else + { + ToolBox::MouseButtonDown( rEvent ); + } + + aMouseDownHdl.Call(this); +} + +/************************************************************************* +|* SoldepToolBox::MouseButtonUp() +|************************************************************************/ + +void SoldepToolBox::MouseButtonUp(const MouseEvent& rEvent) +{ + // Wenn der Close-Button am Abreiáddel zuvor gedrckt wurde, ... + + if ( bCloseMode ) + { + bCloseMode = FALSE; + + // ... so zeichen wir diesen wieder normal ... + + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + + SetLineColor( Color( COL_WHITE )); + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) + { + // ... und schlieáen die Box durch Aufruf der virtuellen Methode + // CloseDockingMode(). + + CloseDockingMode(); + } + else + { + ToolBox::MouseButtonUp( rEvent ); + } + } + else + { + ToolBox::MouseButtonUp( rEvent ); + } +} + +/************************************************************************* +|* SoldepToolBox::MouseMove() +|************************************************************************/ + +void SoldepToolBox::MouseMove(const MouseEvent& rEvent) +{ + // Wenn der Close-Button am Abreiáddel zuvor gedrckt wurde, ... + + if ( bCloseMode ) + { + Rectangle aRect = GetItemRect( GetItemId( 0 )); + aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); + + // ... der Mouse-Zeiger jedoch den Close-Button verlát, ... + + if ( !aRect.IsInside( rEvent.GetPosPixel())) + { + SetLineColor( Color( COL_WHITE )); + + // ... zeichnen wir diesen halt wieder normal. + + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); + DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); + + SetLineColor( Color( COL_GRAY )); + + DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); + DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); + + bCloseMode = FALSE; + } + else + { + ToolBox::MouseMove( rEvent ); + } + } + else + { + ToolBox::MouseMove( rEvent ); + } +} + +/*****************************************************************************/ +void SoldepToolBox::ToggleFloatingMode() +/*****************************************************************************/ +{ + ToolBox::ToggleFloatingMode(); + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +} + +/*****************************************************************************/ +void SoldepToolBox::EndDocking( const Rectangle& rRect, BOOL bFloatMode ) +/*****************************************************************************/ +{ + ToolBox::EndDocking( rRect, bFloatMode ); + if ( aResizeHdl.IsSet()) + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); + else + { + GetParent()->Resize(); + } +}; + +/*****************************************************************************/ +BOOL SoldepToolBox::Close() +/*****************************************************************************/ +{ + if (!ToolBox::Close()) return FALSE; + + return TRUE; +} + +/*****************************************************************************/ +void SoldepToolBox::Move() +/*****************************************************************************/ +{ +} + +/************************************************************************* +|* SoldepToolBox::CloseDockingMode() +|* +|* virtuelle Methode zur Reaktion auf den Close-Button im DockinMode +|************************************************************************/ + +void SoldepToolBox::CloseDockingMode() +{ + Hide(); + bBoxIsVisible = FALSE; + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +} + +/************************************************************************* +|* SoldepToolBox::Command() +|************************************************************************/ + +void SoldepToolBox::Command( const CommandEvent& rCEvt) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + if( !IsFloatingMode() && bDockable + && ( GetItemRect(GetItemId( 0 )).IsInside(rCEvt.GetMousePosPixel()))) + { + // Hier das Context-Menue fuer Abreißdödel dynamisch erzeugen... + + PopupMenu aPopupMenu; + + String sText( String::CreateFromAscii( "Floating mode" )); + aPopupMenu.InsertItem( 5, sText ); + aPopupMenu.InsertSeparator(); + + sText = String::CreateFromAscii( "Top" ); + aPopupMenu.InsertItem( 1, sText ); + sText = String::CreateFromAscii( "Bottom" ); + aPopupMenu.InsertItem( 2, sText ); + sText = String::CreateFromAscii( "Left" ); + aPopupMenu.InsertItem( 3, sText ); + sText = String::CreateFromAscii( "Right" ); + aPopupMenu.InsertItem( 4, sText ); + + switch( GetAlign()) + { + case WINDOWALIGN_TOP : aPopupMenu.EnableItem( 1, FALSE ); break; + case WINDOWALIGN_BOTTOM : aPopupMenu.EnableItem( 2, FALSE ); break; + case WINDOWALIGN_LEFT : aPopupMenu.EnableItem( 3, FALSE ); break; + case WINDOWALIGN_RIGHT : aPopupMenu.EnableItem( 4, FALSE ); break; + } + + if (( mnWinStyle & WB_CLOSEABLE ) != 0 ) + { + aPopupMenu.InsertSeparator(); + sText = String::CreateFromAscii( "Hide" ); + aPopupMenu.InsertItem( 6, sText ); + } + else if ( bPinable ) { + aPopupMenu.InsertSeparator(); + sText = String::CreateFromAscii( "Pin" ); + aPopupMenu.InsertItem( 6, sText ); + aPopupMenu.CheckItem( 6, GetPin()); + } + + // ... und rufen. + + aPopupMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); + aPopupMenu.Execute( this, rCEvt.GetMousePosPixel()); + } + else if ( !GetItemId(rCEvt.GetMousePosPixel())) + { + CallContextMenu( this, rCEvt.GetMousePosPixel()); + } + } + else ToolBox::Command( rCEvt ); +} + +/************************************************************************* +|* SoldepToolBox::GetContextMenu() +|************************************************************************/ + +PopupMenu *SoldepToolBox::GetContextMenu() +{ + InitContextMenu(); + return &aMenu; +} + +/************************************************************************* +|* SoldepToolBox::InitContextMenu() +|************************************************************************/ + +void SoldepToolBox::InitContextMenu() +{ + USHORT nStart = 0; + if ( bDockable ) + nStart = 1; + + aMenu.Clear(); + + for ( USHORT i = nStart; i < GetItemCount(); i++ ) + { + USHORT nItemId = GetItemId( i ); + + switch ( GetItemType( i )) + { + case TOOLBOXITEM_SPACE: + break; + case TOOLBOXITEM_SEPARATOR : + if (!(( i < GetItemCount() - 1 ) && ( GetItemType( i + 1 ) == TOOLBOXITEM_DONTKNOW ))) + aMenu.InsertSeparator(); + break; + default: + aMenu.InsertItem( nItemId, GetItemText( nItemId ), GetItemImage( nItemId )); + if (IsItemChecked( nItemId )) aMenu.CheckItem( nItemId, TRUE ); + if (!IsItemEnabled( nItemId )) aMenu.EnableItem( nItemId, FALSE ); + if (!IsItemVisible( nItemId )) aMenu.HideItem(nItemId); + break; + } + } +} + +/************************************************************************* +|* SoldepToolBox::CallContextMenu() +|************************************************************************/ + +void SoldepToolBox::CallContextMenu( Window *pWin, Point aPos ) +{ + if ( aMenu.IsInExecute()) + return; + + InitContextMenu(); + + // ... und rufen. + + aMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); + aMenu.Execute( pWin, aPos ); +} + +void SoldepToolBox::SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ) +{ +// if(rNewPos != GetPosPixel() || rNewSize != GetSizePixel()) +// { + ToolBox::SetPosSizePixel(rNewPos,rNewSize); +// Resize(); +// } +} + +void SoldepToolBox::SetDockingRects( const Rectangle& rOutRect, + const Rectangle& rInRect ) +{ + if(rOutRect != aOutRect || rInRect != aInRect) + { + ToolBox::SetDockingRects(rOutRect,rInRect); + Invalidate(); + + aOutRect = rOutRect; + aInRect = rInRect; + } +} + +/*****************************************************************************/ +void SoldepToolBox::StartDocking() +/*****************************************************************************/ +{ + ToolBox::StartDocking(); + CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); +}; + +BOOL SoldepToolBox::GetPin() + +{ + return bPin; +} + +void SoldepToolBox::TogglePin() +{ + bPin = !bPin; +} + +void SoldepToolBox::SetPin( BOOL bP ) +{ + bPin = bP; +} + +/************************************************************************* +|* SoldepToolBox::MenuSelectHdl() +|* +|* Handler, der beim Execute der Context-Mens gerufen wird +|************************************************************************/ + +IMPL_LINK ( SoldepToolBox, MenuSelectHdl, Menu*, pMenu ) +{ + // Wenn die CurItemId <= 6 ist, dann wurde das Abreiáddel-Context-Men ausgefhrt ... + ULONG itemid; + itemid = pMenu->GetCurItemId(); + + if ( pMenu == &aMenu ) + { + // ... Andernfalls wurde das Default-Context-Men ausgefhrt ... + USHORT nTmpId = mnCurItemId; + mnCurItemId = pMenu->GetCurItemId(); + + // ... und der gesetzte Handler (in soldep.cxx) wird gerufen. + maSelectHdl.Call( this ); + mnCurItemId = nTmpId; + } + return 0; +}
\ No newline at end of file diff --git a/soldep/util/perl.mk b/soldep/util/perl.mk new file mode 100644 index 000000000000..733459a96394 --- /dev/null +++ b/soldep/util/perl.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 +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +.IF "$(GUI)"=="WNT" +.IF "$(USE_SHELL)"=="4nt" +SOLARINC+=-I$(BUILD_TOOLS)$/perl$/lib$/core +PERL_LIB=$(BUILD_TOOLS)$/perl$/lib$/core$/perl58.lib +.ELSE # "$(USE_SHELL)"=="4nt" +SOLARINC+=-I$(BUILD_TOOLS)$/..$/perl$/lib$/core +PERL_LIB=$(BUILD_TOOLS)$/..$/perl$/lib$/core$/perl58.lib +.ENDIF # "$(USE_SHELL)"=="4nt" +.ENDIF + +.IF "$(OS)$(CPU)" == "LINUXI" + .IF "$(OUTPATH)" == "unxubti8" # Hack for Ububtu x86 builds in SO environment + SOLARINC+=-I$/usr$/lib$/perl$/5.8.8$/CORE + PERL_LIB= -lcrypt \ + $/usr$/lib$/libperl.a \ + $/usr$/lib$/perl$/5.8.8$/auto/DynaLoader/DynaLoader.a + .ELSE + SOLARINC+=-I$(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i686-linux$/CORE + PERL_LIB= -lcrypt \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i686-linux$/CORE$/libperl.a \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i686-linux$/auto/DynaLoader/DynaLoader.a + .ENDIF +.ENDIF + +.IF "$(OS)$(CPU)" == "SOLARISS" +SOLARINC+=-I$(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/sun4-solaris$/CORE +PERL_LIB= -lsocket \ + -lnsl \ + -ldl \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/sun4-solaris$/CORE$/shared$/libperl.so \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/sun4-solaris$/CORE$/shared$/DynaLoader.a +.ENDIF + +.IF "$(OS)$(CPU)" == "SOLARISI" +SOLARINC+=-I$(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i86pc-solaris$/CORE +PERL_LIB= -lsocket \ + -lnsl \ + -ldl \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i86pc-solaris$/CORE$/shared$/libperl.so \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/i86pc-solaris$/CORE$/shared$/DynaLoader.a +.ENDIF + +.IF "$(OS)$(CPU)" == "MACOSXI" +SOLARINC+=-I$(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/darwin-2level$/CORE +PERL_LIB= \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/darwin-2level$/CORE$/libperl.a \ + $(BUILD_TOOLS)$/..$/..$/lib$/perl5$/5.8.3$/darwin-2level$/auto/DynaLoader/DynaLoader.a +.ENDIF + |