merge the formfield patch from ooo-build
[ooovba.git] / solenv / bin / modules / par2script / shortcut.pm
blob0cec817d591ca9cc97fee8794c6de24b2f2bfd5d
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: shortcut.pm,v $
11 # $Revision: 1.4 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
33 package par2script::shortcut;
35 use par2script::work;
37 ############################################################
38 # Writing shortcuts to files behind the correct files and
39 # then shortcuts to shortcuts behind these shortcuts.
40 ############################################################
42 sub shift_shortcut_positions
44 my ($script) = @_;
46 my $allshortcutgids = par2script::work::get_all_gids_from_script($script, "Shortcut");
48 # first all shortcuts that are assigned to files
50 for ( my $i = 0; $i <= $#{$allshortcutgids}; $i++ )
52 my $codeblock = par2script::work::get_definitionblock_from_script($script, ${$allshortcutgids}[$i]);
54 my $filegid = par2script::work::get_value_from_definitionblock($codeblock, "FileID");
56 if (!($filegid eq ""))
58 par2script::work::remove_definitionblock_from_script($script, ${$allshortcutgids}[$i]);
59 par2script::work::add_definitionblock_into_script($script, $codeblock, $filegid);
63 # secondly all shortcuts that are assigned to other shortcuts
65 for ( my $i = 0; $i <= $#{$allshortcutgids}; $i++ )
67 my $codeblock = par2script::work::get_definitionblock_from_script($script, ${$allshortcutgids}[$i]);
68 my $shortcutgid = par2script::work::get_value_from_definitionblock($codeblock, "ShortcutID");
70 if (!($shortcutgid eq ""))
72 par2script::work::remove_definitionblock_from_script($script, ${$allshortcutgids}[$i]);
73 par2script::work::add_definitionblock_into_script($script, $codeblock, $shortcutgid);