Index: patches/GIT.pl
===================================================================
--- patches/GIT.pl	(revision 0)
+++ patches/GIT.pl	(revision 0)
@@ -0,0 +1,216 @@
+#! /usr/bin/perl -w
+
+my $remove = 0;
+my $dest_dir = shift || die "GIT.pl: usage: GIT.pl DESTDIR";
+my @DRINK = "tea";
+
+# start git -- do a smart @GIT@ sed into apply.pl.in?
+my $git_debug = $ENV{"OOO_GIT"};
+$SIG{ __DIE__ } = sub { require Carp; Carp::confess( @_ ) } if $git_debug;
+my $program = "apply.pl";
+
+sub read_pipe
+{
+    my $command = shift;
+    print "PIPING: $command\n" if $git_debug;
+    open PIPE, "$command|" || die "$program: error piping: $command\n";
+    my @result = <PIPE>;
+    my $status = !close PIPE;
+    print "STATUS: $status\n" if $git_debug;
+    print "LOG[0..99]: " . join "", @result[0..($#result < 99 ? $#result : 99)] if $git_debug;
+    return $status, join "", @result;
+}
+
+sub svn_revision
+{
+    my ($status, $log) = read_pipe "svn info";
+    $log =~ m/^Revision: ([0-9]+)/m;
+    return $1;
+}
+    
+sub git_is_archive
+{
+    return -d "$dest_dir/.git";
+}
+
+sub git_system
+{
+    my $command = shift;
+    # return system "cd $dest_dir && $command";
+    print "EXECUTING: $command\n" if $git_debug;
+    my $status = system "cd $dest_dir && $command";
+    print "STATUS: $status\n" if $git_debug;
+    die "$program: error executing: $command\n" if $status;
+    # return $status;
+}
+
+sub git_pipe
+{
+    my $command = shift;
+    return read_pipe "cd $dest_dir && $command";
+}
+
+
+sub git_commit
+{
+    my $message = shift;
+    git_system "git add .";
+    git_system "git add -u .";
+    git_system "git commit -m '$message'";
+}
+
+sub git_init
+{
+    git_system "../../bin/create-gitignores.sh";
+    git_system "git init";
+    print "Creating GIT archive - [ go and have some @DRINK@ ] ...\n";
+    git_system "git add .";
+    $svn_revision = svn_revision;
+    git_commit "Initial svn:r$svn_revision unpatched.";
+    git_system "git branch pristine";
+    git_system "git branch patched";
+}
+
+sub git_on_branch
+{
+    my ($branch) = shift;
+    $branch =~ s/\+/\\+/g;
+    my ($status, $log) = git_pipe "git branch";
+    return $log =~ m/(^|\n)\* $branch\n/;
+}
+
+sub git_has_branch
+{
+    my ($branch) = shift;
+    $branch =~ s/\+/\\+/g;
+    my ($status, $log) = git_pipe "git branch";
+    return $log =~ m/(^|\n)(\*| ) $branch\n/;
+}
+
+sub git_is_modified
+{
+    my ($status, $log) = git_pipe "git status";
+    # FIXME: git-status' exit code cannot be used to determine status;
+    # comparing command output.
+    return 0 if $log
+	=~ /^# On branch.*\nnothing to commit \(working directory clean\)\n/;
+    return $log;
+}
+
+sub git_select_branch
+{
+    my $branch = shift;
+    my $pending_changes = git_is_modified;
+    if ($pending_changes)
+    {
+	print "$program: git directory $dest_dir unclean: pending changes\n";
+	print "***************************\n";
+	print "$pending_changes";
+	print "***************************\n";
+	die;
+    }
+    my ($status, $log) = git_pipe "git checkout $branch";
+    return if !$status;
+    die "$program: cannot select branch $branch:\n$log";
+}
+
+sub git_prepare
+{
+    git_init $dest_dir if !git_is_archive;
+#    git_select_branch "patched" if !git_on_branch "patched";
+#    git_command "git clean -f";
+    if (!git_on_branch "patched")
+    {
+	git_select_branch "patched";
+	git_system "git clean -f";
+    }
+}
+    
+sub git_postpare
+{
+    return if !git_is_modified;
+    git_system "git add .";
+    git_system "git add -u .";
+    $svn_revision = svn_revision;
+    my $un = $remove ? "un" : "";
+    git_commit "Update to svn:r$svn_revision ${un}patched.";
+    git_system "git checkout master";
+    git_system "git rebase patched" if !$remove;
+    #print "Now do something like\n";
+    #print "    cd $dest_dir && git rebase patched\n";
+}
+
+my $module_re = 0;
+sub git_strip_module
+{
+    my $base = shift;
+#    return $base if $base =~ /^emf\+-/;
+#    return $base if $base =~ /^vba-/;
+    return $1 if $base =~ /^(cjk-character-units|emf\+|fpicker-kde|mono|transogl|unxsplash|vba|wpgimporter|writerfilter)-/;
+    return "vba" if $base =~ /ObjectModule/;
+    if (!$module_re)
+    {
+	my $modules = git_pipe "find . -mindepth 1 -maxdepth 1 -type d";
+	$modules =~ s@[.]/@@g;
+	$module_re = join "|", split " ", $modules;
+    }
+    $base =~ s/-($module_re)$//;
+    return $base;
+}
+
+sub git_patch_branch
+{
+    my $patch = shift;
+    $patch =~ /\/([^\/]+)[.](diff|patch)$/;
+    my $base = $1;
+    $base =~ s/[0-9]*$//;
+    my $branch = git_strip_module $base;
+    git_commit "Apply $patch.";
+    git_system "git branch $branch pristine" if !git_has_branch $branch;
+    git_select_branch $branch;
+    my $log = git_pipe "git log -1 patched";
+    $log =~ /^commit (.*)/;
+    my $commit = $1;
+#    git_system "git cherry-pick $commit";
+    my $status = system "cd $dest_dir && git cherry-pick $commit";
+    if ($status)
+    {
+	print "FIXME: patch depends on ealier patches: $patch\n";
+	git_system "git reset --hard HEAD";
+	git_system "git clean -f";
+	git_system "git checkout patched";
+	git_system "git branch -D $branch";
+	git_system "git branch $branch patched";
+	git_system "git tag FIXME-branched-from-patched-$base $branch";
+    }
+    git_select_branch "patched";
+}
+# end git
+
+read_pipe "exit-status 255";
+
+git_system "exit-status 0";
+#git_system "exit-status 1";
+#git_system "exit-status 255";
+
+print "HAS: EMF+\n"  if git_has_branch "emf+";
+exit 0;
+print "MODULE: " . git_strip_module "foo-test" . "\n";
+print "MODULE: " . git_strip_module "foo-svx" . "\n";
+
+$patch = "layout-tab-toolkit.diff";
+git_system "echo foo >> bar";
+sub git_patch_branch;
+git_patch_branch $patch if $ENV{"OOO_GIT"} =~ /branch/;
+git_system "git clean -f";
+
+read_pipe "exit-status 0";
+read_pipe "exit-status 1";
+
+exit 0;
+    
+{
+    git_prepare if $ENV{"OOO_GIT"};
+    git_postpare if $ENV{"OOO_GIT"};
+
+}
Index: patches/dev300/layout-tab-sfx2.diff
===================================================================
--- patches/dev300/layout-tab-sfx2.diff	(revision 12913)
+++ patches/dev300/layout-tab-sfx2.diff	(working copy)
@@ -1,3 +1,25 @@
+diff --git a/sfx2/inc/sfx2/macrconf.hxx b/sfx2/inc/sfx2/macrconf.hxx
+index 94bbf4b..4155b05 100644
+--- sfx2/inc/sfx2/macrconf.hxx
++++ sfx2/inc/sfx2/macrconf.hxx
+@@ -141,7 +141,7 @@ public:
+ 	sal_uInt16					GetSlotId(SfxMacroInfoPtr);
+ 	void					ReleaseSlotId(sal_uInt16 nId);
+ 	void					RegisterSlotId(sal_uInt16 nId);
+-	const SfxMacroInfoPtr 	GetMacroInfo(sal_uInt16 nId) const;
++    SfxMacroInfoPtr GetMacroInfo(sal_uInt16 nId) const;
+ 	sal_Bool					ExecuteMacro(sal_uInt16 nId, const String& rArgs ) const;
+ 	sal_Bool					ExecuteMacro( SfxObjectShell*, const SvxMacro*, const String& ) const;
+ 	sal_Bool					CheckMacro(sal_uInt16 nId) const;
+@@ -149,7 +149,7 @@ public:
+ 
+ //#if 0 // _SOLAR__PRIVATE
+ 	SAL_DLLPRIVATE static void Release_Impl();
+-	SAL_DLLPRIVATE const SfxMacroInfoPtr GetMacroInfo_Impl( const SvxMacro *pMacro ) const;
++    SAL_DLLPRIVATE SfxMacroInfoPtr GetMacroInfo_Impl( const SvxMacro *pMacro ) const;
+ 	DECL_DLLPRIVATE_LINK( CallbackHdl_Impl, SfxMacroConfig*);
+ 	DECL_DLLPRIVATE_LINK( EventHdl_Impl, SfxMacroInfo*);
+ //#endif
 diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
 index d5b930e..6087aba 100644
 --- sfx2/inc/sfx2/tabdlg.hxx
@@ -60,6 +82,28 @@
  
  	const OKButton& 	GetOKButton() const { return aOKBtn; }
  	OKButton&			GetOKButton() { return aOKBtn; }
+diff --git a/sfx2/source/control/macrconf.cxx b/sfx2/source/control/macrconf.cxx
+index 0a2a595..1ab851b 100644
+--- sfx2/source/control/macrconf.cxx
++++ sfx2/source/control/macrconf.cxx
+@@ -662,7 +662,7 @@ void SfxMacroConfig::RegisterSlotId(sal_uInt16 nId)
+ 
+ //==========================================================================
+ 
+-const SfxMacroInfoPtr SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const
++SfxMacroInfoPtr SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const
+ {
+ 	sal_uInt16 nCount = pImp->aArr.Count();
+ 	for (sal_uInt16 i=0; i<nCount; i++)
+@@ -674,7 +674,7 @@ const SfxMacroInfoPtr SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const
+ 
+ //==========================================================================
+ 
+-const SfxMacroInfoPtr SfxMacroConfig::GetMacroInfo_Impl( const SvxMacro *pMacro ) const
++SfxMacroInfoPtr SfxMacroConfig::GetMacroInfo_Impl( const SvxMacro *pMacro ) const
+ {
+ 	sal_uInt16 nCount = pImp->aArr.Count();
+ 	for (sal_uInt16 i=0; i<nCount; i++)
 diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
 index 57a8e89..9db6fba 100644
 --- sfx2/source/dialog/tabdlg.cxx
Index: patches/apply.pl.in
===================================================================
--- patches/apply.pl.in	(revision 12913)
+++ patches/apply.pl.in	(working copy)
@@ -6,7 +6,7 @@
 sub get_search_paths()
 {
     my @paths = ();
-    my @search = split /:/, $options{'PATCHPATH'};
+    my @search = split /:/, $options{'PATCHPATH'}; #/
 
     for my $stem (@search) {
 	push @paths, "$patch_dir/$stem";
@@ -719,6 +719,8 @@
         my $patch_file = basename($patch);
         print "\n" unless $quiet;
         do_patch $patch, $base_cmd;
+	sub git_patch_branch;
+	git_patch_branch $patch if $ENV{"OOO_GIT"} =~ /branch/;
 
         my $patch_copy = sprintf("%s/%03d-%s", $applied_patches, $patch_num++, $patch_file);
 
@@ -992,9 +994,192 @@
     print "Total no issue: $total_no_issue\n";
 }
 
+
+# start git -- do a smart @GIT@ sed into apply.pl.in?
+my $git_debug = $ENV{"OOO_GIT"};
+$SIG{ __DIE__ } = sub { require Carp; Carp::confess( @_ ) } if $git_debug;
+my $program = "apply.pl";
+
+sub read_pipe
+{
+    my $command = shift;
+    print "PIPING: $command\n" if $git_debug;
+    open PIPE, "$command|" || die "$program: error piping: $command\n";
+    my @result = <PIPE>;
+    my $status = !close PIPE;
+    print "STATUS: $status\n" if $git_debug;
+    print "LOG[0..99]: " . join "", @result[0..($#result < 99 ? $#result : 99)] if $git_debug;
+    return $status, join "", @result;
+}
+
+sub svn_revision
+{
+    my ($status, $log) = read_pipe "svn info";
+    $log =~ m/^Revision: ([0-9]+)/m;
+    return $1;
+}
+    
+sub git_is_archive
+{
+    return -d "$dest_dir/.git";
+}
+
+sub git_system
+{
+    my $command = shift;
+    # return system "cd $dest_dir && $command";
+    print "EXECUTING: $command\n" if $git_debug;
+    my $status = system "cd $dest_dir && $command";
+    print "STATUS: $status\n" if $git_debug;
+    die "$program: error executing: $command\n" if $status;
+    # return $status;
+}
+
+sub git_pipe
+{
+    my $command = shift;
+    return read_pipe "cd $dest_dir && $command";
+}
+
+sub git_commit
+{
+    my $message = shift;
+    git_system "git add .";
+    git_system "git add -u .";
+    git_system "git commit -m '$message'";
+}
+
+sub git_init
+{
+    git_system "../../bin/create-gitignores.sh";
+    git_system "git init";
+    print "Creating GIT archive - [ go and have some @DRINK@ ] ...\n";
+    git_system "git add .";
+    $svn_revision = svn_revision;
+    git_commit "Initial svn:r$svn_revision unpatched.";
+    git_system "git branch pristine";
+    git_system "git branch patched";
+}
+
+sub git_on_branch
+{
+    my ($branch) = shift;
+    $branch =~ s/\+/\\+/g;
+    my ($status, $log) = git_pipe "git branch";
+    return $log =~ m/(^|\n)\* $branch\n/;
+}
+
+sub git_has_branch
+{
+    my ($branch) = shift;
+    $branch =~ s/\+/\\+/g;
+    my ($status, $log) = git_pipe "git branch";
+    return $log =~ m/(^|\n)(\*| ) $branch\n/;
+}
+
+sub git_is_modified
+{
+    my ($status, $log) = git_pipe "git status";
+    # FIXME: git-status' exit code cannot be used to determine status;
+    # comparing command output.
+    return 0 if $log
+	=~ /^# On branch.*\nnothing to commit \(working directory clean\)\n/;
+    return $log;
+}
+
+sub git_select_branch
+{
+    my $branch = shift;
+    my $pending_changes = git_is_modified;
+    if ($pending_changes)
+    {
+	print "$program: git directory $dest_dir unclean: pending changes\n";
+	print "***************************\n";
+	print "$pending_changes";
+	print "***************************\n";
+	die;
+    }
+    my ($status, $log) = git_pipe "git checkout $branch";
+    return if !$status;
+    die "$program: cannot select branch $branch:\n$log";
+}
+
+sub git_prepare
+{
+    git_init $dest_dir if !git_is_archive;
+#    git_select_branch "patched" if !git_on_branch "patched";
+#    git_command "git clean -f";
+    if (!git_on_branch "patched")
+    {
+	git_select_branch "patched";
+	git_system "git clean -f";
+    }
+}
+    
+sub git_postpare
+{
+    return if !git_is_modified;
+    git_system "git add .";
+    git_system "git add -u .";
+    $svn_revision = svn_revision;
+    my $un = $remove ? "un" : "";
+    git_commit "Update to svn:r$svn_revision ${un}patched.";
+    git_system "git checkout master";
+    git_system "git rebase patched" if !$remove;
+    #print "Now do something like\n";
+    #print "    cd $dest_dir && git rebase patched\n";
+}
+
+my $module_re = 0;
+sub git_strip_module
+{
+    my $base = shift;
+#    return $base if $base =~ /^emf\+-/;
+#    return $base if $base =~ /^vba-/;
+    return $1 if $base =~ /^(cjk-character-units|emf\+|fpicker-kde|mono|transogl|unxsplash|vba|wpgimporter|writerfilter)-/;
+    return "vba" if $base =~ /ObjectModule/;
+    if (!$module_re)
+    {
+	my $modules = git_pipe "find . -mindepth 1 -maxdepth 1 -type d";
+	$modules =~ s@[.]/@@g;
+	$module_re = join "|", split " ", $modules;
+    }
+    $base =~ s/-($module_re)$//;
+    return $base;
+}
+
+sub git_patch_branch
+{
+    my $patch = shift;
+    $patch =~ /\/([^\/]+)[.](diff|patch)$/;
+    my $base = $1;
+    $base =~ s/[0-9]*$//;
+    my $branch = git_strip_module $base;
+    git_commit "Apply $patch.";
+    git_system "git branch $branch pristine" if !git_has_branch $branch;
+    git_select_branch $branch;
+    my $log = git_pipe "git log -1 patched";
+    $log =~ /^commit (.*)/;
+    my $commit = $1;
+#    git_system "git cherry-pick -x $commit";
+    my $status = system "cd $dest_dir && git cherry-pick -x $commit";
+    if ($status)
+    {
+	print "FIXME: patch depends on ealier patches: $patch\n";
+	git_system "git reset --hard HEAD";
+	git_system "git clean -f";
+	git_system "git checkout patched";
+	git_system "git branch -D $branch";
+	git_system "git branch $branch patched";
+	git_system "git tag FIXME-branched-from-patched-$base $branch";
+    }
+    git_select_branch "patched";
+}
+# end git
+
 (@ARGV > 1) ||
     die "Syntax:\n".
-    "apply <path-to-patchdir> <src root> --tag=<src680-m90> [--distro=<Debian> [--distro=<Binfilter> [...]]] [--quiet] [--dry-run] [ patch flags ]\n" .
+    "apply <path-to-patchdir> <src root> --tag=<src680-m90> [--distro=<Debian> [--distro=<Binfilter> [...]]] [--quiet] [--dry-run] [--with-git] [ patch flags ]\n" .
     "apply <path-to-patchdir> --series-from=<Debian>\n" .
     "apply <path-to-patchdir> --add-developer\n" .
     "apply <path-to-patchdir> --find-unused\n" .
@@ -1066,6 +1251,9 @@
 	    $tag = $1;
 	} elsif ($a =~ m/--dry-run/g) {
 	    $dry_run = 1;
+	} elsif ($a =~ m/--with-git/g) {
+	    print "A:$a\n";
+	    $ENV{"OOO_GIT"} = $a;
 	} else {
 	    push @arguments, $a;
 	}
@@ -1115,11 +1303,15 @@
 	$base_cmd = 'sed \'s/^\(@.*\)\r$/\1/\' | ' . $base_cmd;
     }
 
+    git_prepare if $ENV{"OOO_GIT"};
+
     if ($remove) {
 	remove_patches();
     } else {
 	apply_patches();
     }
+
+    git_postpare if $ENV{"OOO_GIT"};
 }
 
 # vim: ts=4 sw=4 noet
Index: bin/create-gitignores.sh
===================================================================
--- bin/create-gitignores.sh	(revision 12913)
+++ bin/create-gitignores.sh	(working copy)
@@ -15,22 +15,43 @@
         [ -d "$D" ] && echo "$B" >> "$D/.gitignore"
     fi
 done << EOF
-/applied_patches
+*-
+*-HEAD
+*-git
+*-patched
+*-pristine
+*.bak
+*.css
+*.cxx-*
+*.git
+*.hxx-*
+*.orig
+*.patched
+*.pristine
+*.pyc
+*.xcu
+*~
+.\#*
 /Linux*Env.Set*
 /bootstrap
 /makefile.mk
+/solver
+CVS
+TAGS
+\#*
+localize.sdf
 unxlng*.pro
-localize.sdf
-/solver
-*.orig
 config_office/autom4te.cache/
 config_office/config.log
 config_office/config.parms
 config_office/config.status
 config_office/configure
 config_office/set_soenv
+config_office/visibility.cxx
+config_office/visibility.s
 config_office/warn
 default_images/introabout/intro-save.bmp
+default_images/introabout/intro.bmp
 default_images/svx/res/openabout_ark.png
 default_images/svx/res/openabout_translateorgza.png
 default_images/sw/res/go-oo-team.png
@@ -88,11 +109,16 @@
 dmake/win95/.deps/
 dmake/win95/microsft/.deps/
 instsetoo_native/res/banner_nld.bmp
+instsetoo_native/res/banner_ooop.bmp
 instsetoo_native/res/nologoinstall_nld.bmp
+instsetoo_native/res/nologoinstall_ooop.bmp
 instsetoo_native/util/OpenOffice
+sd/xml/transitions-ogl.xml
 setup_native/source/win32/nsis/ooobanner_nld.bmp
+setup_native/source/win32/nsis/ooobanner_ooop.bmp
 setup_native/source/win32/nsis/ooobitmap_nld.bmp
+setup_native/source/win32/nsis/ooobitmap_ooop.bmp
 setup_native/source/win32/nsis/ooosetup_nld.ico
-solenv/unxlngx6/
+solenv/unxlngx*/
 svx/res/
 EOF
Index: Makefile.shared
===================================================================
--- Makefile.shared	(revision 12913)
+++ Makefile.shared	(working copy)
@@ -31,6 +31,9 @@
 		if test -n "$(OOO_ADDITIONAL_SECTIONS)" ; then \
 			FLAGS="$$FLAGS --additional-sections=$(OOO_ADDITIONAL_SECTIONS)"; \
 		fi ; \
+		if test -n "$(OOO_GIT)" ; then \
+			FLAGS="$$FLAGS --with-git=$(OOO_GIT)"; \
+		fi ; \
 		chmod +x $(TOOLSDIR)/patches/apply.pl && $(TOOLSDIR)/patches/apply.pl $(APPLY_DIR) $(OOBUILDDIR) $$FLAGS -f -R ; \
 	fi
 	cd $(top_srcdir)/bin ; ./unpack
@@ -97,6 +100,9 @@
 	if test -n "$(OOO_ADDITIONAL_SECTIONS)" ; then \
 		FLAGS="$$FLAGS --additional-sections=$(OOO_ADDITIONAL_SECTIONS)"; \
 	fi ; \
+	if test -n "$(OOO_GIT)" ; then \
+	   	FLAGS="$$FLAGS --with-git=$(OOO_GIT)"; \
+	fi ; \
 	chmod +x $(TOOLSDIR)/patches/apply.pl && $(TOOLSDIR)/patches/apply.pl $(APPLY_DIR) $(OOBUILDDIR) $$FLAGS --tag=$(CVSTAG) ;
 	$(TOOLSDIR)/bin/transform --apply $(TOOLSDIR) $(OOBUILDDIR)
 	$(TOOLSDIR)/bin/fix-deps $(OOBUILDDIR)
Index: configure.in
===================================================================
--- configure.in	(revision 12913)
+++ configure.in	(working copy)
@@ -328,6 +328,11 @@
 			  Example: --with-drink=coffee],
 ,)
 
+AC_ARG_WITH(git,
+[
+  --with-git              Use GIT to manage your patches],
+,)
+
 dnl
 dnl Items here only to make --help work nicely:
 dnl 
@@ -1098,6 +1103,19 @@
 fi
 AC_MSG_RESULT([$build_product])
 
+AC_MSG_CHECKING([whether to use GIT])
+if test -z "$with_git" -o "$with_git" = "no"; then
+    unset OOO_GIT
+    AC_MSG_RESULT([no])
+else
+    OOO_GIT=git
+    if test "z$with_git" != "zyes"; then
+        OOO_GIT=$with_git
+    fi
+    AC_MSG_RESULT([$OOO_GIT])
+fi
+AC_SUBST(OOO_GIT)
+
 UPSTREAM_NAME=
 UPSTREAM_SOURCE=
 UPSTREAM_URI=

